在如下所示的 netplan yaml 配置文件中:
network:
version: 2
renderer: networkd
ethernets:
eno5:
dhcp4: false
dhcp6: false
link-local: [ ]
addresses:
- xxx.xxx.xxx.2/24
# gateway4: xxx.xxx.xxx.1
nameservers:
addresses:
- 8.8.8.8
- 8.8.4.4
routes:
- to: 0.0.0.0/0
via: xxx.xxx.xxx.1
metric: 500
table: 5000
routing-policy:
- from: 0.0.0.0/0
interface: eno5
priority: 501
- from: xxx.xxx.xxx.2
table: 5000
priority: 512
我需要手动输入ip rule add oif eno5 lookup 5000
以便我可以执行ping -I eno5 google.com
。
如果有办法将其插入 yaml 文件中,请告诉我。我尝试了以下方法,但无济于事:
- from: 0.0.0.0/0
interface: eno5
priority: 501
和
- from: 0.0.0.0/0
oif: eno5
priority: 501