I've tried for many hours now to find a solution to my issue, but I can't seem to locate a permanent explanation - I'm also an ultra noob, so forgive me if I get the basics incorrect.
I have a server running on LTS Ubuntu 22.04 with two interfaces, eno1 and eno2 - one interface has an internet connection (eno1) which I would like to have priority over the interface without an internet connection (eno2). I have this setup because I'd like to transfer files between LAN over eno2 while utilising the eno1 network.
The issue I'm having is that when booting up the server or establishing a connection to eno2, a route entry is automatically generated giving the eno2 interface a metric of 0; which from what I've researched means that my network traffic will utilise that interface over others - which in turn, disables me from using the internet.
This is a server installation of Ubuntu, I'm looking for both interfaces to be on separate subnets as the PC connected to the server through LAN has a separate interface for an internet connection.
I don't need the hosts connected to eno2 to be able to have internet access, just for eno1 to be the default connection for the server.
What I've tried -
- Doing the command:
sudo ip route del 192.168.0.0/24 dev eno 2 proto kernel scope link src 192.168.0.88
solves the issue, however, this is not permanent as when the system reboots or a connection is established through the interface it just recreates the route with a metric of 0. - I've tried adding an identical route entry into
/etc/netplan/00-installer-config.yaml
but that just creates a new entry with a different metric. - I've tried creating a script that will automatically delete the route when the system starts - but, this route is added back when a connection is made to the server's eno2 interface.
ip route
:
default via 192.168.0.1 dev eno1 proto dhcp src 192.168.0.2 metric 100
192.168.0.0/24 dev eno2 proto kernel scope link src 192.168.0.88
192.168.0.0/24 dev eno1 proto kernel scope link src 192.168.0.2 metric 100
192.168.0.1 dev eno1 proto dhcp scope link src 192.168.0.2 metric 100
194.168.4.100 via 192.168.0.1 dev eno1 proto dhcp src 192.168.0.2 metric 100
194.168.8.100 via 192.168.0.1 dev eno1 proto dhcp src 192.168.0.2 metric 100
route -n
:
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.0.1 0.0.0.0 UG 100 0 0 eno1
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eno2
192.168.0.0 0.0.0.0 255.255.255.0 U 100 0 0 eno1
192.168.0.1 0.0.0.0 255.255.255.255 UH 100 0 0 eno1
192.168.4.100 192.168.0.1 255.255.255.255 UGH 100 0 0 eno1
192.168.8.100 192.168.0.1 255.255.255.255 UGH 100 0 0 eno1
/etc/netplan/00-installer-config.yaml
:
network:
ethernets:
eno1:
dhcp4: true
eno2:
dhcp4: false
addresses: [192.168.0.88/24]
version: 2
ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdic noqueue state UNKNOWN group default qlen 1000
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
inet ::1/128 scope host
valid_lft forever preferred_lft forever
2: eno1: <BROADCAST.MULTICAST.UP.LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether (MAC) brd ff:ff:ff:ff:ff:ff
altname enp3s0f0
inet 192.168.0.2/24 metric 100 brd 192.168.0.255 scope global dynamic eno1
valid_lft 86395sec preferred_lft 86395sec
inet6 fe80::2fd:35ff:fefc:5648/64 scope link
valid_lft forever preferred_lft forever
3: eno2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether (MAC) brd ff:ff:ff:ff:ff:ff
altname emp3s0f1
inet 192.168.0.88/24 brd 192.168.0.255 scope global eno2
valid_lft forever preferred_lft forever
inet6 fe80::2fd:45ff:fefc:5649/64 scope link
valid_lft forever preferred_lft forever
If there's anything you can help with, I'd be much appreciative. Also, if there's further information you need, I'll gladly oblige.
Thank you.
ip a
? Is this a desktop or server installation of Ubuntu? Are you intending both interfaces to be on the same subnet? If so, do you want LAN traffic to go overeno2
yet default traffic overeno1
? Do you want hosts connected toeno2
to be able to access internet through this host viaeno1
? Please update question with this information.ip a
instead of linking a picture.