LinuxCentOS IP configuration
Demo Environment
VMware8 + Linux CentOS 6.2x32
Set IP, website, DNS
1. Modify and edit Nic configurations
# Vi/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE = "eth0" ONBOOT = yesHWADDR = 00: 0C: 29: 5D: 18: EETYPE = EthernetBOOTPROTO = staticIPADDR = bandwidth = 255.255.255.0NETWORK = 192.168.1.1DEFROUTE = bandwidth = yesIPV6INIT = noDNS1 = bandwidth = commandid The following describes DEVICE = "eth0"/nic device name HWADDR = 00: 0C: 29: 5D: 18: EE/NIC physical address BOOTPROTO = static/set the nic ip address acquisition method, here is the manual filling IPADDR = 192.168.1.133/static IP address NETMASK = 255.255.255.0/subnet mask NETWORK = 192.168.1.1/gateway address ----------------------------------------- the above is a description
2. Modify and edit the gateway Configuration
# Vi/etc/sysconfig/network
NETWORKING = yesNETWORKING_IPV6 = noHOSTNAME = centosGATEWAY = 192.168.1.1 --------------------------------------------- The following describes whether the NETWORKING = yes/indicates whether the system uses the network. Generally, it is set to yes. HOSTNAME = centos/set the local host name GATEWAY = 192.168.1.1/set the IP address of the GATEWAY. --------------------------------------------- The preceding descriptions are as follows:
The first two items are already available by default when I edit them here, so only GATEWAY is added.
3. Modify DNS and edit DNS
# Vi/etc/resolv. conf
Nameserver 114.114.114.114nameserver 202.96.134.133search localdomain names the following describes nameserver 114.114.114.114/DNS preferred address nameserver 202.96.134.133/DNS backup address later
4. Restart the service
# Service network restart or #/etc/init. d/network restart