Fixed IP under Red Hat 6.5
February 12, 2014
I have a Red Hat test server I needed to set up with a fixed IP address. Handy info with a good bit of info available so just a memory dump for handy reference.
Go to
cd /etc/sysconfig/network-scripts
It will probably be the first network card on the system if not adjust the eth number as appropriate
vi ifcfg-eth0
Edit the file adding entries like this
DEVICE=eth0
BOOTPROTO=static
IPADDR=192.168.1.10
ONBOOT=yes
DNS1=192.168.1.2
DNS2=192.168.1.3
DNS3=192.168.1.4
DOMAIN=yourdomain.ie
SEARCH=yourdomain.ie
GATEWAY=192.168.1.1
For some reason the gateway settings wouldn’t work when entered into /etc/sysconfig/network but adding it to the network script did.
You need to restart the networking service for the changes to take effect.
/etc/init.d/networking restart
You should now have a fixed IP, you can check the other setting worked by
cat /etc/resolv.conf
# Generated by NetworkManager
search gms.ie
nameserver 192.168.215.10
nameserver 192.168.215.46
nameserver 192.168.215.6
route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 0.0.0.0 255.255.255.0 U 1 0 0 eth0
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0
Written by David Kerwick who lives and works Dublin as a Java Technical Lead.