1844070 Members
3059 Online
110227 Solutions
New Discussion

Routing confusion.

 
Sunil Sharma_1
Honored Contributor

Routing confusion.

Hi,

I amconfused over routing issue. Please help me solve thins.

I have a server with two NIC configured say ip address 10.12.20.145 netmask 255.255.254.0 and 10.12.22.25 netmask 255.255.255.0
default gateway is 10.12.20.1


I have an remote network say 152.153.160.0

i want to connect one server of remote network say 152.152.160.215

when i do traceroute it make connection through 10.12.22.25 IP/NIC but i want it to go through first NIC/IP 10.12.20.45

I know i have to add some static route but what route should i add ? or is there ay other solution ?

Sunil
*** Dream as if you'll live forever. Live as if you'll die today ***
9 REPLIES 9
RAC_1
Honored Contributor

Re: Routing confusion.

This has come up lot of times on forums.
My understanding is it depends on few things. The way lans are defined in /etc/rc.config.d/netconf file. Also the route table looks. Seems that traceroute has some policy to go throug a inetrface if one has not been specified on the command line.

You may want to look at -s and -i options of traceroute. But the nic it takes by default(i.e without -s or -i option) is still a mystery for me.

Anil
There is no substitute to HARDWORK
Matti_Kurkela
Honored Contributor

Re: Routing confusion.

RAC said it already if you read carefully, but let me emphasize:

HP-UX traceroute is weird. When it chooses the NIC for the trace, it does not take the routes into account at all. (Probably it is intended to be useful even when static routes are wrong.)

When using traceroute in a server with several NICs, you *must* use
traceroute -i
and pick the correct NIC yourself. Otherwise it seems to pick the NIC it uses rather arbitrarily.
MK
Sunil Sharma_1
Honored Contributor

Re: Routing confusion.

Thanks to all.

My question is how can i route my trafic to a perticuler lan card in given situation. In traceroute is is fine but when actual data flow how can i direct them.

Sunil
*** Dream as if you'll live forever. Live as if you'll die today ***
RAC_1
Honored Contributor

Re: Routing confusion.

If you have two nics, your client should decide which ip to talk to. For example, if my omniBack client wants to talk to this server on ip xx.xx.xx.xx, it should define server as ip xx.xx.xx.xx.

There is also a free product - ipfilter, with which you can control particular ports/traffic coming in, going out.

Anil
There is no substitute to HARDWORK
Fred Ruffet
Honored Contributor

Re: Routing confusion.

I can't manage to find the recent thread I saw the similar problem, but Someone from HP tell us that there is actually a bug in traceroute.

What I understand is that traceroute neverminds of what is the good NIC and always starts from the same.

Only way I know to bypass this problem is to use ping-o instead of traceroute. It will give you the real way used to contact distant host.

If ping -o gives you same output than tracerout, then you need to add your route. This can be done this way :
add a route in /etc/rc.config.d/netconf in this way :
ROUTE_DESTINATION[n]="host 152.152.160.215"
ROUTE_MASK[n]=""
ROUTE_GATEWAY[n]="10.12.20.45"
ROUTE_COUNT[n]=0
ROUTE_ARGS[n]=""
it will be add at boot time at the next reboot.
To have it before next reboot, use this command :
route add host 152.152.160.215 10.12.20.45 0

Regards,

Fred
--

"Reality is just a point of view." (P. K. D.)
Ron Kinner
Honored Contributor

Re: Routing confusion.

Fred's ping -o is a good idea. traceroute is a bit confused on the newer systems tho you can tell it which interface to start with. Think it is -i but don't have one handy to check. Try traceroute -h or traceroute -? to see what little help there is. Don't think HP feels obligated to give you a man page on it (they have borrowed it from someone else) but you can look.

If your default gateway is 10.12.20.145 and there is no other route specified for the network then it should use the first NIC 10.12.20.145 (45?) and go out to 10.12.20.1 which is apparently what you want it to do.

Note that if you add a route the count should be 1 and not 0. I don't think you need the host word in the nddconf file. IF the 45 is not a typo and is in fact the gateway you wish to use to get to the 152.152.160.0 network then you would use:

route add 152.152.160.0 10.12.20.45 1

It will usually understand that the .0 at the end of the destination means a network with a 255.255.255.0 mask without telling it that it is a net or giving it the netmask.

The /etc/rc.config.d/nddconf file then looks like this:

ROUTE_DESTINATION[1]="host 152.152.160.0"
ROUTE_MASK[1]="255.255.255.0"
ROUTE_GATEWAY[1]="10.12.20.45"
ROUTE_COUNT[1]=1
ROUTE_ARGS[1]=""

use the next higher integer if you already have entries in nddconf.

Ron
Sunil Sharma_1
Honored Contributor

Re: Routing confusion.

Many thanks to all.

I will make cahnge once change managment process will complete. Update you later with points :-)

Sunil
*** Dream as if you'll live forever. Live as if you'll die today ***
Fred Ruffet
Honored Contributor

Re: Routing confusion.

Ron,

When setting netconf file, ROUTE_COUNT[n] must be set to 0 as long as 10.12.20.45 is a local IP.

Regards,

Fred
--

"Reality is just a point of view." (P. K. D.)
Ron Kinner
Honored Contributor

Re: Routing confusion.

Fred,

If you make a route to an IP that is on the same box then yes the route count is 0 but the box will use Proxy Arp which relies on a router to answer the ARP request for the requested IP. This is an unreliable way to operate since the router admin can decide to turnoff proxy arp at any time. Since we already have a default route this is unneeded.

If the gateway is not on the same box then the route count is always 1 since the gateway should be on the same LAN so is only 1 hop away.

It is not clear from his post whether there are two IP addresses 10.12.20.145 and 10.12.20.45 or just a typo. IF it's a typo and both IP addresses are really the same and are on the HPUX then you do NOT want to add a route pointing back through them. That would accomplish nothing since we already have a default gateway on the same LAN as the NIC he wants to use so it should work correctly and it is just a problem of traceroute being broken unless he also has some other routes in there that we don't know about.

Ron