<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <HTML> <HEAD> <META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9"> <TITLE>IPMasquerading+Napster mini-HOWTO: DYNAMIC IP AREA (Dial-up or DHCP)</TITLE> <LINK HREF="IPMasquerading+Napster-6.html" REL=next> <LINK HREF="IPMasquerading+Napster-4.html" REL=previous> <LINK HREF="IPMasquerading+Napster.html#toc5" REL=contents> </HEAD> <BODY> <A HREF="IPMasquerading+Napster-6.html">Next</A> <A HREF="IPMasquerading+Napster-4.html">Previous</A> <A HREF="IPMasquerading+Napster.html#toc5">Contents</A> <HR> <H2><A NAME="s5">5. DYNAMIC IP AREA (Dial-up or DHCP)</A></H2> <P>See this and the Procedure section if your IP address changes everytime you connect to the internet. <P>Thanks to Peter Illmayer for the following submission to me: (This will work out best for those of you with dynamic IP's...) <PRE> ------------------------------------------------------------ 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. --------------------------------------------------------------- </PRE> 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. <PRE> 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 </PRE> Of course the more machines using Napster behind your IPMasq'd machine the more port forwards you need to do. <HR> <A HREF="IPMasquerading+Napster-6.html">Next</A> <A HREF="IPMasquerading+Napster-4.html">Previous</A> <A HREF="IPMasquerading+Napster.html#toc5">Contents</A> </BODY> </HTML>