IPMasquerading+Napster mini-HOWTO: DYNAMIC IP AREA (Dial-up or DHCP)

Next Previous Contents

## 5. DYNAMIC IP AREA (Dial-up or DHCP)

See this and the Procedure section if your IP address changes everytime you connect to the internet.

Thanks to Peter Illmayer for the following submission to me: (This will work out best for those of you with dynamic IP's...)

    ------------------------------------------------------------
    IN debian, I created a forward file in /etc/ppp/ip-up.d and put in

    #!/bin/sh
    ppp_ip="`/sbin/ifconfig ppp0 | grep 'inet addr' | awk '{print $2}' | sed -e
    's/.*://'`"
    /usr/sbin/ipmasqadm portfw -f
    /usr/sbin/ipmasqadm portfw -a -P tcp -L ${ppp_ip} 6702 -R 192.168.0.2 6702

    This is in a 2.2.x kernel with ipmasqadm installed with the appropriate
    kernel modules compiled in.
    ---------------------------------------------------------------

Charles J. Fisher pointed out that a similar script can be used if you are using DHCP, insert the following lines in a script that runs after you get your IP address.

    net_ip="`ifconfig eth0 | awk '/inet/ {sub(/addr:/,"",$2); print $2}'`"
    /usr/sbin/ipmasqadm portfw -f
    /usr/sbin/ipmasqadm portfw -a -P tcp -L ${net_ip} 6702 -R 192.168.1.2 6702

Of course the more machines using Napster behind your IPMasq'd machine the more port forwards you need to do.

Next Previous Contents