Problem
Getting started with Network Address Translation on SCO OpenServer 5.
Solution
The IP Filter software was included in SCO OpenServer 5.0.6 which includes the ability to translate (NAT) IP address(es) from one address range to another IP address or range of IP addresses. For earlier releases of SCO OpenServer, you will need to install IP Filter which can be obtained from:
https://ftp.scoexpert.com/TLS/tls709.ltr
https://ftp.scoexpert.com/TLS/tls709.tar.ZA detailed guide on using IP Filter and NAT can be obtained from:
http://www.obfuscation.org/ipf/The basic syntax of the ipnat command for clearing out current map rules and loading a new map file is:
/etc/ipnat -CF -f <map file>To view the currently loaded maps/filters and monitor active mappings, use:
/etc/ipnat -lThe following are some map file examples that can be used to provide certain common NAT functionality:
Note: You can have multiple rules set up and NAT will select the first one that applies.
Note: The second map field refers to the interface that we are translating the IP address(es) through (usually the public interface with the valid IP address).
1. Map any traffic coming from the 192.168.1 subnet to 20.20.20.1:
map ppp0 192.168.1.0/24 -> 20.20.20.1/322. Map any traffic coming from the 192.168.1 subnet to the dynamic IP assigned to your ppp0 interface:
map ppp0 192.168.1.0/24 -> 0/323. Map any traffic coming from 192.168.1 to the dynamic IP assigned to your ppp0 interface and change the source port numbers to something between 10000 and 60000:
map ppp0 192.168.1.0/24 -> 0/32 portmap tcp/udp 10000:600004. Map the single IP address 192.168.1.1 to 20.20.20.1:
bimap net0 192.168.1.1/32 -> 20.20.20.1/325. Map any traffic coming from the 192.168 subnet to the pool of IP address in the 20.20.20 subnet and change the source port numbers into something between 20000-60000:
map net0 192.168.0.0/16 -> 20.20.20.0/24 portmap tcp/udp 20000:600006. Map any tcp traffic from the 192.168 subnet to 20.20.20.1 and change the source port number to something between 10000 and 20000. For all other IP packets, allocate an IP address between 20.20.20.0 and 20.20.20.255:
map net0 192.168.0.0/16 -> 20.20.20.1/32 portmap tcp 10000:20000 map net0 192.168.0.0/16 -> 20.20.20.0/24
NOTES: Your system must be set up to route packets between its interfaces.
To verify that this has been done, run the following command:# inconfig ipforwardingwhich should return:inconfig: symbol ipforwarding has current value 1, minimum 0, maximum 1
If the current value is 0, run the following to enable ipforwarding:
# inconfig ipforwarding 1Note: Depending on your network configuration, you may also want to enable ICMP redirects (inconfig ipsendredirects 1).
If you configured the system to be a router (Gateway) through the SCOadmin Network Configuration Manager (netconfig), both ipforwarding and ipsendredirects will be enabled.
See also
Manual pages ipnat(ADMN), ipnat(SFF), ipmon(TC), ipf(ADMN),
inconfig(ADMN)The official IP Filter Web site:http://coombs.anu.edu.au/~avalon/ip-filter.html