1

I'm trying to use a WiFi adapter and onboard Ethernet to access two different networks simultaneously. The Ethernet network only has one device and does not pass through a router or switch. The WiFi network will be for all other network traffic through my router.

Thus far after following many, many online articles, guides, and questions posted on forums by other folks I've somehow managed to get it to work using some repeatable steps; however, it doesn't work correctly on reboot - only after I type in some commands.

Here's what I've got in my interfaces file:

# 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 enp2s0 wlx0013eff5755b
iface lo inet loopback

# The primary network interface
allow-hotplug enp2s0
iface enp2s0 inet static
    address 10.10.10.83
    gateway 10.10.10.1
    # dns-* options are implemented by the resolvconf package, if installed
    dns-nameservers 10.10.10.1
    up route del default gw 10.10.10.1

iface wlx0013eff5755b inet static
    address 192.168.1.83
    gateway 192.168.1.1
#   # dns-* options are implemented by the resolvconf package, if installed
    dns-nameservers 192.168.1.1
    up route add default gw 192.168.1.1

This is what shows up in my network setup when it is working:

joshua@printnc:~$ ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
    link/ether bc:30:5b:aa:32:01 brd ff:ff:ff:ff:ff:ff
3: wlx0013eff5755b: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DORMANT group default qlen 1000
    link/ether 00:13:ef:f5:75:5b brd ff:ff:ff:ff:ff:ff
joshua@printnc:~$ sudo route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.1.1     0.0.0.0         UG    0      0        0 wlx0013eff5755b
10.0.0.0        0.0.0.0         255.0.0.0       U     0      0        0 enp2s0
localnet        0.0.0.0         255.255.255.0   U     0      0        0 wlx0013eff5755b

This is what shows up in my network setup when the machine first boots:

joshua@printnc:~$ ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
    link/ether bc:30:5b:aa:32:01 brd ff:ff:ff:ff:ff:ff
3: wlx0013eff5755b: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN mode DEFAULT group default qlen 1000
    link/ether 00:13:ef:f5:75:5b brd ff:ff:ff:ff:ff:ff
joshua@printnc:~$ sudo route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.1.1     0.0.0.0         UG    0      0        0 wlx0013eff5755b
default         192.168.1.1     0.0.0.0         UG    0      0        0 wlx0013eff5755b
10.0.0.0        0.0.0.0         255.0.0.0       U     0      0        0 enp2s0
localnet        0.0.0.0         255.255.255.0   U     0      0        0 wlx0013eff5755b

At this point after rebooting, only the enp2s0 is working successfully. My next steps are:

  1. Manually connect to WiFi. This breaks the enp2s0 connection.

  2. Enter the command to shut down the enp2s0 interface (gives me an error):

joshua@printnc:~$ sudo ifdown enp2s0
RTNETLINK answers: No such process
  1. Enter the command to start the enp2s0 interface (gives me an error, and instantly upon entering this command the enp2s0 interface starts working correctly and I am connected to both networks):
joshua@printnc:~$ sudo ifup enp2s0
RTNETLINK answers: File exists
ifup: failed to bring up enp2s0

I have no clue why it works or what I am doing wrong. Any help is welcomed! My hope is to get this working on a reboot without having to do my 3-step process.

Edit to add: this is on Debian Buster with 4.19.0-11-rt-amd64 kernel

2
  • You can't have more than one default route without engaging in significantly more shenanigans, and you're engaging in the wrong shenanigans.
    – Shadur
    May 5 at 5:32
  • You don't need or want the gateway 10.10.10.1 line in the enp2s0 definition. gateway defines a default route. which you then delete with the up route del default ... line. You should delete both of those lines. You may want to add a route to the 10/8 network (or some smaller subnet of that, depending on that iface's netmask).
    – cas
    May 5 at 6:52
0

You're getting error messages from RTNETLINK because you're doing redundant things.

Let's take a look at your first network stanza:

# The primary network interface
allow-hotplug enp2s0
iface enp2s0 inet static
    address 10.10.10.83
    gateway 10.10.10.1
    # dns-* options are implemented by the resolvconf package, if installed
    dns-nameservers 10.10.10.1
    up route del default gw 10.10.10.1

You set the IP address (and omitting the netmask/network address entirely, which is sloppy and causes the system to assume it's /8 because of the 10. address, but if that works for you so be it), define the default gateway, and then immediately add an on-up deleting the default gateway.

(Why are you doing that anyway instead of just not adding the gateway to begin with?)

When you call ifdown enp2s0 it looks at the interface definition and tries to delete the default gateway before deactivating the interface because that's how ifupdown works, but because you already deleted that route RTNETLINK tells it it can't find that route to delete it and the process fails.

The same happens in your second stanza:

iface wlx0013eff5755b inet static
    address 192.168.1.83
    gateway 192.168.1.1
#   # dns-* options are implemented by the resolvconf package, if installed
    dns-nameservers 192.168.1.1
    up route add default gw 192.168.1.1

(Again, no netmask, but 192.168.x.x is defined as a set of /24 private subnets so again the system makes an assumption. Again, I'd recommend being explicit here.)

You define the default gateway, and on-up explicitly attempt to add the default gateway again. RTNETLINK tells you that that route already exists and the script once again fails.

Remote both up entries, and the gateway entry of the first stanza, and it will probably work. I can't confidently tell you that it will do what you want, because it's pretty unclear what you're actually describing and the interfaces file is ambiguous as hell because I suspect you simply copied over things that you didn't actually bother trying to understand.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.