centos 网络配置网络配置
-bash-4.1# setup #如果没有setup命令,可以yum install setuptool -y 也可以安装setup 命令
http://jingyan.baidu.com/album/25648fc1a303ce9191fd0032.html?picindex=2
-bash-4.1# yum install setuptool
然后输入自己ip地址,子网掩码,网关等,如果您用图形界面设置了还是没能生效静态ip,请更改文件BOOTPROTO=static
ifconfig -a
ifup etho 启用网0网卡
ifdown eth0 禁用1网卡
[[email protected] ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 #这个文件是自动获取IP ,只需要ONBOOT=yes 是yes即可
DEVICE=eth0
HWADDR=00:0C:29:79:38:BB
TYPE=Ethernet
UUID=31b2e3cb-096e-41a8-a6aa-da6db0935222
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=dhcp
[[email protected] ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HWADDR=00:0c:29:79:38:bb
TYPE=Ethernet
UUID=31b2e3cb-096e-41a8-a6aa-da6db0935222
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none #也可以BOOTPROTO=static
IPADDR=192.168.1.7
NETMASK=255.255.255.0
DNS2=114.114.114.114
GATEWAY=192.168.1.1
DNS1=202.96.134.133
IPV6INIT=no
USERCTL=no
[[email protected] ~]# cat /etc/resolv.conf #dns配配置文件