I am a Yun-Wei, the company's computers and servers, etc. i will set fixed IP to facilitate my management. This is mainly CentOS set fixed IP address, because I was just beginning to learn Linux encountered a second challenge problem, if I do not fix it I can not move forward.
Demo Environment
VMware8 + Linux CentOS 6.2 x32
Set IP, Web site, DNS
1, modify the network card configuration, edit
#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.251
netmask=255.255.255.0
network=192.168.1.1
Defroute=yes
Ipv4_failure_fatal=yes
Ipv6init=no
---------------------------------------------Below is a description
Device= "eth0"/NIC device name
Hwaddr=00:0c:29:5d:18:ee/network card Physical Address
Bootproto=static/Set the way the NIC gets the IP address, here is the manual fill
ipaddr=192.168.1.251/Static IP address
netmask=255.255.255.0/Subnet Mask
network=192.168.1.1/Gateway Address
---------------------------------------------above is the description
2, modify the gateway configuration, edit
#vi/etc/sysconfig/network
Networking=yes
Networking_ipv6=no
Hostname=centos
gateway=192.168.1.1
---------------------------------------------Below is a description
Networking=yes/Indicates whether the system uses the network and is generally set to Yes.
Hostname=centos/Set host name for this machine www.111cn.net
gateway=192.168.1.1/Set the IP address of the gateway.
---------------------------------------------above is the description
I'm editing this here. The first two items are already by default, so only the gateway is added
3, modify DNS, edit
#vi/etc/resolv.conf
NameServer 114.114.114.114
NameServer 202.96.134.133
Search Localdomain
---------------------------------------------Below is a description
NameServer 114.114.114.114/dns Preferred Address
NameServer 202.96.134.133/dns Alternate Address
---------------------------------------------above is the description
4. Restart Service
#service Network restart or #/etc/init.d/network restart