- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: add static routes at startup ..
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
Forums
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
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
08-29-2001 02:13 PM
08-29-2001 02:13 PM
Does anyone have a script would add static routes at startup. I know how to enable it but I dont know how to write a config file. My understanding is that I need a config file in rc.config.d to add a script to add routes on startup. Does anyone have a config file or suggestions?
Richard
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2001 02:41 PM
08-29-2001 02:41 PM
Re: add static routes at startup ..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2001 03:07 PM
08-29-2001 03:07 PM
SolutionIf you are going to use the IP of one of the interfaces for routing, then you can use the default /etc/rc.cofnig.d/netconf file itself.
Otherwise, you need to write a small script and put it under /sbin/init.d with proper links in /sbin/rc3.d file.
You also may want to create a control file in /etc/rc.config.d where you would define a variable that will be checked by the script in /sbin/init.d directory.
Following is the skeleton of the script. You can customize it according to your needs.
/etc/rc.config.d/statroute:
#Your comments
STATICROUTE=1
/etc/sbin/init.d/statroute:
#!/sbin/sh
#Your comments
PATH=$PATH:Your_additional_paths
export PATH
if [ -r /etc/rc.config.d/statroute ]
then
. /etc/rc.config.d/statroute
else
echo "/etc/rc.config.d/statroute file missing"
exit 1
fi
case $1 in
start_msg)
print "Adding the static routes"
exit 0
;;
start)
route add net your_destination your_ip
if [ $? != 0 ]
then
echo "Failed to add static route"
exit 1
fi
*)
print "Improper arguments to the script"
exit 1
esac
//End of File//
#ln -s /sbin/init.d/statroute /etc/rc.config.d/rc3.d/S9xxstatroute
We are not interested in stop sequence.
You need to check the syntax of the above script and add if you need anything.
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2001 03:14 PM
08-29-2001 03:14 PM
Re: add static routes at startup ..
....
start)
if [ $STATICROUTE = 1 ]
then
route add net your_destination your_ip
if [ $? != 0 ]
then
echo "Failed to add static route"
exit 1
fi
else
exit 2
fi
....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2001 04:01 PM
08-29-2001 04:01 PM
Re: add static routes at startup ..
The easiest thing to do is to modify the /etc/rc.config.d/netconf. You could do something like this
ROUTE_DESTINATION[0]=default
ROUTE_MASK[0]=""
ROUTE_GATEWAY[0]=xxx.xxx.xxx.254
ROUTE_COUNT[0]=1
ROUTE_ARGS[0]=""
ROUTE_DESTINATION[1]="net yyy.yyy.yyy"
ROUTE_MASK[1]=""
ROUTE_GATEWAY[1]=xxx.xxx.xxx.zz
ROUTE_COUNT[1]=1
ROUTE_ARGS[1]=""
Here xxx.xxx.xxx.254 is your default gateway
yyy.yyy.yyy is the network you want to setup a static route to
xxx.xxx.xxx.zz is the IP address you want to use to connect to the network yyy.yyy.yyy
-HTH
Ramesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2001 05:01 PM
08-29-2001 05:01 PM
Re: add static routes at startup ..
I wrote a script for you (I took the template in /sbin/init.d and modified it). You just have to change the static_route configuration file to be placed in /etc/rc.config.d.
Once you copy the scripts, make sure you create the links in /sbin/rc2.d for startup and shutdown
-Regards
Ramesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2001 10:32 PM
08-29-2001 10:32 PM
Re: add static routes at startup ..
For defining route on startup, you better configure your /etc/rc.config.d/netconf :
Entry :
ROUTE_GATEWAY[x]=ip
x : Is the instance number ( start at zero and for other instances you can increment one, two etc...)
ip : IP address for the default route gateway.
Magdi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2001 10:45 PM
08-29-2001 10:45 PM
Re: add static routes at startup ..
Of course, the following :
ROUTE_DESTINATION[x]=default
ROUTE_MASK[x]=""
ROUTE_COUNT[x]=1
ROUTE_ARGS[x]=""
and for other gateway :
ROUTE_GATEWAY[y]=address1
ROUTE_DESTINATION[y]=address2
ROUTE_MASK[y]=""
ROUTE_COUNT[y]=1
ROUTE_ARGS[y]=""
Magdi