在CentOS6下,添加网卡之后,先去查看网卡的mac地址。
cat /sys/class/net/eth1/address
接下来编辑/etc/udev/rules.d/70-persistent-net.rules(应该会自动生成),加上一行eth1相关的信息。
# This file was automatically generated by the /lib/udev/write_net_rules # program, run by the persistent-net-generator.rules rules file. # # You can modify it, as long as you keep each rule on a single # line, and change only the value of the NAME= key. # PCI device 0x1022:0x2000 (pcnet32) SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:32:9c:6b", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0" # PCI device 0x1022:0x2000 (pcnet32) SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:32:9c:75", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
最后新建/etc/sysconfig/network-scripts/ifcfg-eth1,(如果自动有了就无需新建)并输入以下代码,
DEVICE=eth1 IPADDR=IP地址 NETMASK=子网掩码 GATEWAY=网关 ONBOOT=yes
最后重启网络或者重启服务器即可。
转载请注明:宿居博客 » CentOS添加网卡