0

I have 2 interfaces

eth0 10.0.0.163
eth1 10.0.0.164

There are two machines are connected from per interface

Machine 1 to eth0 with address 10.0.0.160
Machine 2 to eth1 with address 10.0.0.161

I want to connect from each interface to each machine but it connects to Machine 1 but not to Machine 2. I tried ssh option bind with

ssh -b 10.0.0.164 10.0.0.161 

but not responded.How can be achievable?

  • Are both machine reachable? What does pinging them tell you? – alk Apr 1 '13 at 8:30
1

This will be because as soon as you put an IP address like 10.0.0.163 onto an interface, a route is added for that network out of that interface. If you need to indicate that a specific address should be reached via specific interface then you will need a static route to it, like this:

# ip route add 10.0.0.161/32 dev eth1

Note the /32 for a single IPv4 address route.

You could also maybe do it with source routing, iptables trickery and so on, but I think a static route is the most simple and obvious way.

As an aside, it is a bad idea to two interfaces onto the same network, so 10.0.0.164 should probably have a netmask that makes sure it isn't on the same network as 10.0.0.163, e.g. 255.255.255.255.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.