Web lists-archives.com

Re: /etc/network/interfaces with multiple network interfaces


On Wed, Jan 09, 2019 at 11:09:58PM +0100, Rainer Dorsch wrote:
> Hi,
> I have a system with two network interfaces, connecting to two subnets. 
> For some reason the default route is going through eth0.3, I would want to 
> have it through eth0.7.

Both of your VLANs are configured by DHCP, and have the same metric (0
by default).

> Is the default route determined by the order in /etc/network/interface of the 
> interfaces or is there another algorithm behind?

What really happens is one default route get replaced by another.
Whichever happens to be getting the lease last - wins.

If you need the default route on eno1.7 to appear and to be used -
assign lower metric to it. Like this (32 and 64 are arbitrary):

# cam
auto eno1.3
allow-hotplug eno1.3
iface eno1.3 inet dhcp
	metric 64
iface eno1.3 inet6 auto
	accept_ra 0

# data
auto eno1.7
allow-hotplug eno1.7
iface eno1.7 inet dhcp
	metric 32
iface eno1.7 inet6 auto
	accept_ra 0