General Information
Configure static IP, Mask, Gateway, and DNS.
Checklist
if possible, bring interface down first: ifdown eth0.
vim /etc/network/interfaces
auto eth0 iface eth0 inet dhcp
auto eth0 iface eth0 inet static address 192.168.0.100 netmask 255.255.255.0 gateway 192.168.0.254 dns-nameservers 8.8.8.8 8.8.4.4
ifup eth0
shutdown -r now
Classic and NetworkManager methods of setting IP addresses for EL distros.
Using config files and the network service.
vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0 ONBOOT=no (change to yes to have DHCP start automatically) NM_CONTROLLED=yes BOOTPROTO=dhcp
DEVICE=eth0 ONBOOT=yes NM_CONTROLLED=no BOOTPROTO=static IPADDR=192.168.0.101 NETMASK=255.255.255.0 GATEWAY=192.168.0.254
vim /etc/resolv.conf nameserver 8.8.8.8 nameserver 8.8.4.4
/etc/init.d/network restart
Using the NetworkManager service.
Static IP/Gateway
nmcli con mod eth0 autoconnect yes ipv4.method manual ip4 192.168.1.50/24 gw4 192.168.1.254
nmcli con up eth0
Static DNS
nmcli con mod eth0 ipv4.dns 1.1.1.1
nmcli con up eth0