1830032 Members
2138 Online
109998 Solutions
New Discussion

SO_DONTROUTE, ping -r

 
John Cattanach
Occasional Advisor

SO_DONTROUTE, ping -r

I can't understand the meaning of these, would be grateful for any help.

The situation is I have 2 seperate networks (phsical and logical). When one failed, I added an alternate route to it's host via the other network (all hosts are multi-homed).
So now I can ping it via this route, the question is how can I test it via the other 'direct' path, without removing my alternate route?
I'd thought ping -r meant bypass routing table, but when I specified this it still succeeded, while traceroute -s did what I wanted i.e. failed.
I've attached the details, any guidance appreciated.
Regards, John
4 REPLIES 4
Alan Riggs
Honored Contributor

Re: SO_DONTROUTE, ping -r

If you are trying to test teh physical interface (which I assume to be the case since your networking configuration was working initially) then use the linkloop command. Linkloop tests physical connectivity between two NICs.
John Cattanach
Occasional Advisor

Re: SO_DONTROUTE, ping -r

Cheers Alan.
The problem with linkloop level testing is this is all supposed to be done in a program, and I'm a lazy soul.
To test the physical layer I'd need the MAC address. I don't want to statically configure this, so I'd have to look in the arp cache for it. But if all outgoing traffic to that IP is currently routed via an alternate interface, I'd guess an explicit arp broadcast would be required to obtain the MAC.
All in all, a lot of work.
My current implementation is using ICMP sockets to do the testing, so my ideal solution would be to somehow test the direct route at ICMP level. Which is where I seem to have come unstuck.

I'm also curious as to the semantics of SO_DONTROUTE, as I can't discern any change in behaviour when it is set.

John
Eugen Cocalea
Respected Contributor

Re: SO_DONTROUTE, ping -r

Hi,

ping -r will bypass the routing table and it will try to ping a host that is on the same network. So if ping -r works, this means that the host is on the same network.

Being on two separate hubs (ie cascaded from one to another) don't mean that they are on different network. Different network segments should be splitted by network cards.

E.
To Live Is To Learn
John Cattanach
Occasional Advisor

Re: SO_DONTROUTE, ping -r

Well I still don't understand ping -r/SO_DONTROUTE, but I've achieved the result I want by binding my 'no route' socket to the local interface.
Thanks for the help,
John