Operating System - HP-UX
1753481 Members
4460 Online
108794 Solutions
New Discussion юеВ

Unable to change default gateway

 
mr. N.V. (Nitin) Mehta
Occasional Advisor

Unable to change default gateway

I need to change default gateway IP address,
on HP9000 K380 HP-UX 11.0 32 bit.
Current Default Gateway is: 172.16.159.126
Host's IP address is 172.16.159.124
New gateway required is: 172.16.159.254

Output of netstat -rnv
Routing tables
Dest/Netmask Gateway Flags Refs Use Interface Pmtu
127.0.0.1/255.255.255.255
127.0.0.1 UH 0 9703865 lo0 4136
172.16.159.124/255.255.255.255
172.16.159.124 UH 0 259910 lan0 4136
172.16.159.0/255.255.255.128
172.16.159.124 U 2 0 lan0 1500
127.0.0.0/255.0.0.0 127.0.0.1 U 0 0 lo0 4136
default/0.0.0.0 172.16.159.126 UG 0 0 lan0 1500

Changing gateway using route command
route add default 172.16.159.254
gives following error
add net default: gateway 172.16.159.254: Network is unreachable

Both the current and new gateway IP addresses I can ping.
e.g.,
# ping 172.16.159.254
PING 172.16.159.254: 64 byte packets
64 bytes from 172.16.159.254: icmp_seq=0. time=1. ms
64 bytes from 172.16.159.254: icmp_seq=1. time=0. ms
64 bytes from 172.16.159.254: icmp_seq=2. time=0. ms

----172.16.159.254 PING Statistics----
3 packets transmitted, 3 packets received, 0% packet loss
round-trip (ms) min/avg/max = 0/0/1

What is wrong?
Please help.
Nitin Mehta
7 REPLIES 7
Andreas Voss
Honored Contributor

Re: Unable to change default gateway

Hi,

this is a subnet mask problem.
Try:
ndd -set /dev/ip ip_check_subnet_addr 0

This will disable subnet checking.
To make it permanent modify startup networking script /sbin/init.d/net and add the ndd command in it.
Also default gateway has to be entered in:
/etc/rc.config.d/netconf:
ROUTE_GATEWAY[0]=172.16.159.254

Regards
Berlene Herren
Honored Contributor

Re: Unable to change default gateway

Good eye, Andreas! Instead of putting it in the script, there is a file, /etc/rc.config.d/nddconf that you can put this command in:
TRANSPORT_NAME[0]=ip
NDD_NAME[0]=ip_check_subnet_addr
NDD_VALUE[0]=0

This will keep the value after a reboot.

Berlene

http://www.mindspring.com/~bkherren/dobes/index.htm
Andreas Voss
Honored Contributor

Re: Unable to change default gateway

Thank you berlene for your hint.
Regards
Rita C Workman
Honored Contributor

Re: Unable to change default gateway

When I add a default route I key it like this:

route add default 172.16.159.64 1 (notice I put the ip a space and a one !!)

Then I go back and edit my /etc/rc.config.d/netconf and make sure the line that
reference the Default Gateway reflects this also...


mr. N.V. (Nitin) Mehta
Occasional Advisor

Re: Unable to change default gateway

Did as suggested.
This did not work.
The Results:

# ndd -set /dev/ip ip_check_subnet_addr 0
#
# route add default 172.16.159.254
add net default: gateway 172.16.159.254: Network is unreachable

Need more help.
Nitin Mehta
Andreas Voss
Honored Contributor

Re: Unable to change default gateway

Hi,

have you added the metric value 1 at your route command ?
(route add default 172.16.159.64 1)
This has to be, because the gateway is outside your HP box.

Regards
mr. N.V. (Nitin) Mehta
Occasional Advisor

Re: Unable to change default gateway

The problem is solved.
Though I do not understand
why "1" at the end of IP address in the
route add command and
why do I need to use 172.16.159.64
instead of 172.16.159.254 as IP address?

Regards and thanks to all for your help.
Nitin Mehta (mail: nlmehta1@nl.cgeyc.com)
Nitin Mehta