Listing 1. Port Forwarding, /etc/rinetd.conf

[ $KVERSION = "2.2" ] && {
# Set up Transparent proxy for X
# What we need is a combination of IP
# Masquerade and Transparent Proxy
# The trick is that incoming connections are
# routed as follows:
#       display         port    route to
#       hostname:0      6000    leave as is
#       hostname:1      6001    compaq(.218) port 6000
#       hostname:2      6002    laptop(.214) port 6000
#       hostname:3      6003    imac(.221) port 6000
# Note that this uses ipmasqadm from
# http://juanjox.linuxhq.com/
# We would like to use normal portforwarding,
# but that doesn't work
# without specifying the IP address. So
# instead, we use a two-step
# process of marking the connection request
# packets and then setting
# up the reverse masquerade
#ipmasqadm portfw -a -P tcp -L 0 6001 -R 172.25.5.218 6000
#ipmasqadm portfw -a -P tcp -L 0 6002 -R 172.25.5.214 6000
#ipmasqadm portfw -a -P tcp -L 0 6003 -R 172.25.5.221 6000
ipchains -A input -i eth0 -p TCP -y -d 0/0 6001 -m 1
ipmasqadm mfw -A -m 1 -r 172.25.5.218 6000
ipchains -A input -i eth0 -p TCP -y -d 0/0 6002 -m 2
ipmasqadm mfw -A -m 2 -r 172.25.5.214 6000
ipchains -A input -i eth0 -p TCP -y -d 0/0 6003 -m 3
ipmasqadm mfw -A -m 3 -r 172.25.5.221 6000
} || {
# rinetd
# redirect incoming connections to be served by
# internal hosts Configured in /etc/rinetd.conf
echo "rinetd started"
/usr/sbin/rinetd
}
[Listing of /etc/rinetd.conf]
0.0.0.0 6001 172.25.5.218 6000
0.0.0.0 6002 172.25.5.214 6000
logfile /var/log/rinetd.log