1

I followed this answer: how to configure 2 network interfaces with different gateways

No errors when setting up.

ifconfig:

eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.178.22  netmask 255.255.255.0  broadcast 192.168.178.255
        inet6 fe80::21d:9ff:fe6b:ca86  prefixlen 64  scopeid 0x20<link>
        ether 00:1d:09:6b:ca:86  txqueuelen 1000  (Ethernet)
        RX packets 2785  bytes 224135 (218.8 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 977  bytes 116595 (113.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eno2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.37  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::21d:9ff:fe6b:ca88  prefixlen 64  scopeid 0x20<link>
        ether 00:1d:09:6b:ca:88  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

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

# The primary network interface
allow-hotplug eno1
iface eno1 inet static
address 192.168.178.22
netmask 255.255.255.0
gateway 192.168.178.1

allow-hotplug eno2
iface eno2 inet static
address 192.168.1.37
netmask 255.255.255.0
post-up ip route add 192.168.1.0/24 dev eno2 src 192.168.1.37 table rt2
post-up ip route add default via 192.168.1.37 dev eno2 table rt2
post-up ip rule add from 192.168.1.37/32 table rt2
post-up ip rule add to 192.168.1.37/32 table rt2

rt_tables:

#
# reserved values
#
255     local
254     main
253     default
0       unspec
#
# local
#
#1      inr.ruhep
1 rt2

ping -I eno1... ok ping -I eno2... 100% packet loss. I can ping another computer and back to server from that computer. Also I can ping modem. Any external ping like google doesn't work.

Does anyone know what I did wrong? Thank you.

1 Answers1

1

It's a bad idea to have 2 default gateways (DGW). You should only have one DGW and routing tables for the other NIC.

The mistake is here:

post-up ip route add default via 192.168.1.37 dev eno2 table rt2

So just remove that line and all 192.168.1.0 will be routed to that NIC

If you want to persist in your erroneous ways, you can still add a second default gateway (I repeat: it's a bad idea) and then the line should¹ read:

post-up ip route add default via 192.168.1.1 dev eno2 table rt2

Note 1: should very probably as it depends on your network configuration

Fabby
  • 35,017