NIC configuration information
System version: CentOS 6.5
[root@39 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0 # 网卡名称
HWADDR=00:0c:29:b7:75:b9 # Mac地址
TYPE=Ethernet # 网络类型
UUID=f859baff-38d0-4987-b9e1-1f861ab87a00 # 磁盘唯一标识
ONBOOT=yes # 是否自启动网卡
NM_CONTROLLED=yes
BOOTPROTO=none # 网卡获取IP方式
IPADDR=10.0.0.200 # IP地址
NETMASK=255.255.255.0 # 子网掩码
GATEWAY=10.0.0.2 # 网关
DNS1=10.0.0.2 # DNS地址
USERCTL=no
PEERDNS=yes
IPV6INIT=no
Obtaining IP address
- none: NA protocol guide
- static: statically assigned IP address
- DHCP: Obtain an IP address automatically
Modify the network card configuration file
The first method: using vim configuration file card written in
the second method: using sed command to replace the file or add content to get with the cat command
使配置文件生效,重启单个网卡:
ifdown eth0 && ifup eth0
重启所有网卡:
/etc/init.d/network restart
NIC modify DNS problem
There are two ways to modify DNS:
- The first: to modify the network card configuration file
- The second: modification in /etc/resolv.conf
NIC configuration takes precedence over the /etc/resolv.conf
only modify the network card configuration file to the DNS