1834139 Members
2412 Online
110064 Solutions
New Discussion

adding new route

 
SOLVED
Go to solution
Chang_6
Regular Advisor

adding new route

Hi,

I have two gateway ip addresses. i have to add routes. Can you help?

what is the format?

This machine ip and the gateway ips are different.

Is this how I should add?

/usr/sbin/route 1 ???
7 REPLIES 7
Sanjay_6
Honored Contributor

Re: adding new route

Hi,

Try

route add subnet subnet_gw_ip 1

To make the changes permanent edit the /etc/rc.config.d/netconf file.

also take a look at this thread,

http://docs.hp.com/en/B2355-90147/ch02s04.html#bcfdebbg

Hope this helps.

Regds
Jeff Schussele
Honored Contributor
Solution

Re: adding new route

Hi,

Well, no. IF you have a default route already - check with
netstat -rn
Then *all* other routes need to be static routes to either hosts or subnets - added as follows:

route add host host_ip_here netmask mask_ip_here_if_needed gateway_ip_here 0
"Usually" the gateway will be the outbound I/F hence a 0 hop count
OR
route add net 111.222.111 netmask mask_ip_here_iff_needed gateway_ip_here 0

Of course all these static routes can be added to the /etc/rc.config/netconf file to be added at every boot.
You can only have *one* default route so that's why all others must be static.

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Chang_6
Regular Advisor

Re: adding new route

Hi,

All I have is the ip address of gateway. So is this right?

route add host host_ip_here netmask mask_ip_here_if_needed gateway_ip_here 0


route add host_name_this_machine this_ip netmask gateway_net_mask gateway_ip 0.

How to get gateway netmask?
Ron Kinner
Honored Contributor

Re: adding new route

The purpose of a route statement is to tell the machine it can get to a particular subnet or host by first going to a gateway.

If all you know is the gateway's address then there is no point in adding a route. The question you need to ask yourself (or the owner of the gateway) is where does the gateway know how to go? If your answer is the Internet and you already have a default route pointing to a gateway that knows how to get to the internet then this can only be a backup route which I don't think is really supported in HPUX unless you are running gated. Ideally your answer will be: It can go to subnet A.B.C.0 with mask 255.255.255.0 or perhaps subnet 10.0.0.0 with mask 255.0.0.0.

Note that you will lose your route at the first reboot. You need to edit /etc/rc.config.d/netconf in order for it to stay.

Which version of HPUX do you have?

Ron

Jeff Schussele
Honored Contributor

Re: adding new route

Hi,

Are you saying that you do not have 2 NICs in this system?
If not then it will be up to the default gateway to route the traffic to the secondary gateway.
Normally one has multiple interfaces in the system & what the static routes do is force the traffic out the secondary NIC where a router on that subnet picks up the traffic & moves it along.
If you do have 2 NICs in the system & let's say these are the assigned IPs
111.123.111.123
123.111.123.111
And let's say that the default gateway is
111.123.111.1
And you're trying to get traffic to the
123.111.125
subnet. Then your route statement would be
route add net 123.111.125 123.111.123.111 0
In this case no netmask was necessary as the router on the 123.111.123 subnet would route it to the 123.111.125 subnet.
If the subnets are ganged up into a supernet then you'd have to ask the network admins what netmask you'll need.

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Chang_6
Regular Advisor

Re: adding new route

Hi appreciate your responses. HP version is 11.00. I am trying to send emails to outside addresses as this box doesn't send emails to outside addresses like yahoo. I was told to point this to two gateways. The gateways belong to some other n/w
Chang_6
Regular Advisor

Re: adding new route

Sorry if I am troubleing you ...

Are you saying that you do not have 2 NICs in this system?
If not then it will be up to the default gateway to route the traffic to the secondary gateway.
Normally one has multiple interfaces in the system & what the static routes do is force the traffic out the secondary NIC where a router on that subnet picks up the traffic & moves it along.
If you do have 2 NICs in the system & let's say these are the assigned IPs
111.123.111.123
123.111.123.111
And let's say that the default gateway is
111.123.111.1
And you're trying to get traffic to the
123.111.125
subnet. Then your route statement would be
route add net 123.111.125 123.111.123.111 0
In this case no netmask was necessary as the router on the 123.111.123 subnet would route it to the 123.111.125 subnet.
If the subnets are ganged up into a supernet then you'd have to ask the network admins what netmask you'll need.

---

And you're trying to get traffic to the
123.111.125 subnet.

I know the gateway address only. I know that the gateway will link to internet. Is it required to find subnet address?

Please also tell how to check the number of NIC s here.

Please help so that it will solve my problem.