Operating System - HP-UX
1832234 Members
2677 Online
110041 Solutions
New Discussion

Re: Routing via specified interface

 
SOLVED
Go to solution
Tomek Gryszkiewicz
Trusted Contributor

Routing via specified interface

Hello,
I've got a problem with routing on my HP: i heve an interface lan1 with IP 126.16.13.107 which is my default connection to the rest of network:
126.16.13.107/255.255.255.255 126.16.13.107 UH 0 lan1 4136
126.16.13.0/255.255.255.0 126.16.13.107 U 2 lan1 1500
default/0.0.0.0 126.16.13.254 UG 0 lan1 0

Then, I've got another interface lan0:
lan0: flags=842
inet 126.16.13.109 netmask ffffff00 broadcast 126.16.13.255

I want to create a route to the one computer (eg. 126.17.57.237) via gateway - 126.16.13.254 - but using lan0 interface. I can route it like:
route add host 126.17.57.237 126.16.13.254

But how to specify which interface this route will use? I want to use lan0.

Thanks,
Tomek
10 REPLIES 10
Tomek Gryszkiewicz
Trusted Contributor

Re: Routing via specified interface

Yes, but how to specify which interface this route is using? If I just add a route (to netconf or via route command) my route will use my default (lan1) interface. But i want to use lan0 for this route...
Robert Thorneycroft
Valued Contributor

Re: Routing via specified interface

As I mentioned in the other message.

As the Gateway is on the same subnet as lan 0 the machine should use this subnet to reach the gateway specified.

This is the way that I have had to setup my own network in order to get machines connected via gigabit to not go out accross the default gateway which is only 10Mb.

If you set this up and do a traceroute you will see that the system is smart enough to realise that when a card is directly attached to a network there is no point going routing off around the world to get there.

Kind regards,

Robert Thorneycroft
Robert Thorneycroft
Valued Contributor

Re: Routing via specified interface

You need to edit your /etc/rc.config.d/netconf file and add in entries similar to the following:
ROUTE_DESTINATION[0]="default"
ROUTE_MASK[0]=""
ROUTE_GATEWAY[0]="defgw"
ROUTE_COUNT[0]="1"
ROUTE_ARGS[0]=""

ROUTE_DESTINATION[1]="126.17.57.237"
ROUTE_MASK[1]=""
ROUTE_GATEWAY[1]="126.16.13.254"
ROUTE_COUNT[1]="1"
ROUTE_ARGS[1]=""

As the Gateway is on the same subnet as lan 0 the machine should use this subnet to reach the gateway specified.
Then just stop and start your networking with /sbin/init.d/net stop then /sbin/init.d/net start.
You can check everything is working by using either traceroute or ping -o to check the interfaces being used.

Hope this helps,

Robert Thorneycroft
Tomek Gryszkiewicz
Trusted Contributor

Re: Routing via specified interface

Thaks for your answer, but i think it is not solving my problem.
In the other words:
I've got a network 126.16.13.0 255.255.255.0 with a gateway 126.16.13.254 connecting me to the rest of the net.
On one box i've got two interfaces:
lan1 126.16.13.107
lan0 126.16.13.109
- connected to the same router (.254)
I want to have:
1. route to the network 126.16.13.0/24 via lan1 and gateway .254
2. default route via lan1 and gw .254
3. route to the one host (126.17.57.237) via lan0 and gw .254

1. and 2. is obvious so now i have:
126.16.13.107/255.255.255.255 126.16.13.107 UH 0 lan1 4136
126.16.13.0/255.255.255.0 126.16.13.107 U 2 lan1 1500
default/0.0.0.0 126.16.13.254 UG 0 lan1 0

but i also want to have:
126.16.13.109/255.255.255.255 126.16.13.109 UH 0 lan0 4136
126.17.57.237/255.255.255.255 126.16.13.254 UH 0 lan0

Is it possible on HPUX? I am asking because i made a similar routing tables on the other unixes - and there it was working.

