Operating System - HP-UX
1820872 Members
3810 Online
109628 Solutions
New Discussion юеВ

Re: adding a second route

 
SOLVED
Go to solution
Joe Profaizer
Super Advisor

adding a second route

I get the below error message upon startup when trying to add a second route (via /etc/rc.config.d/netconf).
Configure LAN interfaces
Output from "/sbin/rc2.d/S340net start":
----------------------------
ERROR: Failed to add route entry because its interface is not
yet initialized. May need to add this route entry with
a route commad after the interface is up :
netmask: bad value
"/sbin/rc2.d/S340net start" FAILED

The first route entry adds just fine:
ROUTE_DESTINATION[0]="default"
ROUTE_MASK[0]=""
ROUTE_GATEWAY[0]="10.3.24.254"
ROUTE_COUNT[0]="1"
ROUTE_ARGS[0]=""

The second route entry fails to add:
ROUTE_DESTINATION[1]="10.3.23.0"
ROUTE_MASK[1]="255.255.255.0"
ROUTE_GATEWAY[1]="10.3.24.249"
ROUTE_COUNT[1]="1"
ROUTE_ARGS[1]=""

Can someone tell me why this won't add properly?

Also, what is the proper "route add" command to add the above route from the command line.

Thanks,

..Joe



4 REPLIES 4
Pete Randall
Outstanding Contributor

Re: adding a second route

Joe,

First my standard disclaimer: I normally avoid routing questions because routing gives me a headache.

Second, with your subnet mask, I don't believe you can reach 10.3.23 via 10.3.24.


Pete


Pete
Steve Steel
Honored Contributor

Re: adding a second route

Hi

# ROUTE_DESTINATION: Destination hostname (in /etc/hosts) or host or network
# IP address in decimal-dot notation, preceded by the word
# "host" or "net"; or simply the word "default".


No preceding word

=================================
if [[ -z $MASK ]]; then
# No subnet mask
if [[ -z $ARGS ]]; then
# No arguments
emsg=$(route add $DEST $GWAY $COUNT 2>&1)
else
# With arguments
emsg=$(route $ARGS add $DEST $GWAY $COUNT 2>&1)
fi
else
# Subnet mask has been entered.
if [[ -z $ARGS ]]; then
# No arguments
emsg=$(route add $DEST netmask $MASK $GWAY $COUNT 2>&1)
else
# With arguments
emsg=$(route $ARGS add $DEST netmask $MASK $GWAY $COUNT 2>&1)
fi
fi



/etc/route add 10.3.23.0 255.255.255.0 10.3.24.249 1


Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
Steve Steel
Honored Contributor
Solution

Re: adding a second route

Hi

Phone call got me to stop last input

Here are some examples to clarify it.

route add default 16.32.17.1 1

Last '1' signifies that this gateway is external to the host system (ex a router ). If there is nothing at the end a '0' is assumed which means local interface/internal to the host.

route add net 16.43.9.0 16.32.17.1 1
Anything on the 15.43.9 subnet to use gateway 16.32.17.1

route delete default 16.32.17.1
Deleting default route and gateway

route delete net 15.43.9.0 16.32.17.1
Delete directive for the 15.43.9 subnet.

Command statements are until the next reboot. Anything permanent must be in /etc/rc.config.d/netconf.

Save a backup before modifying, backup
(netconf.old, .save, etc) to a different directory.

ROUTE_DESTINATION[0]=default
ROUTE_MASK[0]=""
ROUTE_GATEWAY[0]=16.32.17.1
ROUTE_COUNT[0]=1

ROUTE_DESTINATION[1]="net" 15.43.9
ROUTE_MASK[1]=""
ROUTE_GATEWAY[1]=16.32.17.1
ROUTE_COUNT[1]=1


Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
Joe Profaizer
Super Advisor

Re: adding a second route

Thanks for the tips. I think we may have found our problem in the firewall. Our networking team is on the case.

..Joe