CentOS网络配置
1. 修改IP地址,进入/etc/sysconfig/network-scripts目录
对ifcfg-eth0进行编辑:
DEVICE=”eth0″
NM_CONTROLLED=”yes”
BOOTPROTO=static
NM_CONTROLLED=”yes”
HWADDR=”BC:30:5B:DB:A8:79″
IPADDR=IP地址
NETMASK=255.255.255.192
IPV6INIT=”no”
IPV6_AUTOCONF=”no”
ONBOOT=”yes” (这里一定要配成yes,否者重启服务时eth0也不会启动)
2.修改网关:进入/etc/sysconfig目录
对network进行编辑:
NETWORKING=yes
GATEWAY=180.186.73.129
HOSTNAME=localhost.localdomain
3.修改DNS:进入/etc目录
对resolv.conf进行编辑:
nameserver 202.106.0.20
search localhost
4.重启服务:
service network restart
或
/etc/init.d/network restart