cancel
Showing results for 
Search instead for 
Did you mean: 

How to add a route

Geyson
Advisor

How to add a route

Hi all,

I need to add a route to my servers (HP-UX 11.23) in windows is like this.

route add -p 192.168.100.0 mask 255.255.255.0 192.168.6.12 metric 1

but in HP-UX i dont know how to do it.

Can anybody help me?
10 REPLIES
R.O.
Esteemed Contributor

Re: How to add a route

Hi,

route [-f] [-n] add [net | host] destination gateway [count]

In your example:

route add net 192.168.100.0 255.255.255.0 192.168.6.12 1

Also, you have to add it to file "/etc/rc.config.d/netconf" to not lose it after a reboot

Regards,
"When you look into an abyss, the abyss also looks into you"
Matti_Kurkela
Honored Contributor

Re: How to add a route

There is one HP-UX oddity you should know: the "count" value (known as "metric" in windows) is not actually optional in HP-UX if the route includes a gateway (like yours does).

If count is not specified, HP-UX "route" command will assume it is 0, which makes no sense with gateway routes. As a result, trying to manipulate a gateway route without specifying the count will always fail with a cryptic-looking error message.

The "route" commands of most other OSs have a logic like "if the route entry contains a gateway and count is not specified, assume count=1; else assume count=0."

This little omission has caused much confusion to new HP-UX sysadmins.

MK
MK
Geyson
Advisor

Re: How to add a route

Hi i added the route, but when i added it show me the following

--> route add net 192.168.100.0 255.255.255.0 192.168.6.12 1

add net 192.168.100.0: gateway 255.255.255.0: Network is unreachable
Suraj K Sankari
Honored Contributor

Re: How to add a route

Hi,

Can you post this output
netstat -in
netstat -nr

Suraj
Geyson
Advisor

Re: How to add a route

Hi here are the result of -in and -nr attached
R.O.
Esteemed Contributor

Re: How to add a route

You have a single lan (lan1) and all the packets will go through it and the default gateway (192.168.6.1).

Regards,
"When you look into an abyss, the abyss also looks into you"
Geyson
Advisor

Re: How to add a route

Hi R.O.,

The thing is that i need to add the another route,
route add -p 192.168.100.0 mask 255.255.255.0 192.168.6.12 metric 1

net 192.168.100.0
mask 255.255.255.0
gateway 192.168.6.12

with the first command that you gave me, is showing me that the network is unrecheable.
Steven Schweda
Honored Contributor

Re: How to add a route

> Can anybody help me?

It's hard to say. Define "help".

> route [-f] [-n] add [net | host] destination gateway [count]

I don't see a netmask in there.

> route add net 192.168.100.0 255.255.255.0 192.168.6.12 1

I see a netmask (value) in there.

For an accurate synopsis of the "route"
command, I'd try:

man route

I don't have 11.23, but on my 11.11 and 11.31
systems, that says:

/usr/sbin/route [-f] [-n] [-p pmtu] add [net|host] destination
[netmask mask] gateway [count] [source src]

which suggests that the command might need to
look more like this:

route add net 192.168.100.0 netmask 255.255.255.0 192.168.6.12 1

> add net 192.168.100.0: gateway 255.255.255.0: Network is unreachable

"gateway 255.255.255.0" should be a clue.
Apparently, that "netmask" keyword is
important when specifying a netmask.
Geyson
Advisor

Re: How to add a route

Hi Steven Schweda,

It work perfectly, yes this keyword is important.

Now i have 2 question, first how can i add this thing in netconf file?.

Second in a server with cluster can i add by the same way?.
Steven Schweda
Honored Contributor

Re: How to add a route

> It work perfectly [...]

Reading the "man" pages can be helpful.

> [...] how can i add this thing in netconf
> file?.

Have you looked at the comments in that file?
I thought that SAM (or what's left of it)
could manage that file.

On my 11.31 system, SMH (Tools -> Network
Services Configuration -> Route) seems to do
this:

/usr/sam/lbin/samx -C -s route /usr/sam/lib/C/route.ui

whose help seems to say that it does the job.

> [...] cluster [...]

I know almost nothing about HP-UX clusters,
and I know exactly nothing about yours.