0

I want to setup an Ubuntu 18.04 with two interfaces connected to the internet. The configuration is as:

      4G                                                     4G
      /                      Ubuntu 18.04                   /
     /                                                     /
  |----|                |-----------------|              |-----|
  | AP1| -------------- |eno1         usb1|--------------| AP2 | - - - - DeviceX
  |----|                |-----------------|              |-----|
 192.168.0.1       192.168.0.23      169.200.0.23       169.200.0.1      169.200.0.100
 

The APs are 4G routers (models: d-link DWR-953 and tl-mr6400). The AP1 is connected to Ubuntu 18.04 on the ethernet interface (i.e. eno1) and the AP2 through an Ethernet to USB adapter to a usb port on Ubuntu 18.04.

DHCP is disabled on AP2 where the IPs are manually entered. Wireless connection is used between DeviceX and AP2. DeviceX has internet access, but I believe it goes through the AP1, unless the AP2 is disconnected from usb1. The reason for saying that, is that I can see packets are captured (wireshark) on usb1 once DeviceX accesses the internet (from 169.200.0.100).

The netplan YAML file is:

network:
  version: 2
  renderer: networkd
  ethernets:
    #ETH  
    enp60s0:
      match:
        macaddress: 3b:x:x:x
      addresses: [192.168.0.23/24]
      dhcp4: no
      optional: true
      gateway4: 192.168.0.1 
      set-name: eno1
      mtu: 8192  
      nameservers:
        addresses: [192.168.0.1,8.8.8.8,8.8.4.4]
    #USB
    enx50581da:
      match:
        macaddress: 60:x:x:x:x
      addresses: [169.200.0.23/24]
      dhcp4: no
      optional: true
      #gateway4: 169.200.0.1
      set-name: usb1
      mtu: 8192  
      nameservers:
        addresses: [169.200.0.1,8.8.8.8,8.8.4.4]
      routes:
       - to: 0.0.0.0/0
         via: 169.200.0.1
         metric: 101
         table: 1
      routing-policy:
       - from: 169.200.0.0/24
         table: 1

the routes are:

ip r:

default via 192.168.0.1 dev eno1 proto static 
169.200.0.0/24 dev usb1 proto kernel scope link src 169.200.0.23 
192.168.0.0/24 dev eno1 proto kernel scope link src 192.168.0.23 

whilst the route -n gives:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.0.1     0.0.0.0         UG    0      0        0 eno1
169.200.0.0     0.0.0.0         255.255.255.0   U     0      0        0 usb1
192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 eno1

For some reason, when the networkd is used, the metric is not shown but I can confirm it with the ip route show table 1:

default via 169.200.0.1 dev usb1 proto static metric 101

If I run ping -w 1 www.google.com -I eno1 I get a response, whilst if I do the same from usb1 there is 100% loss.

If I traceroute for usb1 with sudo traceroute -i usb1 -d www.google.com, this is what I get:

traceroute to www.google.com (216.x.x.x), 30 hops max, 60 byte packets
 1  _gateway (169.200.0.1)  1.392 ms  1.346 ms  1.336 ms
 2  dsldevice.lan (192.168.0.1)  3.779 ms  3.782 ms  3.774 ms
 3  10.x.x.x (10.x.x.x)  138.568 ms  138.565 ms  142.595 ms
 4  10.x.x.x (10.x.x.X)  138.500 ms  138.525 ms  142.601 ms
 5  10.x.x.x (10.x.x.x)  142.763 ms  142.590 ms  142.767 ms
 6  10.x.x.x (10.x.x.x)  143.139 ms  24.233 ms  28.926 ms
 7  10.x.x.x (10.x.x.x)  38.248 ms  30.363 ms  30.260 ms
 8  87.x.x.x (87.x.x.x)  44.078 ms  44.047 ms  43.990 ms
 9  87.x.x.x (87.x.x.x)  44.196 ms  44.540 ms  44.516 ms
10  74.x.x.x (74.x.x.x)  44.701 ms  44.678 ms  44.639 ms
11  * * *
12  any-in-2678.net (216.x.x.x)  38.696 ms  38.645 ms  55.609 ms

which seems traffic is routed to AP1 (line 2). If I do the same from eno1, the result is:

traceroute to www.google.com (216.x.x.x), 30 hops max, 60 byte packets
 1  dsldevice.lan (192.168.0.1)  0.819 ms  0.814 ms  0.806 ms
 2  * * *
 3  172.x.x.x (172.x.x.x)  56.248 ms  56.367 ms  56.367 ms
 4  * * *
 5  * * *
  .
  .
  .
30  * * *

The sudo iptables -L gives:

Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain FORWARD (policy DROP)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination   

Is it possible to separate the traffic and not forwarding through AP1 when both interfaces are up? The packets generated from the subnet 169.200.0.0/24 should be through AP2 and reach out on internet via that node, regardless of what is happening on eno1. If I set gateway4 for the usb1, the ping -w 1 www.google.com -I usb1 returns an rx packet, but the issue still remains.

Your Answer

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

Browse other questions tagged or ask your own question.