1

I have a remote machine with 2 interfaces: eth0 and eth1.

I am able to ssh using eth0 ip address as well as eth1 ip addr. However, things go strange once I bring down eth0 using the command ifdown eth0. After pulling down eth0, I am able to ping eth1 but I am no longer able to ssh using eth1. I checked the ssh config but couldn't find anything related to interface configuration.

What am I missing?

5
  • Are you running a firewall that might be blocking traffic to port 22 on eth1? If you use ss -l or netstat -l can you see anything listening on port 22? Commented Apr 21, 2016 at 13:00
  • what's the error message?
    – golimar
    Commented Apr 21, 2016 at 13:06
  • 2
    What's the routing table? You should have two default routes: via eth0 and via eth1. The default route via eth0 should have a smaller metric that the default route via eth1. Otherwise when you drop eth0 there will be no way for a packet to get back to your machine from eth1 (assuming your machine is further than the connected subnet). See the command ip route show and ip -6 route show. You are looking for a result along the lines of default via 192.168.1.1 dev eth0 metric 1, default via 192.168.2.1 dev eth1 metric 2, adjusting the IP addressing for your own subnets' routers.
    – vk5tu
    Commented Apr 21, 2016 at 15:01
  • @vk5tu when i do ip route show, i see default via <ip-addr> dev eth0 does that mean if eth0 goes off, i will have no way to reach via ssh even if eth1 is active.? do i need to see another "default via.. dev eth1" entry
    – cool77
    Commented Apr 22, 2016 at 6:19
  • @cool77. Yep, when eth0 goes down the routes to via that interface are invalidated. Then you're left with no route beyond your immediate subnet.
    – vk5tu
    Commented Apr 27, 2016 at 11:20

2 Answers 2

1

It sounds like you have 2 devices with the same subnet. This generally works badly/unexpectedly. You need to have different subnets, or you have to disable ARP.

eg. To disable ARP:

echo 1 > /proc/sys/net/ipv4/conf/eth0/arp_ignore
echo 2 > /proc/sys/net/ipv4/conf/eth0/arp_announce

But I'm sure there's a better approach to whatever problem you have. Maybe you should make a bridge and use only one IP address. For example:

brctl addbr br0
brctl addif br0 eth0
brctl addif br0 eth1
ip a add ... dev br0

Or two addresses on the same NIC, or 2 different subnets (eg. 192.168.123.0/24 and 192.168.124.0/24).

0

Maybe you left some ListenAddress directive in sshd conf? In my setups when i want multi-interface access i just comment out lines:

ListenAddress ::
ListenAddress 0.0.0.0
1
  • i checked my sshd_config file but it does'nt have ListenAddress directive.
    – cool77
    Commented Apr 21, 2016 at 12:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .