1

This is my network setup right now, and unfortunately it's set in stone (IP addresses changed to protect the innocent):

CONTROLLER +---NIC1----> PC1(10.0.9.12)
           |
           +---NIC2----> PC2(10.0.9.12)

PC1 and PC2 are two different physical machines, each on a different network which goes through two interfaces on CONTROLLER. The two never see each other.

My requirement is to determine if PC2 is running by using a ping packet, however every time I try to send it with the computer offline it goes to PC1 and returns that it's alive.

I've tried adding a persistent route on the NIC2 interface with metric 1 on that specific IP (10.0.9.12 netmask 255.255.255.255), but that didn't help at all. I think it's because the two gateways also are the same IP.

I've then tried adding another persistent route on NIC1 with gateway 0.0.0.0 (also 1.1.1.1), thinking I'd just drown out those packets. That also didn't work, the pings kept reaching PC1, and a tracert showed me the first hop is the gateway hostname of the first network.

Unfortunately I'm a software guy and my expertise quickly reached its limit -- I have no more ideas. Without changing any of the IP addresses involved, how would I solve this?

  • Unplug NIC 1, and then try it. – Michael Hampton Apr 17 at 17:26
  • It works as expected then, it routes through NIC2 and returns either success or failure depending on whether PC2 is online or not. – Blindy Apr 17 at 17:58
  • 2
    I mean the short answer is that your network is broken. You shouldn't have duplicate IPs, or duplicate separate subnets. If you really needed to do that for some reason, you could probably run 2 VMs on the controller, each bridged to a different interface, then run your tests from the VMs. – Zoredache Apr 17 at 18:01
  • Is that actually true? They’re not duplicate IPs in their own networks, only from the point of view of the main computer. Can’t I assign an IP range to a specific network interface, through the OS routing table or otherwise? – Blindy Apr 18 at 2:04
1

@Zoredache is absolutely correct in the comment "Your network is broken". The controller device doesn't know how to handle routing between the two PCs because to it, they are both reachable by either interface. That said, the below suggestions are absolutely hacks, and are not really sustainable and should not be used other than testing and seeing if it works. Your proper solution is to fix the networks.

Option 1

Setup another device as a proxy between NIC2 and PC2. For this to work, NIC2 will need a new IP, let's say 10.1.77.2. The intermediary device, or proxy/nat device, will have 2 interfaces, 10.1.77.3, and 10.0.9.3. A second IP will be bound to the interface between the controller and the proxy device and that will forward requests to the 10.0.9.12 device. So the network will look something like this:

CONTROLLER +---NIC1----> PC1(10.0.9.12)
           |
           +---NIC2 (10.1.72.2)----> (10.1.72.3) PROXY ----> PC2(10.0.9.12)

Option 2

This may or may not work depending on OS and other factors. I've had mixed luck in forcing traffic out specific interfaces when the two interfaces are on the same network. Before you need to communicate with PC2 you have to change the routing metric. On a Windows desktop/server, you should be able to do something like this:

route change 10.0.9.0 mask 255.255.255.0 metric 999 if nic1_id

Remember to flip it back when you are done.

Option 3

This is another "depends" option, but I've used it successfully in the past for hunting down duplicate IP addresses on networks, though never used it with 2 outbound interfaces. Set a static ARP entry on the controller for PC1 or PC2 depending on which one you want to talk to. This command assumes a Windows server, you didn't mention what Controller was, or anything further details.

arp -d 10.0.9.12
arp -s 10.0.9.12 aa-bb-cc-dd-ee-00

Where aa-bb-cc-dd-ee-00 is the MAC address of the NIC in PC1 or PC2.

I'll say again, these are hacks. Your best bet, and less of a headache, is to re-IP one of the networks. Option 1 may be the least hackiest of the 3, but still requires a bit of work and maintenance.

  • "you didn't mention what Controller was" -- it is indeed a Windows machine, I figured the tag on the question was enough. Thanks for this, I'll try them out! – Blindy Apr 18 at 19:36

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.