cancel
Showing results for 
Search instead for 
Did you mean: 

Can't add a default route.

SOLVED
Go to solution
Soma_1
Occasional Advisor

Can't add a default route.

Iam trying to add a second default route using command "route add default 10.99.2.111" on my hpux box.
Iam able to ping to this ipaddress, still iam getting error message
"add net default: gateway 10.99.2.111:Network is unreachable"
can some one explain and help me solve this problem.

Note: I have attached my /etc/rc.config.d/netconf file.
7 REPLIES
avsrinivas_1
Occasional Advisor
Solution

Re: Can't add a default route.

Dear Soma
While adding a route to network other than
local, in HPUX 10.20 and above, add a 1 at the
end of the route add cmd.

i.e. route add default 10.99.2.111 1.

Otherwise add the following in your netconf file after your first route destination entry.

ROUTE_DESTINATION[1]=default1
ROUTE_MASK[1]=""
ROUTE_GATEWAY[1]=10.99.2.111
ROUTE_COUNT[1]=1
ROUTE_ARGS[1]=""

This should solve your problem.
You can add more routes the same way by adding
the nos. within [] brackets.

hope this solves ur problem.

srinivas.
Be Dynamic
Satish Y
Trusted Contributor

Re: Can't add a default route.

Hi,

I think u should specify ur network IP in place of 1.

Cheers...
Satish.
Difference between good and the best is only a little effort
KapilRaj
Honored Contributor

Re: Can't add a default route.

hi Soma,

You can't have a default route out of your subnet. I tried the same in my machine & i got the following results.

Config:
ip : 192.9.206.59
sm : 255.255.255.0
gw : 192.9.206.1 (default)

#route add default 192.9.206.10 ( note that the gw is in my subnet)

this command worked , i confirmed with netstat -rn

# route add default 192.9.200.4 (note that now the gw is out of my subnet)

this command gave the same error
"add net default: gateway 192.9.200.4: Network is unreachable"

So what does it mean ?. What i said , the gateway should be in your subnet.

If you can give some more information. I may be able to help you more. what is your ip, subnetmask,gw (current),gw required to add etc.

Good luck,

kaps
Nothing is impossible
KapilRaj
Honored Contributor

Re: Can't add a default route.

Sorry Sorry,

I did not see your attachment.
Can you please send the out put of netstat -rn . You need to have a route to your subnet that is 10.99.2 and the gateway for that should be your interface. If does not exist you can add it by

route add net 10.99.2.0 netmask 255.255.255.0 10.99.2.100 1

Forget my prev post.

kaps
Nothing is impossible
KapilRaj
Honored Contributor

Re: Can't add a default route.

hi Soma,

Could you solve it ?. What was the prob ?. Do u need any help ?

kaps
Nothing is impossible
Herve BRANGIER
Respected Contributor

Re: Can't add a default route.

Hi Soma,

I think your problem is that you already have
a default route. So I made a test : I try to
configure a second default gateway, and obtain
the same result.

You have 2 solutions :
1) modify your priority (ROUTE_COUNT) and
use 2 gateways : route add default 2
2) delete the first one to add the new one.

In the 2 cases you need to modify your netconf
or use "set_parms addl_netwrk" to do that.

Herve



Soma_1
Occasional Advisor

Re: Can't add a default route.

Thank you guys, with all your guidance, I was able to do what I wanted to.
I feel that great with you guys arround to help.
Thanks again.
Soma