Operating System - HP-UX
1833356 Members
2992 Online
110051 Solutions
New Discussion

traceroute uses wrong interface

 
SOLVED
Go to solution
Andrew S Babb
Advisor

traceroute uses wrong interface

I have 4 network interfaces on my server, with lan0 being the public routable network, and lan1, lan2 & lan3 being private non-routable networks.

My network configuration is as follows:
# ifconfig lan0
lan0: flags=1843
inet 139.185.174.5 netmask ffffffc0 broadcast 139.185.174.63
# ifconfig lan1
lan1: flags=1843
inet 139.185.174.67 netmask ffffffe0 broadcast 139.185.174.95
# ifconfig lan2
lan2: flags=1843
inet 139.185.174.99 netmask ffffffe0 broadcast 139.185.174.127
# ifconfig lan3
lan3: flags=1843
inet 139.185.174.131 netmask fffffff0 broadcast 139.185.174.143

In addition, the netstat output is as follows:
# netstat -rna
Routing tables
Destination Gateway Flags Refs Interface Pmtu
127.0.0.1 127.0.0.1 UH 0 lo0 4136
139.185.174.5 139.185.174.5 UH 0 lan0 4136
139.185.174.67 139.185.174.67 UH 0 lan1 4136
139.185.174.99 139.185.174.99 UH 0 lan2 4136
139.185.174.131 139.185.174.131 UH 0 lan3 4136
139.185.174.128 139.185.174.131 U 2 lan3 1500
139.185.174.64 139.185.174.67 U 2 lan1 1500
139.185.174.96 139.185.174.99 U 2 lan2 1500
139.185.174.0 139.185.174.5 U 2 lan0 1500
127.0.0.0 127.0.0.1 U 0 lo0 0
default 139.185.174.1 UG 0 lan0 0

The gateway is 139.185.174.1 which is only accessible via lan0.

If I traceroute and force lan0, then all is OK
# traceroute -i lan0 -n 139.185.174.13
traceroute to 139.185.174.13 (139.185.174.13), 30 hops max, 40 byte packets
1 139.185.174.13 0.132 ms 0.063 ms 0.064 ms

However, if I do not specify an interface, then traceroute wants to use lan3 which is not routable.
traceroute -n 139.185.174.13
traceroute: Warning: Multiple interfaces found; using 139.185.174.131 @ lan3
traceroute to 139.185.174.13 (139.185.174.13), 30 hops max, 40 byte packets
1 * * *
2 * * *
3 * * *
4 * * *
5 * * *
6 * * *
7 * * *
8 * * *


Any ideas why the system is wanting to route through lan3, and how I can get the system to route through the lan0 interface?

Thanks
Andrew


5 REPLIES 5
Jeff Schussele
Honored Contributor

Re: traceroute uses wrong interface

Hi Andrew,

Use traceroute as follows:

traceroute -i lanX destination
or
traceroute -s xxx.xxx.xxx.xxx destination

where X=lan interface PPA
and xxx.xxx.xxx.xxx=IP of lanX or the NIC you want to originate the traceroute from.

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Andrew S Babb
Advisor

Re: traceroute uses wrong interface

Thanks for the quick response, but is there a way to avoid this, and to have traceroute detect the lan0 as the default route?
Ivan Ferreira
Honored Contributor

Re: traceroute uses wrong interface

It seems that the traceroute is not designed to check the subnet configurations and then, it thinks that you have more network interfaces on the same network segment.

I saw this problem on another posts and the solution suggested is to use the -i parameter.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Ivan Ferreira
Honored Contributor
Solution

Re: traceroute uses wrong interface

See this patch:

PHNE_34135

http://www2.itrc.hp.com/service/patch/patchDetail.do?patchid=PHNE_34135&sel={hpux:11.11,}&BC=main|search|

( SR:8606356802 CR:JAGaf17502 )

When neither '-i' nor '-s' option is specified, traceroute(1) uses the first interface address returned in the IP header of the outgoing probe packet without referring to the routing table. As a result, the response to this probe packet may not reach the host in case of a multihomed host.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Josiah Henline
Valued Contributor

Re: traceroute uses wrong interface

This drove our networking folks nutts when we went from 11.0 to 11.11.

You can write a script that does a netstat -rn and looks for the default route.

netstat -i $(netstat -rn|grep ^default |awk '{print $5}') MACADD
If at first you don't succeed, read the man page.