- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- adding a persistant route in hpux
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2013 09:58 PM - last edited on 04-08-2013 10:21 PM by Cathy_xu
04-08-2013 09:58 PM - last edited on 04-08-2013 10:21 PM by Cathy_xu
Hi team,
I want to know how to add a persistent route in hpunix. I have added the below command for adding the route statically
route add host <Host Ip> <gw ip> 1 source <ip of lan2> ==== > this one i have executed for adding the route statically
/etc/rc.config.d/netconf i have added the below entry for making the above route permanantly.
ROUTE_DESTINATION[3]="host Host ip"
ROUTE_MASK[3]="255.255.255.0"
ROUTE_GATEWAY[3]="gw ip"
ROUTE_COUNT[3]="1"
ROUTE_ARGS[3]=""
Could you please tell me the action which i did in netconf file is correct ?
Regards
P.S.This thread has been moved from HP-UX>System Administration to HP-UX > networking-HP Forums Moderator
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2013 01:12 AM
04-09-2013 01:12 AM
Re: adding a persistant route in hpux
Your netconf entry does not exactly match the "route add" command you used.
ROUTE_MASK is for network routes ("route add net ... netmask ...") only. If you are specifying a host route ("route add host ..."), then the ROUTE_MASK should be an empty string:
ROUTE_MASK[3]=""
In the "route add" command, the "source <ip of lan2>" part is optional - if you need it for special reasons, you should also add it to the ROUTE_ARGS line in netconf, i.e.:
ROUTE_ARGS[3]="source <ip of lan2>"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2013 11:40 PM
04-09-2013 11:40 PM
Re: adding a persistant route in hpux
Hi MK,
Thanks a lot for your reply. I have made the changes you mentioned. As part of the scheduled reboot the server will get rebooted on the coming weekend.
If i am getting error on that time i wil update you.
Regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2013 01:37 AM
04-15-2013 01:37 AM
Re: adding a persistant route in hpux
Hi MK,
After the reboot the route is not get added. I can see the below error from rc.log
===================================================================
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 :
source: unknown command
"/sbin/rc2.d/S340net start" FAILED
===================================================================
The entry which i gave in /etc/rc.config.d/netconf is
ROUTE_DESTINATION[3]="host 10.144.8.4"
ROUTE_MASK[3]=""
ROUTE_GATEWAY[3]="10.144.17.1"
ROUTE_COUNT[3]="1"
ROUTE_ARGS[3]="source 10.144.17.152"
Could you please advise me on this
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2013 05:09 AM
04-16-2013 05:09 AM
Re: adding a persistant route in hpux
10.144.17.152 is not yet configured
are you using srp?
are you using ip strong es model set to 1?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2013 05:23 PM
04-16-2013 05:23 PM
Re: adding a persistant route in hpux
Hi Laurent,
Sorry i didnt get your question. Could you please explain a it ?
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2013 01:28 AM
04-17-2013 01:28 AM
Re: adding a persistant route in hpux
> source: unknown command
Hmm... it does not seem to like the "source" option in the ROUTE_ARGS. Perhaps the /sbin/init.d/net script just cannot parse that option, although the route command supports it. (What is your HP-UX version, by the way?)
To fully understand the problem, I would need to check the /sbin/init.d/net script of the same HP-UX version (and ideally about the same patch level) as your system.
You could try reading the /sbin/init.d/net script: see if you can figure out how it builds up the arguments for the "route" command using the various ROUTE_ variables.
If you're trying to have a Serviceguard packaged application send its outgoing traffic through the package IP, then it might be better to add the "route" command to the Serviceguard package start-up scripts instead. (If you are using legacy-style packages, there is a place for customer-added package start/stop commands in the package control file; if you are using the new modular configuration style of the newer Serviceguard versions, you would write a script and call it from the package configuration file using the "external_script" keyword.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2013 07:09 AM
04-17-2013 07:09 AM
Re: adding a persistant route in hpux
Hi MK,
I am using HP-Ux 11.23 . I am attaching the file /sbin/init.d/net Could you please have a look on this.
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2013 12:43 PM
04-17-2013 12:43 PM
SolutionOkay. The part that interests us begins with this comment:
# # Do route command for each configured route #
First it does some basic validation of the indexes of the ROUTE_ variables, then it starts a while loop that goes through each variable group in order.
Within the loop, the ROUTE_ variables of the currently processed group are copied to other variables with shorter names and no index:
DEST=$(print ${ROUTE_DESTINATION[i]}) GWAY=$(print ${ROUTE_GATEWAY[i]}) [...] ARGS=${ROUTE_ARGS[i]} MASK=$(print ${ROUTE_MASK[i]})
And finally, here's the part where the variables are assembled into a complete route command. There are four varieties, depending on whether the ROUTE_MASK is used or not, and whether ROUTE_ARGS is used or not.
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
And here is the problem: the content of the ARGS variable is placed at the very beginning of the list of arguments, instead of at the end.
The man page of the route command describes the syntax like this:
/usr/sbin/route [-f] [-n] [-p pmtu] add [net|host] destination [netmask mask] gateway [count] [source src]
So, the ARGS variable (and thus the ROUTE_ARGS variables in /etc/rc.config.d/netconf) may only contain combinations of "-f", "-n" and "-p <pmtu value>".
The "source" option must be at the very end of the command, so ROUTE_ARGS is not the correct place for it after all. I'm sorry for giving you bad advice.
The "souce" option must go after the COUNT variable that comes from ROUTE_COUNT, but there is no variable that could be used.
If you absolutely must put the setting into /etc/rc.config.netconf and nowhere else, there might still be a way: looks like the COUNT variable gets special treatment only if the ROUTE_COUNT is left empty. If it is non-empty, anything that is put into ROUTE_COUNT seems to get passed to the route command line exactly as-is.
I would not recommend tricks like that in production systems. But if you must do it, then try settings like this in your /etc/rc.config.d/netconf file:
ROUTE_COUNT[3]="1 source 10.144.17.152" ROUTE_ARGS[3]=""
The problem with a dirty hack like this is that SAM most likely will not understand it. If someone edits the system's route settings with SAM, the next time you boot the system you're likely to find that the source options have vanished. Or maybe SAM might show an error message.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2013 06:17 PM
04-17-2013 06:17 PM
Re: adding a persistant route in hpux
Hi MK,
Thanks a lot for your great help on this.
In production machine any way i had removed the vaule which we added for the variable ROUTE_ARGS. I am waiting for the reboot (which is on coming monday) to check wether the route is getting added properly or not.
Mean while in one of our testing server i will check the solution you provided below and lets see what will happen.
I will keep you posted regarding the results.
Once again thanks a lot for your effort on this
Regards