Debian12 设置网卡优先级
编辑 /etc/network/interfaces
1
vim /etc/network/interfaces
调整 metric 优先级, 数值越小优先级越高
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
allow-hotplug ens18
iface ens18 inet dhcp
metric 10
allow-hotplug ens19
iface ens19 inet dhcp
metric 100重启网络服务
1
2
3systemctl restart systemd-networkd
# 或者
# systemctl restart networking