1834674 Members
2281 Online
110069 Solutions
New Discussion

Diferent Gateways

 
SOLVED
Go to solution
FrankBurg
Occasional Advisor

Diferent Gateways

Hi everyone...I need your help.
I have a hp-ux 11.23 server with 3 lan's
lan0--> 10.201.10.23
lan1--> 192.168.170.15
lan2--> 10.161.7.22
and I need to define a particular gateway for each one. I want to define a 10.201.10.2 gateway for lan0;
192.168.170.12 gateway for lan1; and
10.161.7.2 gateway for lan2....
and I need that configuration stay fix always...
Regards....
8 REPLIES 8
Tom Danzig
Honored Contributor

Re: Diferent Gateways

In the /etc/rc.config.d/netconf file, look at the following line for each interface:

ROUTE_GATEWAY[X]="10.1.1.3"

where [X] is the network card interface. Set the cards gateway here.
Tom Danzig
Honored Contributor

Re: Diferent Gateways

Please ignore the above which is for the default gateway. Too early and not enough coffee!
Kofi ARTHIABAH
Honored Contributor
Solution

Re: Diferent Gateways

The file you need to configure is
/etc/rc.config.d/netconf

In this file you have to create entries such as:


ROUTE_DESTINATION[1]="net 10.201.10.0"
ROUTE_MASK[1]=255.255.255.0
ROUTE_GATEWAY[1]=10.201.10.2
ROUTE_COUNT[1]=1
ROUTE_ARGS[1]=""


ROUTE_DESTINATION[2]="net 192.168.170.0"
ROUTE_MASK[2]=255.255.0.0
ROUTE_GATEWAY[2]=192.168.170.12
ROUTE_COUNT[2]=1
ROUTE_ARGS[2]=""


ROUTE_DESTINATION[3]="net 10.161.7.0"
ROUTE_MASK[3]=255.255.0.0
ROUTE_GATEWAY[3]=10.161.7.2
ROUTE_COUNT[3]=1
ROUTE_ARGS[3]=""


This configuration will survive a reboot. You should be able to activate the configuration with

/sbin/init.d/net start

and verify with

netstat -rn


Hope this helps.

Kofi
nothing wrong with me that a few lines of code cannot fix!
Tom Danzig
Honored Contributor

Re: Diferent Gateways

You can set these routes up per interface/subnet in the netconf file. The below are the comments above the section in the file where you add these. Pretty self-explanatory.


# Internet routing configuration. See route(1m), routing(7)
#
# ROUTE_DESTINATION: Destination hostname (in /etc/hosts) or host or network
# IP address in decimal-dot notation, preceded by the word
# "host" or "net"; or simply the word "default".
#
# ROUTE_MASK: Subnetwork mask in decimal-dot notation, or C language
# hexadecimal notation. This is an optional field.
# A IP address, subnet mask pair uniquely identifies
# a subnet to be reached. If a subnet mask is not given,
# then the system will assign the longest subnet mask
# of the configured network interfaces to this route.
# If there is no matching subnet mask, then the system
# will assign the default network mask as the route's
# subnet mask.
#
# ROUTE_GATEWAY: Gateway hostname (in /etc/hosts) or IP address in
# decimal-dot notation. If local interface, must use the
# same form as used for IP_ADDRESS above (hostname or
# decimal-dot notation). If loopback interface, i.e.,
# 127.0.0.1, the ROUTE_COUNT must be set to zero.
#
# ROUTE_COUNT: An integer that indicates whether the gateway is a
# remote interface (one) or the local interface (zero)
# or loopback interface (e.g., 127.*).
#
# ROUTE_ARGS: Route command arguments and options. This variable
# may contain a combination of the following arguments:
# "-f", "-n" and "-p pmtu".
#
# For each additional route, add a set of variable assignments like the ones
# below, changing the index to "[1]", "[2]" et cetera.
FrankBurg
Occasional Advisor

Re: Diferent Gateways

Thanks anyway TOM....
rick jones
Honored Contributor

Re: Diferent Gateways

Do you mean you want three separate default gateways, one per interface? Or do you have other IP ranges, which you've not specified, in mind for the gateway destination?
there is no rest for the wicked yet the virtuous have no pillows
FrankBurg
Occasional Advisor

Re: Diferent Gateways

I need three separes gateways one for each lan...
rick jones
Honored Contributor

Re: Diferent Gateways

There are gateways and then there are default gateways. Which is it?

Is it the case that want any traffic with a source IP of that of lan0 to use one gateway to reach _all_ remote networks, and then if the source IP is that of lan1 to use a different gateway even if the remote network is the same?

If so, that would seem to be multiple "default" gateways which really isn't an overly simple thing to do, but you can simulate it by doing the apropriate route add commands (and/or edits to netconf) _and_ setting ip_strong_es_model to one (or two) with ndd (and nddconf).

Normally in HP-UX, there is really only one "default" gateway that would be used by all on the system. If you have a specific set of remote destination IP's in mind you could add specific network routes. If there are many of them that may become unpalatable.

Route selection is done in this order:

1) matching host route
2) matching (sub)network route
3) default route
there is no rest for the wicked yet the virtuous have no pillows