Auto-config question

Jason D. Giesbrecht jgiesbrecht@michetti.com
Tue, 26 Jun 2001 08:30:14 -0600


This is a multi-part message in MIME format.

------_=_NextPart_001_01C0FE4C.839566F0
Content-Type: text/plain;
	charset="US-ASCII"
Content-Transfer-Encoding: quoted-printable

This should work alrighty for ya =3D)  Figuring out how the syntax =
works..
man grep and man cut=20

EXTERNAL_IP=3D`ifconfig "$EXTERNAL_IF" | grep inet | cut -d : -f 2 | cut
-d \  -f 1`
EXTERNAL_LOCALMASK=3D`ifconfig "$EXTERNAL_IF" | grep Mask | cut -d : -f =
4`
EXTERNAL_LOCALNET=3D"$EXTERNAL_IP/$EXTERNAL_LOCALMASK"

Ciao


-----Original Message-----
From: Phil Barbier [mailto:p.barbier@online-bills.com]=20
Sent: Tuesday, June 26, 2001 8:15 AM
To: 'Netfilter Mailing List (E-mail)'
Subject: Auto-config question


Hi there all,=20
I have a cable modem connection that has a DHCP address, and the=20
lease from my ISP is renewed every two weeks.=20
I was wondering, instead of going through my ipmasqadm script every=20
time, and re-running it, is there a way I can grab the IP address from=20
the system (as the network card renews it self from the modem fine) and=20
then simply re-running the script will sort it all.=20
I imagine something like this:-=20
systemip=3D`ifconfig eth1` # This is the part I don't know...=20
ipmasqadm portfw -a -P udp -L $systemip 80 -R 192.168.56.3 80=20
ipmasqadm portfw -a -P udp -L $systemip 3128 -R 192.168.56.2 3128=20
instead of :-=20
ipmasqadm portfw -a -P tcp -L 111.111.111.111 80 -R 192.168.56.3 80=20
and so on...=20
I think something like this:- but not sure how to grep out the IP=20
from something like "ifconfig eth1"=20
systemip=3D`expr $ipaddr : '\([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*\)'`=20

Thanks,=20
Phil B.=20

------_=_NextPart_001_01C0FE4C.839566F0
Content-Type: text/html;
	charset="US-ASCII"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
6.0.4417.0">
<TITLE>RE: Auto-config question</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->

<P><FONT SIZE=3D2>This should work alrighty for ya =3D)&nbsp; Figuring =
out how the syntax works.. man grep and man cut </FONT>
</P>

<P><FONT SIZE=3D2>EXTERNAL_IP=3D`ifconfig &quot;$EXTERNAL_IF&quot; | =
grep inet | cut -d : -f 2 | cut -d \&nbsp; -f 1`</FONT>

<BR><FONT SIZE=3D2>EXTERNAL_LOCALMASK=3D`ifconfig =
&quot;$EXTERNAL_IF&quot; | grep Mask | cut -d : -f 4`</FONT>

<BR><FONT =
SIZE=3D2>EXTERNAL_LOCALNET=3D&quot;$EXTERNAL_IP/$EXTERNAL_LOCALMASK&quot;=
</FONT>
</P>

<P><FONT SIZE=3D2>Ciao</FONT>
</P>
<BR>

<P><FONT SIZE=3D2>-----Original Message-----</FONT>

<BR><FONT SIZE=3D2>From: Phil Barbier [<A =
HREF=3D"mailto:p.barbier@online-bills.com">mailto:p.barbier@online-bills.=
com</A>] </FONT>

<BR><FONT SIZE=3D2>Sent: Tuesday, June 26, 2001 8:15 AM</FONT>

<BR><FONT SIZE=3D2>To: 'Netfilter Mailing List (E-mail)'</FONT>

<BR><FONT SIZE=3D2>Subject: Auto-config question</FONT>
</P>
<BR>

<P><FONT SIZE=3D2>Hi there all, </FONT>

<BR><FONT SIZE=3D2>I have a cable modem connection that has a DHCP =
address, and the </FONT>

<BR><FONT SIZE=3D2>lease from my ISP is renewed every two weeks. </FONT>

<BR><FONT SIZE=3D2>I was wondering, instead of going through my =
ipmasqadm script every </FONT>

<BR><FONT SIZE=3D2>time, and re-running it, is there a way I can grab =
the IP address from </FONT>

<BR><FONT SIZE=3D2>the system (as the network card renews it self from =
the modem fine) and </FONT>

<BR><FONT SIZE=3D2>then simply re-running the script will sort it all. =
</FONT>

<BR><FONT SIZE=3D2>I imagine something like this:- </FONT>

<BR><FONT SIZE=3D2>systemip=3D`ifconfig eth1` # This is the part I don't =
know... </FONT>

<BR><FONT SIZE=3D2>ipmasqadm portfw -a -P udp -L $systemip 80 -R =
192.168.56.3 80 </FONT>

<BR><FONT SIZE=3D2>ipmasqadm portfw -a -P udp -L $systemip 3128 -R =
192.168.56.2 3128 </FONT>

<BR><FONT SIZE=3D2>instead of :- </FONT>

<BR><FONT SIZE=3D2>ipmasqadm portfw -a -P tcp -L 111.111.111.111 80 -R =
192.168.56.3 80 </FONT>

<BR><FONT SIZE=3D2>and so on... </FONT>

<BR><FONT SIZE=3D2>I think something like this:- but not sure how to =
grep out the IP </FONT>

<BR><FONT SIZE=3D2>from something like &quot;ifconfig eth1&quot; </FONT>

<BR><FONT SIZE=3D2>systemip=3D`expr $ipaddr : =
'\([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*\)'` </FONT>
</P>

<P><FONT SIZE=3D2>Thanks, </FONT>

<BR><FONT SIZE=3D2>Phil B. </FONT>
</P>

</BODY>
</HTML>
------_=_NextPart_001_01C0FE4C.839566F0--