Linux CentOS configuration IP, linuxcentos configuration ip
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 = yes
HWADDR = 00: 0C: 29: 5D: 18: EE
TYPE = Ethernet
BOOTPROTO = static
IPADDR = 192.168.1.dr
NETMASK = 255.255.255.0
NETWORK = 192.168.1.1
DEFROUTE = yes
20174_failure_fatal = yes
IPV6INIT = no
DNS1 = 114.114.114.114
DNS2 = 202.96.134.20.
--------------------------------------------- The following is a description
DEVICE = "eth0"/nic device name
HWADDR = 00: 0C: 29: 5D: 18: EE/NIC physical address
BOOTPROTO = static/set the way for the NIC to obtain the IP address. Here, manually enter
IPADDR = 192.168.1.133/static IP Address
NETMASK = 255.255.255.0/subnet mask
NETWORK = 192.168.1.1/gateway address
--------------------------------------------- The preceding descriptions are as follows:
2. Modify and edit the gateway Configuration
# Vi/etc/sysconfig/network
NETWORKING = yes
NETWORKING_IPV6 = no
HOSTNAME = centos
GATEWAY = 192.168.1.1
--------------------------------------------- The following is a description
NETWORKING = yes/indicates whether the system uses the network, which is generally set to yes.
HOSTNAME = centos/set the Host Name of the Local Machine
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.114
Nameserver 202.96.134.133
Search localdomain
--------------------------------------------- The following is a description
Nameserver 114.114.114.114/DNS preferred address
Nameserver 202.96.134.133/DNS backup address
--------------------------------------------- The preceding descriptions are as follows:
4. Restart the service
# Service network restart or #/etc/init. d/network restart