Operating System - HP-UX
1833538 Members
2936 Online
110061 Solutions
New Discussion

Configure addition route on second NIC

 
SOLVED
Go to solution
Jeremy Loukinas
Frequent Advisor

Configure addition route on second NIC

How do I go about configuring an additional route on a second card. For instance lan0 is 192.168.2.10 with a gateway of 192.168.2.1. lan1 is 172.155.23.2 and needs to have a gateway of 172.155.23.1. How do add a default router for only lan1?

14 REPLIES 14
Sridhar Bhaskarla
Honored Contributor

Re: Configure addition route on second NIC

Hi Jeremy,

There will be only one default gateway on the system as far as my knowledge goes. You will have to use static routes if you want to use the other gateway. For ex., if a network 200.200.200.0 is reachable through your 172.155.23.1, you would need to add the following route

route add net 200.200.200.0 netmask 255.255.255.0 172.155.23.1 1

All the packets destined to 200.200.200.0 network will go through the 23.2 interface. You will need to keep adding as many routes you want. The rest of the traffic will go through the default gateway.

You will need to modify your netconf file to make it permanent.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Ron Cornwell
Trusted Contributor

Re: Configure addition route on second NIC

You can add host based or network based routes. Using "route add" for dynamic adding of routes and editing the file /etc/rc.config.d/netconf for static route adds. A system can only have one default gateway defined not matter how many network cards are installed. Here are some examples of dynamic adds:

route add default 192.168.2.10 192.168.2.1
route add 172.155.0.0 netmask 255.255.0.0 172.155.32.1
Jeremy Loukinas
Frequent Advisor

Re: Configure addition route on second NIC

Neither command worked. I am getting bad value netmask and network unreachable.

ANy other suggestions.. this is an HPUX 11i server if it matters.

Ron Cornwell
Trusted Contributor

Re: Configure addition route on second NIC

Is there a specific host you are trying to get to through your second network card. First, determine which card will talk with more different hosts. Then you can set that one up as your default gateway. You need to specify your own host/network routes. Do you have a network person at your site that can assist you with that ??
Ron Kinner
Honored Contributor

Re: Configure addition route on second NIC

HPUX allows you to turn on the strong end-system model in ndd (HPUX 10.3 or later) which is what you need if you insist on having a second default gateway dedicated to lan1. Unfortunately they did not bother to document it anywhere that I can find. The behavior of the Strong End-System Model is discussed in RFC 1122.

http://deesse.univ-lemans.fr:8003/Connected/RFC/1122/62.html

ndd -h ip_strong_es_model says:

Controls support for "Strong End-System Model" described in
RFC1122, Section 3.3.4.2. When enabled, packet source addresses
(and therefore interfaces on a multihomed host) affect selection
of a gateway for outbound packets. Set to 0 to disable; set to 1
to enable. [0,1] Default: 0 (disable)

In order to turn SESM on you have to:

ndd -set /dev/ip ip_strong_es_model 1

or better edit /etc/rc.config.d/nddconf
to add:

TRANSPORT_NAME[0]=ip
NDD_NAME[0]=ip_strong_es_model
NDD_VALUE[0]=1

so it will stay after a reboot.


If HPUX supports the RFC 1122 then it must allow you to assign two default gateways tho again how you do it is not really well defined. I suppose it would simply be the same in /etc/rc.config.d/netconf as defining one default so it would look something like this:

ROUTE_DESTINATION[0]="default"
ROUTE_MASK[0]=""
ROUTE_GATEWAY[0]="192.168.2.1"
ROUTE_COUNT[0]="1"
ROUTE_ARGS[0]=""

ROUTE_DESTINATION[1]="default"
ROUTE_MASK[1]=""
ROUTE_GATEWAY[1]="172.155.23.1"
ROUTE_COUNT[0]="1"
ROUTE_ARGS[0]=""

and the Strong ES Model would figure out which one went with which interface based on the IP addresses.

If you do

ndd -set /dev/ip ip_strong_es_model 1

first then you can probably get it to reread the netconf file with:

ined -c

otherwise you would have to reboot.

You can check whether it is working by doing a traceroute to this system from a device on the other side of the Lan1 router. If the traceroute reports the final address as 172.155.23.2 then it worked if not it will show 192.168.2.10.

Ron


T G Manikandan
Honored Contributor

Re: Configure addition route on second NIC

I am not sure whether you have the proper subnet value during the route add command for adding the 172.155.23.1 gateway.

Try disabling subnet mask check

ndd -set /dev/ip ip_check_subnet_addr 0
Jeremy Loukinas
Frequent Advisor

