1830207 Members
1593 Online
109999 Solutions
New Discussion

Gateway

 
SOLVED
Go to solution
Jonathan Caplette
Regular Advisor

Gateway

Hi guys...

I have another question... If I change the gateway on a HP-UX 10.20 box, do I have to reboot the system?? Cause I've the gateway on my boxes and since that, it seems that all the IP packets are taking the older gateway... Is this because HP-UX keep a routing tables of all the route it takes or something like that???

How can I solve my problem???

Thanks Jonathan
12 REPLIES 12
Kurt Beyers.
Honored Contributor

Re: Gateway

You can change the gateway without rebooting the system.

Kurt
Frederic Sevestre
Honored Contributor

Re: Gateway

Hi,

Try "route delete" command to delete all entries about your old gateway. Then route add to add the new gateway.
See man route.
You don't need to reboot the system.

Regards.

Fr??d??ric
Crime doesn't pay...does that mean that my job is a crime ?
Jonathan Caplette
Regular Advisor

Re: Gateway

Ok.. but how can I see all the route in the route table???
Wilfred Chau_1
Respected Contributor

Re: Gateway

To see the route table, you can
# netstat -rn




Patrick Wallek
Honored Contributor

Re: Gateway

# netstat -r

or

# netstat -rn

Will show you your routing table entries. The only difference between the 2 commands is the -rn option will show all entries as IP addresses(n = numeric), whereas the -r option alone will attempt to resolve IP addresses to hostnames and will show hostnames if possible.
Jonathan Caplette
Regular Advisor

Re: Gateway

OK I see... I have a route that says:

default UG 0 8824 lan0

the ip address is my old gateway... do I change it with the route add/delete commands???
Darrell Allen
Honored Contributor

Re: Gateway

Hi Jonathan,

One thing not mentioned yet. If you change routes "on the fly" (which is perfectly fine), you will lose them when the system is rebooted unless you modify /etc/rc.config.d/netconf.

In netconf, you should have something like the following for your default gateway / route:

ROUTE_DESTINATION[0]=default
ROUTE_MASK[0]=""
ROUTE_GATEWAY[0]=xxx.xxx.xxx.xxx
ROUTE_COUNT[0]=1
ROUTE_ARGS[0]=""

Substitute your default gateway IP address for xxx.xxx.xxx.xxx

Also, be careful what you name backup netconf files. Most are skipped when booting but some could be executed (based on their name). I think it best to put backup copies of netconf in another directory. The same goes for any files in /etc/rc.config.d that you make a backup of.

Darrell
"What, Me Worry?" - Alfred E. Neuman (Mad Magazine)
Darrell Allen
Honored Contributor
Solution

Re: Gateway

route delete default

route add default 1

The "1" at the end of the route add command signifies the gateway is 1 routing hop away.

Darrell
"What, Me Worry?" - Alfred E. Neuman (Mad Magazine)
MANOJ SRIVASTAVA
Honored Contributor

Re: Gateway

Hi Jonathan

netstat -nr

will give the current binding of the default gateway .

you can

route delete

route add < the new gateway >

You dont have to reboot or even restart network services.


Manoj Srivastava
pap
Respected Contributor

Re: Gateway

Hi,
Yes, You can change GATEWAY on your HP-UX system without rebooting it.

Please follow the procedure below for that.

1. edit /etc/rc.config.d/netconf file and put the required value for your new gateway in it. Remove the old gateway if you do not require it.

2. simply run following commands.

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

3. Now you can check your new gateway/route using following command

netstat -rn

Now you are all set and new gateway is now on use.

Thanks,
-Piyush.
"Winners don't do different things , they do things differently"
pap
Respected Contributor

Re: Gateway

Hi,
Hope your problem must be resolved by this time.
Please assign points to all participants...:)...

Thanks,
-pap
"Winners don't do different things , they do things differently"
Jonathan Caplette
Regular Advisor

Re: Gateway

Thanks all of you guys...

I did a route delete/add on the default entry and then a net stop/start... everything's fine now...

ciao!!

P.S. to pap: I never forget to assign point to the repliers, it's just that i'm in a rush these days... And remember the essence of the forum, it's to share knowledge with other and not to get points... ;)