[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

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



On 1/9/19, Rainer Dorsch <ml@bokomoko.de> 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.

further down you've got:
rd@master:~$ ip r
default via 192.168.3.1 dev eno1.3
192.168.3.0/24 dev eno1.3 proto kernel scope link src 192.168.3.2
192.168.7.0/24 dev eno1.7 proto kernel scope link src 192.168.7.2

Just a guess, but the default gateway is 192.168.3.1 & eno1.3 is
directly connected to that subnet so that's the best route.

Change your default gateway to 192.168.7.1 (or whatever the router is
on that subnet) & it should pick eno1.7 for the default route.

Regards,
Lee

>
> Is the default route determined by the order in /etc/network/interface of
> the
> interfaces or is there another algorithm behind?
>
> rd@master:~$ cat /etc/network/interfaces
> # 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
>
> auto eno1
> allow-hotplug eno1
> #iface eno1 inet dhcp
> iface eno1 inet6 auto
>   accept_ra 0
>
> # cam
> auto eno1.3
> allow-hotplug eno1.3
> iface eno1.3 inet dhcp
> iface eno1.3 inet6 auto
>   accept_ra 0
>
> # data
> auto eno1.7
> allow-hotplug eno1.7
> iface eno1.7 inet dhcp
> iface eno1.7 inet6 auto
>   accept_ra 0
> rd@master:~$ ip a show
> 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group
> default qlen 1
>     link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
>     inet 127.0.0.1/8 scope host lo
>        valid_lft forever preferred_lft forever
>     inet6 ::1/128 scope host
>        valid_lft forever preferred_lft forever
> 2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state
> UP
> group default qlen 1000
>     link/ether 18:66:da:20:6f:2d brd ff:ff:ff:ff:ff:ff
>     inet6 fe80::1a66:daff:fe20:6f2d/64 scope link
>        valid_lft forever preferred_lft forever
> 3: eno1.3@eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue
> state
> UP group default qlen 1000
>     link/ether 18:66:da:20:6f:2d brd ff:ff:ff:ff:ff:ff
>     inet 192.168.3.2/24 brd 192.168.3.255 scope global eno1.3
>        valid_lft forever preferred_lft forever
>     inet6 fe80::1a66:daff:fe20:6f2d/64 scope link
>        valid_lft forever preferred_lft forever
> 4: eno1.7@eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue
> state
> UP group default qlen 1000
>     link/ether 18:66:da:20:6f:2d brd ff:ff:ff:ff:ff:ff
>     inet 192.168.7.2/24 brd 192.168.7.255 scope global eno1.7
>        valid_lft forever preferred_lft forever
>     inet6 fe80::1a66:daff:fe20:6f2d/64 scope link
>        valid_lft forever preferred_lft forever
> rd@master:~$ ip r
> default via 192.168.3.1 dev eno1.3
> 192.168.3.0/24 dev eno1.3 proto kernel scope link src 192.168.3.2
> 192.168.7.0/24 dev eno1.7 proto kernel scope link src 192.168.7.2
> rd@master:~$
>
>
> Thanks
> Rainer
> --
> Rainer Dorsch
> http://bokomoko.de/
>
>
>


Reply to: