先写结果:
1.验证ifcfg-eth2与ifcfg-eth2bak这种格式的,service network restart 时会读取这种配置文件
如果改为mv ifcfg-eth2bak ifcfg-eth3.bak,则不会被读取。
2.验证了文件名的使用顺序,两个配置文件对应同一网卡时,以最早使用的配置文件的为准。
##########################################测试过程:
1.验证ifcfg-eth2与ifcfg-eth2bak这种格式的,service network restart 时会读取这种配置文件
如果改为mv ifcfg-eth2bak ifcfg-eth3.bak,则不会被读取。
[root@bys1 network-scripts]# mv ifcfg-eth3 ifcfg-eth3bak
[root@bys1 network-scripts]# mv ifcfg-eth2bak ifcfg-eth2.bak
[root@bys1 network-scripts]# service network restart
Shutting down interface eth0: [ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: [ OK ]
Bringing up interface eth3bak:
Determining IP information for eth3…^C
—改为ifcfg-eth3.bak,不会使用
[root@bys1 network-scripts]# mv ifcfg-eth3bak ifcfg-eth3.bak
[root@bys1 network-scripts]# service network restart
Shutting down interface eth0: [ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: [ OK ]
—-改回去 ifcfg-eth3bak验证会使用
[root@bys1 network-scripts]# mv ifcfg-eth3.bak ifcfg-eth3bak
[root@bys1 network-scripts]# service network restart
Shutting down interface eth0: [ OK ]
Shutting down interface eth3bak: [ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: [ OK ]
Bringing up interface eth3bak:
Determining IP information for eth3…^C
####################################
2.测试同一网卡,不同配置文件名时的使用顺序及对应IP生效情况
验证了文件名的使用顺序,两个配置文件对应同一网卡时,以最早使用的配置文件的为准。
配置文件情况
[root@bys1 network-scripts]# cat ifcfg-eth1
# Intel Corporation 82540EM Gigabit Ethernet Controller
DEVICE=eth1
BOOTPROTO=none
ONBOOT=yes
HWADDR=08:00:27:A0:5F:E7
NETMASK=255.255.255.0
IPADDR=192.168.10.1
[root@bys1 network-scripts]# cat ifcfg-eth1bak
# Intel Corporation 82540EM Gigabit Ethernet Controller
DEVICE=eth1
BOOTPROTO=none
ONBOOT=yes
HWADDR=08:00:27:A0:5F:E7
NETMASK=255.255.255.0
IPADDR=192.168.11.1
—实验1;将IP192.168.10.1对应的配置文件先读取,后续eth1bak配置文件不会影响。
[root@bys1 network-scripts]# service network restart
Shutting down interface eth0: [ OK ]
Shutting down interface eth1: [ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: [ OK ]
Bringing up interface eth1: [ OK ]
Bringing up interface eth1bak: [ OK ]
[root@bys1 network-scripts]# ifconfig
eth1 Link encap:Ethernet HWaddr 08:00:27:A0:5F:E7
inet addr:192.168.10.1 Bcast:192.168.10.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:104 errors:0 dropped:0 overruns:0 frame:0
TX packets:35 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:15754 (15.3 KiB) TX bytes:5698 (5.5 KiB)
–实验2:将IP192.168.11.1对应的配置文件先读取,会使用此配置文件的信息。
[root@bys1 network-scripts]# mv ifcfg-eth1 ifcfg-eth1b
[root@bys1 network-scripts]# mv ifcfg-eth1bak ifcfg-eth1a
[root@bys1 network-scripts]# service network restart
Shutting down interface eth0: [ OK ]
Shutting down interface eth1a: [ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: [ OK ]
Bringing up interface eth1a: [ OK ]
Bringing up interface eth1b: [ OK ]
[root@bys1 network-scripts]# ifconfig eth1
eth1 Link encap:Ethernet HWaddr 08:00:27:A0:5F:E7
inet addr:192.168.11.1 Bcast:192.168.11.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:136 errors:0 dropped:0 overruns:0 frame:0
TX packets:62 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:19100 (18.6 KiB) TX bytes:9287 (9.0 KiB)