Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have two private networks say: and

I have two machines with two NICs per each machine.

machine1 NIC1:
machine1 NIC2:

machine2 NIC1:
machine2 NIC2:

How to configure the routing so that from machine1 to machine2, it would use actually machine1 NIC2?

The thing is that network is Gigabit and 192 one is Fast Ethernet (100Mbit).

My goal is to communicate between those two through the fastest connection (i.e: NIC2) even if they are trying to access by NIC1's IP.

share|improve this question
You mean you want to use NIC2 between machine1 and machine2, right? (I think there's a typo in your actual question sentence.) – Mat Feb 12 '12 at 21:26
@mat yes two NIC's in different private networks – bakytn Feb 12 '12 at 21:30

I am assuming you have the networks one switch and on another, the simplest solution to the problem would be put the following into /etc/hosts file or whatever else you are using for name resolution.   machine1-100   machine2-100      machine1      machine2

As long as you have presence on the same network as another machine the system will automatically route the traffic on that interface unless you add specific routes overriding this behavior.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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