linux-网卡设置

需要修改的文件
/etc/sysconfig/network
/etc/sysconfig/network-scripts/ifcfg-eth0
/etc/resolv.conf

1)主机名,协议
/etc/sysconfig/network
NETWORKING=yes
HOSTNAME=localhost.localdomain
NETWORKING_IPV6=no

2)IP地址,网关
/etc/sysconfig/network-scripts/ifcfg-eth0
# Broadcom Corporation NetXtreme BCM5754 Gigabit Ethernet PCI Express
# BOOTPROTO=dhcp
DEVICE=eth0
BOOTPROTO=static
HWADDR=00:1A:A0:AD:9A:71
ONBOOT=yes
DHCP_HOSTNAME=localhost
IPADDR=192.168.1.253
NETMASK=255.255.255.0
#GATEWAY=192.168.1.254
BROADCAST=192.168.1.255
#DNS1=XXX.XXX.XXX.XXX
#DNS2=XXX.XXX.XXX.XXX

重启
service network restart
#动态添加网卡
执行
start_udev
查看
/etc/udev/rules.d/70-persistent-net.rules
参考文章
http://tonychiu.blog.51cto.com/656605/949333
UUID选项可以忽略,没有用处
#UUID=6a5fdbe2-30fc-4b7d-bd57-c80cad21011d

3) DNS
/etc/resolv.conf
nameserver 202.106.46.151
nameserver 202.106.195.68

你可能感兴趣的:(linux)