Setting up Static IP on CentOS7

In a CentOS 7, we configuring a network interface using ifcfg files located in /etc/sysconfig/network-scripts/ directory, follow steps below and you will be good to go. Create a file named /etc/sysconfig/network-scripts/ifcfg-eth0 Add following configuration into the file DEVICE=eth0 DEVICETYPE=EtherNet BOOTPROTO=static DEFROUTE=yes NAME=eth0 ONBOOT=yes IPADDR0= PREFIX0=24 GATEWAY0= DNS1= DNS2= Restart network service: systemctl restart network

February 24, 2020 · 1 min · Justin Hung