RedHat static IP Address Configuration, redhat static IP Address
RedHat static IP Address Configuration
Modify the following three files in sequence:/etc/sysconfig/network-scripts/ifcfg-eth0/etc/resolv. conf
1./etc/sysconfig/networkNETWORKING = yesNETWORKING_IPV6 = noHOSTNAME = WKM # host name GATEWAY = 192.168.53.1 # Default GATEWAY
2./etc/sysconfig/network-scripts/ifcfg-eth0DEVICE = eth0 # DEVICE name NETMASK = 255.255.255.0 # subnet mask IPADDR = 192.168.53.147 # IP address BOOTPROTO = static # [none | static | bootp | dhcp] Protocol not used during boot | static allocation | # BOOTP protocol | DHCP protocol DNS1 = 211.99.25.1 # domain name resolution server ONBOOT = yes # [yes | no] whether to activate the device PEERDNS = yes during boot
3./etc/hosts# Create a hosting relationship between hostName and ip address # You can create multiple hostnames. One yourHostName must be the same as the HOSTNAME in step 1. # otherwise, you will use InetAddress. getLocalhost () has an exception. The corresponding ip address 192.168.ing 192.168.0.99 yourHostName localhost locahost should not be found. domain
4./etc/resolv. conf (this step can be left blank)Nameserver 211.99.25.1 # DNS configuration is the same as [DNS1 = 211.99.25.1] In 2]
5. the restart takes effect.
Make the IP address take effect:
/Sbin/ifdown eth0
/Sbin/ifup eth0Configure dns resolution (this step can not be done) echo "nameserver 211.98.1.28">/etc/resolv. conf
Notify gateway to update information:
/Etc/init. d/network restart