Operating System - HP-UX
1745884 Members
4117 Online
108723 Solutions
New Discussion

Re: route add Network is unreachable

 
rick jones
Honored Contributor

Re: route add Network is unreachable

In HP-UX, a gateway IP must be in a locally connected subnet, it cannot be an IP that is reached via another gateway.

For example, if we had systems

A-B-C-D

where the '-' is a network link. On A, we could use B as the gateway IP to reach C or D, but could not use C as the gateway IP to reach D because we only reach C via B - ie C is not local.
there is no rest for the wicked yet the virtuous have no pillows
Basheer_2
Trusted Contributor

Re: route add Network is unreachable

Hello Tariq

This fixed My similar problem ( to add a default route)

route add default netmask 255.255.255.1 my-gateway_addr 1

(the 1 at the end is a must in my case)

netstan -rn ( just the last line shown here)
default my-gateway_addr UG 0 lan0 0

--------
to add other routes
route add ip-addr netmask 255.255.255.0 gw-addr 1
Tariq Subra
Occasional Advisor

Re: route add Network is unreachable

Thank you all.
It appears on hpux when you are seting-up a static route for a single server, you must give a count of 1 atleast. It is not required when you specifing a network range

Man route would reveal this.

For example.
For Network range:
route add net 62.141.4.236 netmask 255.255.255.252 192.168.200.6

For Single Host:
route add host 62.141.4.235 192.168.200.6 1

thanks again to U all.
Edwin Cleymans
New Member

Re: route add Network is unreachable

When I got this error message, with route add net ...

it was not the matter of adding the metrics number at the end.

All I had to do is: arp -d gateway_ip_address and then try again.

This time, the route add net command worked correctly!

The gateway ip address had to be deleted from the arp cache, funny enough !

 

James Calfas
Occasional Advisor

Re: route add Network is unreachable

Another condition that will produce a Network unreachable error is if you try to add a route that conflicts with an existing route.  For example, if you enter the following command:

  

    route add net 1.1.0.0 netmask 255.255.0.0 2.2.2.2

 

and a route already exists for IP address 1.1.2.3, you have a conflict and this will produce the Network unreachable message.  You can check the existing routes with "netstat -rn".