Once you have installed CentOS server or have created VPS, configure static IP address for connect an individual network. The most common interface file is ifcfg-eth0. As an administrator can manage the interface function in the server.
The below configuration can fix static IP address.
Open the ifcfg-eth0 file and add below configure lines,
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
TYPE=Ethernet
DEVICE=eth0
HWADDR=00:25:90:57:7A:8B
IPADDR=192.168.0.10
NETMASK=255.255.255.240
BROADCAST=192.168.0.200
ONBOOT=yes
GATEWAY=192.168.0.105
TYPE=Ethernet
DEVICE=eth0
HWADDR=00:25:90:57:7A:8B
IPADDR=192.168.0.10
NETMASK=255.255.255.240
BROADCAST=192.168.0.200
ONBOOT=yes
GATEWAY=192.168.0.105
IPADDR : your server IP Address is : 192.168.0.10
ONBOOT :
If have set ONBOOT=Yes device should be activated at boot-time.
If have set ONBOOT=No device should not be activated at boot-time.
GATEWAY : IP address of the network router.
HWADDR : the hardware address of the Ethernet device.
Restart your network sercices,
# /etc/init.d/network restart
Configure DNS Server:
# vi /etc/resolv.conf
nameserver 127.0.0.1
nameserver 192.168.0.101
nameserver 192.168.0.102
nameserver 127.0.0.1
nameserver 192.168.0.101
nameserver 192.168.0.102
If you need to check NetMask, Gateway, IP Address and Network interface.
# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.0.192 0.0.0.0 255.255.255.240 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 1002 0 0 eth0
0.0.0.0 192.168.0.105 0.0.0.0 UG 0 0 0 eth0
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.0.192 0.0.0.0 255.255.255.240 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 1002 0 0 eth0
0.0.0.0 192.168.0.105 0.0.0.0 UG 0 0 0 eth0
Comments (0)