0

Recently, I added a second NIC to my Debian server. Another NIC is being shipped, bringing the total to 3 WAN connections.

Assume the NICs are named ens2, ens3, and ens4. "Accessing" means any network connections to the server (SSH, VNC, ping, etc.)

When I only had one interface ens2, I can access the server using ens2's IP address. When I added the second interface ens3, I can't access the server using the IP on ens2, but accessing it using ens3's IP works.

When I disable ens3, I can once again access the server via ens2's IP address.

How do I access the server from all WAN interfaces? I tried to mess with the routing table, but my lack of knowledge in routing simply made the machine inaccessible from the network/s.

Aloha
  • 286
  • 4
  • 15
  • Please check your firewall configuration and allow, for example the ssh service to listen on all interfaces. Don't bind service to one IP. – mariaczi Mar 15 '18 at 07:30
  • A little more detail would be great, e.g. - what are you trying to accomplish with 3 WAN connections (bundling/load balancing, transfer-network)? - are those NICs in the same network? In short: It's better to ask like this: What do you have now, what exactly do you want to achieve. – Broco Mar 15 '18 at 07:32

1 Answers1

0

Regardless of which interface a connection comes in on, the routing table determines how the response is sent. If, for example, you have ens2 as 10.1.2.3/24 and ens3 as 10.1.9.3/24, and a server running. A packet comes in from 172.12.2.2 for 10.1.9.3. The server replies and the default gateway device is ens2 so the response goes back to 172.12.2.2 from 10.1.2.3, and nothing works.

What you want is for the packets to go back out the same interface. This will set up a second routing table for the second interface:

echo 200 isp2 >> /etc/iproute2/rt_tables
ip rule add from <ens2-ip> dev ens2 table isp2
ip route add default via <gateway_IP> dev ens2 table isp2