RHEL / Red hat / Fedora / CentOS Linux Static IP Configuration![](https://lh4.googleusercontent.com/4ywHtCXicJFuIOSiASeaMeL7Secw5qcM8oy8a6rOL91g1OduS9Zu2-hEGPMmp_EpVdB_8QTqhBv31I2zrY67NyjX3H7KWdPLy7p5Uiw-Uba6KI9QgncRWiJd)
For static IP configuration you need to edit the following files using a text editor such as vi. Edit /etc/sysconfig/network as follows, enter:
# cat /etc/sysconfig/network
Sample static ip configuration:
NETWORKING=yes
HOSTNAME=server1.cyberciti.biz
GATEWAY=192.168.3.1
HOSTNAME=server1.cyberciti.biz
GATEWAY=192.168.3.1
Edit /etc/sysconfig/network-scripts/ifcfg-eth0, enter:
# cat /etc/sysconfig/network-scripts/ifcfg-eth0
note:for fedora 19
Goto cd /etc/sysconfig/network-scripts/
ls | grep ifcfg
vi <ifcfg-enp0s3 or ifcfg-eth0 or ifcfg-p1s0>
Sample static ip configuration:
# Intel Corporation 82573E Gigabit Ethernet Controller (Copper)DEVICE=eth0
BOOTPROTO=static
DHCPCLASS=HWADDR=00:30:48:56:A6:2E
IPADDR=192.168.1.10
NETMASK=255.255.255.0
ONBOOT=yes
# Intel Corporation 82573E Gigabit Ethernet Controller (Copper)DEVICE=eth0
BOOTPROTO=static
DHCPCLASS=HWADDR=00:30:48:56:A6:2E
IPADDR=192.168.1.10
NETMASK=255.255.255.0
ONBOOT=yes
# cat /etc/resolv.conf
Sample static IP configurations:
nameserver 192.168.1.254
nameserver 8.8.8.8
nameserver 202.54.2.5
nameserver 8.8.8.8
nameserver 202.54.2.5
# /etc/init.d/network restart
To verify new static ip configuration for eth0, enter:
# ifconfig eth0
# route -n
Debian / Ubuntu Linux Static IP Configuration![](https://lh6.googleusercontent.com/89kQu75BOJJSaEZKuTsDfI7-1O2jvTIPfbSRPtKGe3KqQ_Vpl1XBw0YFJtWR6bOxW-6aZ1XYrkGt6rc6GlM4_qAWkhT8XZPI5b8SdUALMuxzwN6skHeHsd3_)
Edit /etc/hostname, enter:
# cat /etc/hostname
# cat /etc/network/interfaces
Sample static ip config:
iface eth0 inet static
address 192.168.1.10
network 192.168.1.0
netmask 255.255.255.0
broadcast 192.168.1.255
gateway 192.168.1.254
iface eth0 inet static
address 192.168.1.10
network 192.168.1.0
netmask 255.255.255.0
broadcast 192.168.1.255
gateway 192.168.1.254
# cat /etc/resolv.conf
Sample dns static IP configurations:
nameserver 192.168.1.254
nameserver 8.8.8.8
nameserver 202.54.2.5
nameserver 192.168.1.254
nameserver 8.8.8.8
nameserver 202.54.2.5
# /etc/init.d/networking restart
Type the following commands to verify your new setup, enter:
# ifconfig eth0
# route -n
# ping google.com
Leave a Comment