PORT FORWARDING MINI HOWTO WITH LINUX 2.2.X

requires ipmasqadm

  • use portfw with ipmasqadm

    It's this easy... This is the script that I use to forward along HTTP traffic.

    #!/bin/sh
    ## BEGIN port forwarding
    SOURCE_IP=(your source IP goes here)
    SOURCE_PORT=(your source port goes here)
    DEST_IP=(your destination IP goes here)
    DEST_PORT(your destination port goes here)
    export SOURCE_IP SOURCE_PORT DEST_IP DEST_PORT
    /usr/sbin/ipmasqadm portfw -a -P tcp -L $SOURCE_IP $SOURCE_PORT -R $DEST_IP $DEST_PORT
    ## END SCRIPT
    

    This method works for SMTP, HTTP, or just about any other TCP/IP based protocal. If you want UDP, read the man page for ipmasqadm (hint.. it's -P). This simple script is only meant to get you started.

    Jeremy Brand <jeremy@nirvani.net>
    http://www.jeremybrand.com/Jeremy/Brand/Jeremy_Brand.html