Operating System - HP-UX
1830930 Members
2333 Online
110017 Solutions
New Discussion

Re: Adding entries to the routing table

 
SOLVED
Go to solution
Scott Dunkley
Regular Advisor

Adding entries to the routing table

When I add an entry into the routeing table, it is deleted after a reboot, how can I stop this happening and make the routes permamnent ?
Better to regret something you have done, than something you havn't
8 REPLIES 8
Rita C Workman
Honored Contributor
Solution

Re: Adding entries to the routing table

I'm going to guess you did a route command only...

Did you go to the /etc/rc.config.d/netconf file and make the entry in their also?
It's the netconf file that makes for permanent routing information.

Hope this helps,
Kofi ARTHIABAH
Honored Contributor

Re: Adding entries to the routing table

Yes. you have to edit the /etc/rc.config.d/netconf file and add multiple entries for each route with

ROUTE_DESTINATION[0]=default
ROUTE_MASK[0]=""
ROUTE_GATEWAY[0]=ip.of.gate.way
ROUTE_COUNT[0]=1
ROUTE_ARGS[0]=""

there is an example in the /etc/rc.config.d/netconf file.
nothing wrong with me that a few lines of code cannot fix!
Alex Glennie
Honored Contributor

Re: Adding entries to the routing table

..... and check with netstat -rn in you haven't been
Andreas Voss
Honored Contributor

Re: Adding entries to the routing table

Hi,

you have to edit the file /etc/rc.config.d/netconf

Example:
route add net 191.3.0.0 netmask 255.255.0.0 191.2.4.8 1

ROUTE_DESTINATION[#]="net 191.3.0.0"
ROUTE_MASK[#]="255.255.0.0"
ROUTE_GATEWAY[#]=191.2.4.8
ROUTE_COUNT[#]=1
ROUTE_ARGS[#]=""

You have to choose the right index # within the [] (just increment uniq)

Regards

Andrew
Anthony deRito
Respected Contributor

Re: Adding entries to the routing table

Scott, just an FYI... this is the way the dynamic routes work. When the box is bounced, the routing tables are flushed. It is like doing a route -f on the command line. As the routes are learned by your router or level 3 switch, your tables will be populated. This is important to understand becasue if there is more than one route to a device, the tables will dynamically reflect that alternate route and your packet will still get to its destination.

You did not really lose your routes. As a test, when the system comes back up, run a netstat -rn. You won't see the route as you have described. Now ping a device and use a gateway which you expected to see the routing table. Now run netstat -rn again and see how the routing tables dynamically learned the route.

Tony
CHRIS_ANORUO
Honored Contributor

Re: Adding entries to the routing table

Hi Scott,

If you check the routing entries with this command netstat -rn, any missing destinations can be added with:

route add X.Y.W.Z(network address) X.Y.W.Z(gateway address)


Chris

When We Seek To Discover The Best In Others, We Somehow Bring Out The Best In Ourselves.
P V Patel
Advisor

Re: Adding entries to the routing table

By adding following entry to /etc/rc.config.d/netconf file:
ROUTE_DESTINATION[I]="ip of destination host"
ROUTE_MASK[I]=""
ROUTE_GATEWAY[I]={ip of gate way}
ROUTE_COUNT[I]=1
ROUTE_ARGS[I]=""
You may add route permenantly.
regards.
Punjabhai V Patel

Punjabhai
Graham Forecast
New Member

Re: Adding entries to the routing table

If you don't feel confident editing system configuration files, you can also set up permanent routes using 'sam'. Go to 'Networking and Communications'/'Internet Addresses', select the IP address you want a route for and selsct 'Actions-Modify'. You can then change the gateway to 'Modify Gateway for this Connection'.

Note - if you use 'sam' to add the IP address, you may not be able to select this entry until you have completed the creation - then use the above to go back into 'Modify' (this is how it works on our 10.20 systems).