0

I have an Ubuntu 18.04 (i.e. NetworkManager / netplan / systemd-networkd) VM which was working nicely until I tried adding a second interface. I initially had problems with the DHCP still running after I had configured a static address (it was still setting an additional default gw and DNS) which I think is now resolved. The new interface (ens192) is responsive, but I cannot connect to the original interface (ens160).

I tested this by attempting to connecting to the 10.2.0.20 (ens160) interface from a client at 10.1.1.1 (i.e. via the router configured as the default gateway).

Checking with TCP dump, I see the TCP syn packet arriving from the client on ens160, but the host is responding (ack) on the new interface. There are no iptables rules configured.

This was the routing table:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use 
Iface
0.0.0.0         10.2.0.254      0.0.0.0         UG    100    0        0 ens160
10.1.0.0        0.0.0.0         255.255.0.0     U     101    0        0 ens192
10.2.0.0        0.0.0.0         255.255.0.0     U     100    0        0 ens160
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 ens160

(I have no idea where the 169.254.0.0 address came from). I noted that the ens192 lan route has a higher metric than ens160. I would have expected that to explain the exact opposite of the behaviour I see (i.e. the higher metric might mean that packets sent to 10.1.0.0 are replied to over 10.2.0.0) but just to check I changed this to the same value as the others:

 # ip route del 10.1.0.0/16 dev ens192
 # ip route add 10.1.0.0/16 dev ens192 metric 100
 # route -n
 Kernel IP routing table
 Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
 0.0.0.0         10.2.0.254      0.0.0.0         UG    100    0        0 ens160
 10.1.0.0        0.0.0.0         255.255.0.0     U     100    0        0 ens192
 10.2.0.0        0.0.0.0         255.255.0.0     U     100    0        0 ens160
 169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 ens160

This had no impact on the behaviour.

Hopw do I get both interfaces working as expected (preferably without breaking netplan)?

I did read this - but I am not trying to send traffic through a router, just to the connected LAN. In case it is relevant, here is my current netplan:

 # This file describes the network interfaces available on your system
 # For more information, see netplan(5).
 network:
   version: 2
   renderer: networkd
   ethernets:
     ens160:
       dhcp4: no
       addresses: [10.2.0.27/16]
       gateway4: 10.2.0.254
       nameservers:
         addresses: [10.2.0.52,10.2.0.61]
     ens192:
       dhcp4: no
       addresses: [10.1.0.73/16]
symcbean
  • 5,540

1 Answers1

1

The routing table has a route to the 10.1.0.0/26 network via ens192, thus the return packets to 10.1.1.1 go out through that interface.

The 169.254.0.0/16 addresses are autoconfigured. Does the machine have a another IPv4 address?

Johan Myréen
  • 13,168
  • Makes sense - I just expected it to behave the same way as the Centos and RHEL boxes I am replacing. – symcbean Sep 20 '19 at 14:49