Operating System - HP-UX
1823913 Members
3506 Online
109667 Solutions
New Discussion юеВ

Change default gateway permanently

 
olive_1
New Member

Change default gateway permanently

Hello everyone!


I want to change the default gateway, and for that, I use the script you can find below :

# delete it from netconf
route delete default 192.168.16.1 1

# add a new one
route add default 192.168.16.30 1

# change netconf file using a script
./changeKeys.sh /etc/rc.config.d/netconf ROUTE_GATEWAY[0] "192.168.16.30"

# stop
/sbin/init.d/net stop

# restart service
/sbin/init.d/net start


It doesn't work; the message I get is

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 :
add net default: gateway 192.168.16.30: Network is unreachable




I've read some message in this forum and it seems that it could be a subnet problem...


Here you can find my routing table.

[mc2]root:/# netstat -rnv
Routing tables
Dest/Netmask Gateway Flags Refs Interface Pmtu
127.0.0.1/255.255.255.255 127.0.0.1 UH 0 lo0 4136
192.168.254.12/255.255.255.255 192.168.254.12 UH 0 lan0 4136
192.168.16.52/255.255.255.255 192.168.16.52 UH 0 lan5000 4136
192.168.16.25/255.255.255.255 192.168.16.25 UH 0 lan5000:2 4136
192.168.16.30/255.255.255.255 192.168.16.30 UH 0 lan5000:3 4136
192.168.16.31/255.255.255.255 192.168.16.31 UH 0 lan5000:1 4136
192.168.16.0/255.255.255.0 192.168.16.52 U 5 lan5000 1500
192.168.16.0/255.255.255.0 192.168.16.30 U 5 lan5000:3 1500
192.168.16.0/255.255.255.0 192.168.16.25 U 5 lan5000:2 1500
192.168.16.0/255.255.255.0 192.168.16.31 U 5 lan5000:1 1500
192.168.254.0/255.255.255.0 192.168.254.12 U 2 lan0 1500
127.0.0.0/255.0.0.0 127.0.0.1 U 0 lo0 0
default/0.0.0.0 192.168.16.1 UG 0 lan5000 0



Rgds,

Olivier
3 REPLIES 3
Bernhard Mueller
Honored Contributor

Re: Change default gateway permanently

Olivier,

you should run

ifconfig lan# unplumb
to bring the IP stack down on the card

after you do /sbin/init.d/net stop
and before net start

Regards,
Bernhard
Bill Thorsteinson
Honored Contributor

Re: Change default gateway permanently

It would appear that the problem likely existed
for the old gateway address. Check that
the interface for lan5000:1 is setup by the
the time you are configuring the gateway.

If lan5000 is configured when the routing
tables are being configure you can set up a route to the gateway via its address and then
add the default route using the gateway.
Ron Kinner
Honored Contributor

Re: Change default gateway permanently

The gateway you are trying to use appears to be a virtual IP address on the HPUX. Normally you should use an IP which is NOT on the HPUX as the gateway (therefore the metric of 1 at the end of the route add command) unless you are trying to do Proxy Arp in which case you would need to set the metric to 0. (This will tell the box to arp for any address it needs and then hopefully your friendly neighborhood router will reply with its own MAC address and will then forward the packets for you. This only works if the router is set to do proxy arp and is a bit slower than the usual method.)

It's not clear what you are trying to do with the multiple instances of the same LAN and I suspect the HPUX is having the same problem.

Ron