为什么 route-eth0 可能会被忽略而 route-eth1 不会?可能是因为 eth0 正在使用 DHCP 而 eth1 是静态配置的?
我配置了一些静态路由
[16:20:06][root@zserver2:/etc/sysconfig/network-scripts]$ ls -al ro*
-rw-r--r-- 1 root root 104 Dec 6 15:49 route-eth0
-rw-r--r-- 1 root root 106 Dec 6 15:49 route-eth1
Run Code Online (Sandbox Code Playgroud)
当我执行 a 时service network restart
,eth1 的路由被激活,但不是 eth0 的路由。
Anifup eth0
也会忽略它们,但是 anifup-routes eth0
就好了。激活它的最佳方法是什么?
[16:18:36][root@zserver2:/etc/sysconfig/network-scripts]$ service network restart
Shutting down interface eth0: Device state: 3 (disconnected)
[ OK ]
Shutting down interface eth1: Device state: 3 (disconnected)
[ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: Active connection state: activating
Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/28
state: activated
Connection activated
[ OK ]
Bringing up interface eth1: Active connection state: activated
Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/29
[ OK ]
Run Code Online (Sandbox Code Playgroud)
[16:18:50][root@zserver2:/etc/sysconfig/network-scripts]$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.15.10 192.168.15.11 255.255.255.255 UGH 1 0 0 eth1
192.168.15.11 0.0.0.0 255.255.255.255 UH 0 0 0 eth1
192.168.15.11 192.168.15.91 255.255.255.255 UGH 1 0 0 eth1
192.168.15.0 0.0.0.0 255.255.255.0 U 1 0 0 eth0
0.0.0.0 192.168.15.1 0.0.0.0 UG 0 0 0 eth0
Run Code Online (Sandbox Code Playgroud)
[16:19:03][root@zserver2:/etc/sysconfig/network-scripts]$ ifup eth0
Active connection state: activating
Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/30
state: activated
Connection activated
Run Code Online (Sandbox Code Playgroud)
[16:19:35][root@zserver2:/etc/sysconfig/network-scripts]$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.15.10 192.168.15.11 255.255.255.255 UGH 1 0 0 eth1
192.168.15.11 0.0.0.0 255.255.255.255 UH 0 0 0 eth1
192.168.15.11 192.168.15.91 255.255.255.255 UGH 1 0 0 eth1
192.168.15.0 0.0.0.0 255.255.255.0 U 1 0 0 eth0
0.0.0.0 192.168.15.1 0.0.0.0 UG 0 0 0 eth0
Run Code Online (Sandbox Code Playgroud)
[16:19:56][root@zserver2:/etc/sysconfig/network-scripts]$ ./ifup-routes eth0
[16:20:00][root@zserver2:/etc/sysconfig/network-scripts]$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.15.1 192.168.15.90 255.255.255.255 UGH 5 0 0 eth0
192.168.15.10 192.168.15.11 255.255.255.255 UGH 1 0 0 eth1
192.168.15.10 192.168.15.1 255.255.255.255 UGH 5 0 0 eth0
192.168.15.11 0.0.0.0 255.255.255.255 UH 0 0 0 eth1
192.168.15.11 192.168.15.91 255.255.255.255 UGH 1 0 0 eth1
192.168.15.0 0.0.0.0 255.255.255.0 U 1 0 0 eth0
0.0.0.0 192.168.15.1 0.0.0.0 UG 0 0 0 eth0
Run Code Online (Sandbox Code Playgroud)
配置文件是:
ifcfg-eth0
[16:30:26][root@zserver2:/etc/sysconfig/network-scripts]$ cat ifcfg-eth0
DEVICE=eth0
TYPE=Ethernet
UUID=76ef8242-9e22-4a29-93f3-a142d1460c87
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"
HWADDR=00:25:90:86:71:E0
PEERDNS=yes
PEERROUTES=yes
LAST_CONNECT=1386361279
Run Code Online (Sandbox Code Playgroud)
ifcfg-eth1
[16:30:35][root@zserver2:/etc/sysconfig/network-scripts]$ cat ifcfg-eth1
DEVICE=eth1
TYPE=Ethernet
UUID=647f66bd-67b2-4e9a-b5a5-4280ad677b9a
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth1"
IPADDR=192.168.15.91
PREFIX=32
HWADDR=00:25:90:86:71:E1
LAST_CONNECT=1386361279
Run Code Online (Sandbox Code Playgroud)
这也是我的结论。DHCP i/f 从 DHCP 服务器获取路由信息,因此在这种情况下这些文件将被忽略。
您应该能够通过 NetworkManager 并通过 UI 添加其他路由。
归档时间: |
|
查看次数: |
18120 次 |
最近记录: |