Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

multiple Gateways

Status
Not open for further replies.

cp2000

Technical User
Dec 31, 2002
81
US
I have a solaris 8 System that has 2 IP ranges assigned to it. Each range has a separate gateway and netmask. I have
1) setup /etc/hme0:1 with the hostname
2) put the hostname and IP in /etc/inet/hosts
3) setup the IP using "ifconfig plumb" and "ifconfig Bla Bla up"
4) put an entry in /etc/netmasks with the network address(bottom address in each range) and the netmask assigned

I'm just not sure where to put the gateway(and broadcast?) information. I read one post about adding a "route add" script. But am not real clear(or sure) about where to go next.
 
Your default gateway should be defined in /etc/defaultrouter, however you can only put one IP address in that file.

Create a script called /etc/rc2.d/S99route containing something like:

Code:
#!/bin/sh

route add -net 1.2 1.2.3.4

Where 5.6 are the significant parts of the second network and 1.2.3.4 is the IP address of the gateway for that network.

Annihilannic.
 
You should be able to create a file called /etc/gateways. I used to use it on a couple of Solaris servers some time back that were running CheckPoint FW and had multiple interfaces. You can do a man page on gateways to get more info. I can't remember the syntax exactly, but you may be able to do some searches on google to find out. If I'm not mistaken its going to be something like this:

192.168.0.0 192.168.1.1

Just make sure to have the appropriate entries in your netmask file.

This is a much cleaner way of doing things as opposed to using startup scripts. If you're running any version of Linux then you will need to use Annihilannic's method as the gateways file is not supported under Linux.

HTH,
Blaine
 
To use /etc/gateways you would have to be willing to run the routing daemon in.routed. The in.routed man page is where /etc/gateways is documented.

Annihilannic.
 
Annihilannic,
Not sure about this one.
"route add -net 1.2 1.2.3.4"

I have:
Router address 123.22.23.128
gateway address 123.22.23.129

Is this what I am looking for?
"route add -net 123.22 123.22.23.129"

 
It depends on the netmask used for your network. If it is 255.255.255.0 then the first three octets (24 bits) are significant and the command should be:

Code:
route add -net 123.22.23 123.22.23.129

If it is 255.255.0.0 then the command you specified would be fine.

Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top