Re: Configure addition route on second NIC

Ok I am going to post exactly what i am trying to do.

I have a server with two interfaces.
lan0 = 161.155.125.128
gw = 161.155.125.1
mask=255.255.255.0

lan1 = 172.20.150.130
mask 255.255.255.0

There are two hosts withing the 172 segment i am trying to reach 172.21.121.130 and 172.21.207.130. Thos hosts are only reachable via a gw router/firewall @ 172.20.150.1.

Do I just need to add a static route to the other or do I need to do what Ron said and allow the system to be multihomed with multiple gateways.

Jeremy

Ron Cornwell
Trusted Contributor

Re: Configure addition route on second NIC

Add the following routes dynamically:
route add 172.21.121.130 netmask 255.255.255.255 172.20.150.1 1
route add 172.21.207.130 netmask 255.255.255.255 172.20.150.1 172.20.150.1 1

Add the following to /etc/rc.config.d/netconf to have these routes available after you reboot. "n" is the next number to use in the routing. Each route must have a unique index number.

ROUTE_DESTINATION[n]="172.21.121.130"
ROUTE_MASK[n]="255.255.255.255"
ROUTE_GATEWAY[n]=172.20.150.1
ROUTE_COUNT[n]=1
ROUTE_ARGS[n]=""

ROUTE_DESTINATION[n+1]="172.21.207.130"
ROUTE_MASK[n+1]="255.255.255.255"
ROUTE_GATEWAY[n+1]=172.20.150.1
ROUTE_COUNT[n+1]=1
ROUTE_ARGS[n+1]=""
Ron Cornwell
Trusted Contributor

Re: Configure addition route on second NIC

Add the following routes dynamically:
route add 172.21.121.130 netmask 255.255.255.255 172.20.150.1 1
route add 172.21.207.130 netmask 255.255.255.255 172.20.150.1 172.20.150.1 1

Add the following to /etc/rc.config.d/netconf to have these routes available after you reboot. "n" is the next number to use in the routing. Each route must have a unique index number.

ROUTE_DESTINATION[n]="172.21.121.130"
ROUTE_MASK[n]="255.255.255.255"
ROUTE_GATEWAY[n]=172.20.150.1
ROUTE_COUNT[n]=1
ROUTE_ARGS[n]=""

ROUTE_DESTINATION[n+1]="172.21.207.130"
ROUTE_MASK[n+1]="255.255.255.255"
ROUTE_GATEWAY[n+1]=172.20.150.1
ROUTE_COUNT[n+1]=1
ROUTE_ARGS[n+1]=""
Sridhar Bhaskarla
Honored Contributor

Re: Configure addition route on second NIC

Hi,

In this case, you just need to add two static routes.

route add 172.21.121.130 172.20.150.1 1
route add 172.21.207.130 172.20.159.1 1

Add the entries like this in your netconf file for each of these routes

ROUTE_DESTINATION[1]="172.21.121.130"
ROUTE_GATEWAY[1]="172.20.150.1"
ROUTE_COUNT[1]="1"
ROUTE_ARGS[1]=""

Repeat the same for the other route with the index number 2.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Jeremy Loukinas
Frequent Advisor

Re: Configure addition route on second NIC

testhost:/home/root # route add 172.21.121.130 172.20.150.1 1
172.21.121.130: bad value


I tried this first.. Always get a bad value...
Jeremy Loukinas
Frequent Advisor

Re: Configure addition route on second NIC

Ron,

Same thing as other commands.. Bad value BS.


testhost:/home/root # route add
172.21.121.130 netmask 255.255.255.255 172.20.150.1 1
netmask: bad value



Jeremy Loukinas
Frequent Advisor

Re: Configure addition route on second NIC

After disabling subnet checking like TJ said i was able to add the routes.

testhost:/home/root # route add 172.21.121.130 172.20.150.1 1
add host 172.21.121.130: gateway 172.20.150.1


testhost:/home/root # route add 172.21.207.130 172.20.150.1 1
add host 172.21.207.130: gateway 172.20.150.1


And the addresses are ping-able. What does this tell me? The ip is invalid for that subnet?
Sridhar Bhaskarla
Honored Contributor
Solution

Re: Configure addition route on second NIC

Hi,

Try disabling the check_subnet parameter in ndd.

ndd -set /dev/ip ip_check_subnet_addr 0

Edit your /etc/rc.config.d/nddconf

TRANSPORT_NAME[0]=ip
NDD_NAME[0]= ip_check_subnet_addr
NDD_VALUE[0]=0

-Sri
You may be disappointed if you fail, but you are doomed if you don't try