if i just add a route:
route add host 126.17.57.237 126.16.13.254
- i cannot specify lan0 as an interface - and the routing for this host will be sent via lan1:
126.17.57.237/255.255.255.255 126.16.13.254 UH 0 lan1

Regards,
Tomek
Robert Thorneycroft
Valued Contributor

Re: Routing via specified interface

My apologies I did not read your initial question clearly and thought that the two lan card were on seperate subnets. Unfortunately I do not have a situation similar to this so I am not sure whether this is possible or not.

The only thing I would suggest would be to take a look at the ifconfig manual page as:

ifconfig interface address_family [address [dest_address]] [parameters]

Looks like it might be the command you are looking for, however without a test system with your network setup I am unable to test if this can be used to achieve your desired results.

Sorry I could not be of more help,

Robert Thorneycroft
sven verhaegen
Respected Contributor
Solution

Re: Routing via specified interface

Hi

I hate to be the bearer of bad news , it is simply not allowed to have 2 lancards in the same subnet on HP-UX , it is possible to have 1 lancard have multiple IP's in the same subnet but not on separate cards and this because the routing table itselfs adheres to a strick first-entry-found first-entry-used procedure , meaning the second interface will effectively be ignored , there is not setup in HP-UX to make this work , I would like to know if the reason you are asking this is for loadbalancing purposes or not , if loadbalancing is the issue then a product exists called APA , it allows multiple interfaces to be bundeled in 1 virtual one with much higher bandwith effectively carrying one IP spread over all the interfaces in the aggregation , if it is just to direct traffic differently depending on the destination then another network is needed

...knowing one ignores a greath many things is the first step to wisdom...
Tomek Gryszkiewicz
Trusted Contributor

Re: Routing via specified interface

Thanks for your help.
So now the only way to solve my problem is to divide my network to have one card in one network.

Regards,
Tomek
Adam J Markiewicz
Trusted Contributor

Re: Routing via specified interface

Czesc Tomek. :)

For several questions I've read that it's bad idea to have two netwok cards in the same subnet under HP. Look at:

http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x64e0cdec06f1d61190050090279cd0f9,00.html

However in your special case I was thinking if simply adding one more routing couldn't help. Try:

route add host 126.17.57.237 126.16.13.254 1

together with

route add host 126.16.13.254 126.16.13.107

This could force all traffic to 126.16.13.254 to be routed through IP of lan1, so if this host were a gateway it could work also...

Good luck

Adam
I do everything perfectly, except from my mistakes
Tomek Gryszkiewicz
Trusted Contributor

Re: Routing via specified interface

Czesc Adam :)
I've already tried something similar, but it doesn't work..
I just didnt know that two network cards in one network in HP are not supported - in this case i'll divide my network.

Thanks,
Tomek
rick jones
Honored Contributor

Re: Routing via specified interface

I'm not going to address whether or not ifconfiging multiple physical (as far as the transport is concerned) NICs in the same subnet is supported or not (but wonder how a network of pt-pt dial-ups could work otherwise :)

but will point-out that setting ip_strong_es_model to a value of one will cause the source IP address to be included in the route lookup along with the destination.

if applications bind to local IP's besides INADDR_ANY before they try to call connect(), this does have some interesting effects, among them providing per-interface default routes and having replies go out the interface on which they arrived.

ip_strong_es_model is in the list of supported ndd settings.

the downside is that with ip_strong_es_model set, the system will only accept traffic to a give IP on the NIC to which that IP is bound. if such traffic arrives on another NIC it will be discarded.

shifting gears slightly if the router on the network connected to lan0 supports ProxyARP, you could have the route to that one destination be through the lan0 IP as the gateway with a metric of 0. then the system should ARP for that IP address just like it was local, and the router should reply with his MAC address.

if the router does not do proxy ARP, you might be able to put an ARP entry into the arp cache that maps the remote IP to the router's MAC. I'm not sure though how ARP desides to which interface the ARP entry is to be associated.
there is no rest for the wicked yet the virtuous have no pillows