摘要
记录一下 CentOS 7 的网络配置,一开始是安装完的初始化配置,动态分配IP;然后改成了静态IP;之后又修改为配置网桥。
初始配置
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=dhcp DEFROUTE=yes IPV4_FAILURE_FATAL=no IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_FAILURE_FATAL=no IPV6_ADDR_GEN_MODE=stable-privacy NAME=enp0s31f6 UUID=98eb9b94-878c-4430-8ce5-13471bb46997 DEVICE=enp0s31f6 ONBOOT=no
|
静态IP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=static DEFROUTE=yes IPV4_FAILURE_FATAL=no IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_FAILURE_FATAL=no IPV6_ADDR_GEN_MODE=stable-privacy NAME=enp0s31f6 UUID=98eb9b94-878c-4430-8ce5-13471bb46997 DEVICE=enp0s31f6 ONBOOT=yes
IPADDR=192.168.0.123 GATEWAY=192.168.0.1 NETMASK=255.255.255.0 NM_CONTROLLED=no DNS1=8.8.8.8 DNS2=8.8.4.4
|
网桥
ifcfg-br0文件:
1 2 3 4 5 6 7 8 9
| TYPE=Bridge NAME=br0 DEVICE=br0 ONBOOT=yes BOOTPROTO=static IPADDR=192.168.0.123 GATEWAY=192.168.0.1 NETMASK=255.255.255.0 DNS1=192.168.0.1
|
ifcfg-enp0s31f6文件:
1 2 3 4 5 6
| TYPE=Ethernet BRIDGE=br0 NAME=enp0s31f6 UUID=99244a4d-8cac-4023-9a09-8e50c547cd3a DEVICE=enp0s31f6 ONBOOT=yes
|