Operating System - HP-UX
1834183 Members
2881 Online
110064 Solutions
New Discussion

multiple static routes on one lan and "default" on another

 
SOLVED
Go to solution
Vanja
Frequent Advisor

multiple static routes on one lan and "default" on another

Here goes,

Is there a way to permanently assign multiple static routes to an interface through /etc/rc.config.d/netconf file? I currently have the following config below. What I'd like to do is add one more route for 135.21.108.39 on lan0 and keep lan3 set default. I know it can be done with route add but is there a way to permanently assign it through netconf file? Otherwise what is the most practical way to config this scenario.

/etc/rc.config.d/netconf entries :

IP_ADDRESS[0]=135.91.18.21
SUBNET_MASK[0]=255.255.255.0
INTERFACE_NAME[0]=lan3
BROADCAST_ADDRESS[0]=135.91.18.255
INTERFACE_STATE[0]=up
ROUTE_DESTINATION[0]="default"
ROUTE_MASK[0]=""
ROUTE_GATEWAY[0]="135.91.18.251"
ROUTE_COUNT[0]="1"
ROUTE_ARGS[0]=""

INTERFACE_NAME[3]=lan0
IP_ADDRESS[3]=135.91.20.23
SUBNET_MASK[3]=255.255.255.0
BROADCAST_ADDRESS[3]=135.91.20.255
INTERFACE_STATE[3]=up
DHCP_ENABLE[3]=0
ROUTE_DESTINATION[3]="net 135.91.20.0"
ROUTE_MASK[3]=""
ROUTE_GATEWAY[3]="135.91.20.251"
ROUTE_COUNT[3]="1"
ROUTE_ARGS[3]=""



netstat -rn :

# />netstat -rn
Routing tables
Destination Gateway Flags Refs Interface Pmtu
127.0.0.1 127.0.0.1 UH 0 lo0 4136
135.91.20.23 135.91.20.23 UH 0 lan0 4136
135.91.18.21 135.91.18.21 UH 0 lan4 4136
135.91.20.0 135.91.20.23 U 2 lan0 1500
135.91.18.0 135.91.18.21 U 2 lan4 1500
135.91.20.0 135.91.20.251 UG 0 lan0 0
127.0.0.0 127.0.0.1 U 0 lo0 0
default 135.91.18.251 UG 0 lan4 0


Thanks!
3 REPLIES 3
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: multiple static routes on one lan and "default" on another

You are on the right track. Add the additional array member (using the next subscript) describing the new route to the netconf file. This file takes care of subsequent reboots of the box but does not do anything about the currently running configuration. You need to do an explicit "route add" command now and then the netconf entries take care of assigning the routes in future reboot cycles automatically. Your entries in netconf simply are arguments for the route command executed by the rc scripts.
If it ain't broke, I can fix that.
Mel Burslan
Honored Contributor

Re: multiple static routes on one lan and "default" on another

provided you do not have a [4] indexed route in netconf file (if you do, find the next available index and replace 4s with that) adding the following block to your netconf will give you a permanent route to this 135.21.108.39 ip address from your lan 0

ROUTE_DESTINATION[4]="135.21.108.39"
ROUTE_MASK[4]=""
ROUTE_GATEWAY[4]="135.91.20.251"
ROUTE_COUNT[4]="1"
ROUTE_ARGS[4]=""

to make this change to take effect, you either need to stop/restart networking, after updating netconf file, by executing

/sbin/init.d/net stop
/sbin/init.d/net start

or you can add the route dynamically (my preferred method) by executing the following command:

route add 135.21.108.39 135.91.20.251 1

one thing though, since the ip address of the gateway, i.e., 135.91.20.251, is quite a bit different from the destination host ip address (135.21.108.39) make sure by talking to your network folks that these two entities can see and talk to each other.


________________________________
UNIX because I majored in cryptology...
Vanja
Frequent Advisor

Re: multiple static routes on one lan and "default" on another

Thanks for the input - helps a lot when you can talk to people that really know their stuff!

Vanja