[Tutor] How can I do IP_MASQ by using Python?

Wenlong Liu gege@nst.pku.edu.cn
Mon, 29 Apr 2002 21:03:14 +0800


This is a multi-part message in MIME format.

------=_NextPart_000_0678_01C1EFC1.4701A020
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Re: [Tutor] How can I do IP_MASQ by using Python?MGCP is Media Gateway =
Control Protocol. IETF RFC 2705
http://www.ietf.org/rfc/rfc2705.txt?number=3D2705

The Media Gateway Control Protocol (MGCP) is a signaling protocol for =
controlling Voice over IP (VoIP) Gateways from external call control =
elements across the Internet.  The protocol itself make extensive use of =
network addresses located inside the message body, since that it is =
impossible to use MGCP through basic network address translation/network =
address port translation without an Application Level Gateway (ALG).

A MGCP message is identified by the ALG using UDP port 2427 or 2727 as =
the destination port.  Actually the specified port number should be =
configurable. Most NAT implementations identify the type of traffic they =
will modify by using the port as an identifier, so this restriction =
seems practical.

Regards

Ares
  ----- Original Message -----=20
  From: dman=20
  To: tutor@python.org=20
  Sent: Monday, April 29, 2002 3:05 AM
  Subject: Re: [Tutor] How can I do IP_MASQ by using Python?


  On Sun, Apr 28, 2002 at 03:22:40PM +0800, Ares Liu wrote:=20
  | I want to transfer MGCP packages via NAT. Not so much flux, so I =
think I=20
  | can use python to do it. Does anyone can give me some advises?=20

  I don't know what MGCP is, but all the times I've seen the terms=20
  IPMASQ or NAT it is referring to the IP stack of a system.  The IP=20
  stack is in the kernel and requires access to the kernel to adjust how =

  the routing and NAT will operate.  With linux the netfilter modules=20
  provide the actual implementation and the userspace tool 'iptables'=20
  provides an interface for the admin to configure it.=20

  Maybe if you can explain MGCP and what you want to do with it a bit=20
  more I'll understand whether or not python is suitable for the task.=20

  HTH,=20
  -D=20

  --=20

  Python is executable pseudocode. Perl is executable line noise.=20
   =20
  GnuPG key : http://dman.ddts.net/~dman/public_key.gpg=20


------=_NextPart_000_0678_01C1EFC1.4701A020
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Re: [Tutor] How can I do IP_MASQ by using =
Python?</TITLE>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2715.400" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>
<DIV><FONT face=3DArial size=3D2>MGCP is Media Gateway Control Protocol. =
IETF RFC=20
2705</FONT></DIV>
<DIV><FONT face=3DArial size=3D2><A=20
href=3D"http://www.ietf.org/rfc/rfc2705.txt?number=3D2705">http://www.iet=
f.org/rfc/rfc2705.txt?number=3D2705</A></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV>
<P class=3DIndentNormal style=3D"MARGIN: 0cm 0cm 6pt 18pt"><SPAN =
lang=3DEN-US><FONT=20
face=3DArial>The Media Gateway Control Protocol (MGCP) is a signaling =
protocol for=20
controlling Voice over IP (VoIP) Gateways from external call control =
elements=20
across the Internet.<SPAN style=3D"mso-spacerun: yes">&nbsp; </SPAN>The =
protocol=20
itself make extensive use of network addresses located inside the =
message body,=20
since that it is impossible to use MGCP through basic network address=20
translation/network address port translation without an Application =
Level=20
Gateway (ALG).</FONT></SPAN></P><SPAN lang=3DEN-US><FONT face=3DArial>
<P class=3DMsoNormal style=3D"MARGIN: 0cm 0cm 6pt 18pt"><SPAN =
lang=3DEN-US>A MGCP=20
message is identified by the ALG using UDP port 2427 or 2727 as the =
destination=20
port.<SPAN style=3D"mso-spacerun: yes">&nbsp; </SPAN>Actually the =
specified port=20
number should be configurable. Most NAT implementations identify the =
type of=20
traffic they will modify by using the port as an identifier, so this =
restriction=20
seems practical.<?xml:namespace prefix =3D o ns =3D=20
"urn:schemas-microsoft-com:office:office"=20
/><o:p></o:p></SPAN></P><o:p></o:p></FONT></SPAN></DIV></FONT></DIV>
<DIV>Regards</DIV>
<DIV>&nbsp;</DIV>
<DIV>Ares</DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <DIV style=3D"FONT: 9pt &#23435;&#20307;">----- Original Message ----- =
</DIV>
  <DIV style=3D"BACKGROUND: #e4e4e4; FONT: 9pt &#23435;&#20307;; =
font-color: black"><B>From:</B>=20
  <A title=3Ddman@dman.ddts.net =
href=3D"mailto:dman@dman.ddts.net">dman</A> </DIV>
  <DIV style=3D"FONT: 9pt &#23435;&#20307;"><B>To:</B> <A =
title=3Dtutor@python.org=20
  href=3D"mailto:tutor@python.org">tutor@python.org</A> </DIV>
  <DIV style=3D"FONT: 9pt &#23435;&#20307;"><B>Sent:</B> Monday, April =
29, 2002 3:05 AM</DIV>
  <DIV style=3D"FONT: 9pt &#23435;&#20307;"><B>Subject:</B> Re: [Tutor] =
How can I do IP_MASQ by=20
  using Python?</DIV>
  <DIV><BR></DIV>
  <P><FONT size=3D2>On Sun, Apr 28, 2002 at 03:22:40PM +0800, Ares Liu=20
  wrote:</FONT> <BR><FONT size=3D2>| I want to transfer MGCP packages =
via NAT. Not=20
  so much flux, so I think I</FONT> <BR><FONT size=3D2>| can use python =
to do it.=20
  Does anyone can give me some advises?</FONT> </P>
  <P><FONT size=3D2>I don't know what MGCP is, but all the times I've =
seen the=20
  terms</FONT> <BR><FONT size=3D2>IPMASQ or NAT it is referring to the =
IP stack of=20
  a system.&nbsp; The IP</FONT> <BR><FONT size=3D2>stack is in the =
kernel and=20
  requires access to the kernel to adjust how</FONT> <BR><FONT =
size=3D2>the=20
  routing and NAT will operate.&nbsp; With linux the netfilter =
modules</FONT>=20
  <BR><FONT size=3D2>provide the actual implementation and the userspace =
tool=20
  'iptables'</FONT> <BR><FONT size=3D2>provides an interface for the =
admin to=20
  configure it.</FONT> </P>
  <P><FONT size=3D2>Maybe if you can explain MGCP and what you want to =
do with it=20
  a bit</FONT> <BR><FONT size=3D2>more I'll understand whether or not =
python is=20
  suitable for the task.</FONT> </P>
  <P><FONT size=3D2>HTH,</FONT> <BR><FONT size=3D2>-D</FONT> </P>
  <P><FONT size=3D2>-- </FONT></P>
  <P><FONT size=3D2>Python is executable pseudocode. Perl is executable =
line=20
  noise.</FONT> <BR><FONT size=3D2>&nbsp;</FONT> <BR><FONT =
size=3D2>GnuPG key : <A=20
  href=3D"http://dman.ddts.net/~dman/public_key.gpg"=20
  target=3D_blank>http://dman.ddts.net/~dman/public_key.gpg</A></FONT>=20
</P></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_0678_01C1EFC1.4701A020--