Problem
My server has a network adapter that connects it to my LAN and an
additional interface (either another network adapter or PPP link)
that connects it to a router or ISP. How do I configure my server
as a gateway, and how do I configure the other hosts on my LAN to
route external packets through the gateway server? Solution
A gateway server must have two network interfaces, and therefore
two ip addresses; one for each interface. One address will have
the same network id as the other hosts on the LAN. The other will
have the same network id as the dedicated router or Internet
Service Provider (that is, the machine that has the ability to
route packets beyond your LAN). See the picture below for
clarification. Each asterisk (*) represents a network interface
(Network adapter card or PPP link).LAN
-------
|
|
|----A * 132.147.144.32
|
|
|
|---132.147.144.55 * B * 210.34.56.15---/\/\/\/\/---210.34.56.17* D
|
|
|
|----C * 132.147.144.43
|
|
-------Machines A, B, and C are all on the 132.147.144 network. Machine B
is the gateway machine. It has two interfaces: one that connects
it to the 132.147.144 network; and another that connects it to
Machine D (the 210.34.56 network). Machine D is usually an ISP
or a hardware router. Either way, Machine D has the ability to
route packets over the Internet (or at least beyond the LAN).Before following the steps for configuring the server as a gateway, draw a picture of your network like the one above, filling in the appropriate IP addresses for your setup. With or without the picture, you will need to collect the following information:
1. The IP address of each network interface on the gateway machine. Using the example above, those would be:
132.147.144.55 (we will refer to this as the "gateway's LAN-side IP") 210.34.56.15 (we will refer to this as the "gateway's router-side IP")
2. The IP address of the ISP or router. In the example above, this
would be:210.34.56.17 (we will refer to this as the "router's IP")
The following steps use the IP addresses from the example above. You must substitute the values that apply to your gateway server and your router/ISP:
1. Log in as root on the gateway machine.
2. Add a default route to the dedicated router (or ISP).
# route add default 210.34.56.17 << The router's IP3. Turn on "ipforwarding" and "ipsendredirects" on the gateway machine:
# inconfig ipforwarding 1
# inconfig ipsendredirects 14. Change directories to /etc/rc2.d:# cd /etc/rc2.d5. Create a file called S99route (the "S" must be capitalized):
# vi S99route6. Add the following line to the file:
route add default 210.34.56.17 << The router's IPNOTE: If the IP address of your router (or ISP) changes, you will need to update this file to reflect the new IP address.
Your server has now been configured as a gateway. The next step is to configure each host on the LAN to use the server as a gateway. On each host on the LAN, you will need to:
1. Log in as root.2. Add a default route to the gateway server.
# route add default 132.147.144.55 <<the gateway's LAN-side IPIt is not necessary to create an S99route script on the hosts since the gateway server will be advertising its default route, and the host's routing table will be automatically updated.
LATER RELEASES: For OpenServer 5.0.6 onwards, configure the gateway by using TA113061, "In OpenServer 5.0.6, 5.0.7, routed does not start by default."
NOTES: This article is for basic gateway configuration only. If you are
subnetting on uneven octet boundaries, or doing internal routing,
search your documentation and/or the SCO Technical Article database
for networks, subnetting, and routing. See also
TA107569, "Where to add default route statement so it's included at boot-up."