我正在尝试在 eth1 上为我的 ubuntu 盒子建立后备连接(它实际上是一个华为 HiLink 移动宽带调制解调器)。这是我的接口文件的内容:
auto lo
iface lo inet loopback
auto eth0
allow-hotplug eth0
iface eth0 inet manual
auto eth1
allow-hotplug eth1
iface eth1 inet manual
metric 400 # does not work
Run Code Online (Sandbox Code Playgroud)
我使用 dhcpcd 作为网络管理器。我读过 dhcpcd 自动将以太网设备的指标设置为 200+,将 wlan 设备的指标设置为 300+。这是我的输出route -n
:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 10.42.0.1 0.0.0.0 UG 202 0 0 eth0
0.0.0.0 192.168.1.1 0.0.0.0 UG 203 0 0 eth1
0.0.0.0 192.168.0.1 0.0.0.0 UG 304 0 0 wlan0
10.42.0.0 0.0.0.0 255.255.255.0 U 202 0 0 eth0
192.168.0.0 0.0.0.0 255.255.255.0 U 304 0 0 wlan0
192.168.1.0 0.0.0.0 255.255.255.0 U 203 0 0 eth1
Run Code Online (Sandbox Code Playgroud)
是否可以在其他地方更改 dhcpcd 中的指标?因为在接口文件中它根本不起作用!
dhcpcd 的配置文件是/etc/dhcpcd.conf。
我只需要添加这两行:
interface eth1
metric 400
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
5251 次 |
最近记录: |