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=192.168.2.80 PREFIX0=24 GATEWAY0=192.168.2.1 DNS1=8.8.8.8 DNS2=8.8.4.4 Restart network service: systemctl restart network

February 24, 2020 · 1 min · Justin Hung