Home
Main website
Display Sidebar
Hide Ads
Recent Changes
View Source:
PPTPConnectionTracking
Edit
PageHistory
Diff
Info
LikePages
!!Symptoms: When behind a NAT firewall, you can't make a PPTP connection out from two internal macines to a single external server, or if you stop the connection from the first machine, you can't make a connection from another until 10 minutes is up. !!Problem: Netfilter doesn't know about the connection between a PPTP connection on TCP, and the portless GRE protocol. When you create a PPTP connection, a NAT table entry with a default 10 minute timeout is added. When you disconnect the PPTP, this connection is still running and has to time out before you can connect again. !!Solution Get a kernel that supports PPTP connection tracking. You have two options: * install 2.6.14 or higher, as it was [merged into the mainline|http://kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=926b50f92a30090da2c1a8675de954c2d9b09732] at this point * patch an older kernel and iptables with a patch provided by the Netfilter developers. !!With an older kernel Don't do this. Get 2.6.14. !!With 2.6.14+ If you're running 2.6.14.2 or lower, there are two patches on [this Netfilter bug|https://bugzilla.netfilter.org/bugzilla/show_bug.cgi?id=397] which you need to apply to your kernel. No changes should need to be made to iptables. Enable/module CONFIG_IP_NF_PPTP and CONFIG_IP_NF_NAT_PPTP; the modules are called ip_nat_pptp and ip_conntrack_pptp. Make sure that ip_nat_pptp and ip_conntrack_pptp are being loaded into the kernel if you are using kernel modules (CONFIG_IP_NF_PPTP=M). Use <verbatim> lsmod | grep -i pptp </verbatim> to check for the modules, and <verbatim> modprobe ip_nat_pptp </verbatim> and <verbatim> modprobe ip_conntrack_pptp </verbatim> to load the modules. If your testing works, then add the modules at boot by editing <verbatim> /etc/modprobe.conf </verbatim> and adding lines like this: <verbatim> insert ip_nat_pptp /bin/true insert ip_conntrack_pptp /bin/true </verbatim> I did the testing using tcpdump and a Windows XP PC. On the NAT box, run tcpdump: <verbatim> /usr/sbin/tcpdump -i any -n -nn host IP_ADDRESS_OF_PPTP_SERVER or host IP_ADDRESS_OF_TEST_PC and not port 22 </verbatim> The <verbatim> and not port 22 </verbatim> is used to drop SSH traffic if you are using the TEST_PC or PPTP_SERVER to secure shell into the NAT box, otherwise it isn't required. That is all you have to do. !!With an older kernel - "I Didn't Listen" Grab a snapshot from http://ftp.netfilter.org/pub/patch-o-matic-ng/snapshot/ and untar it into a directory. They no longer support this patch, and you might find you have to get an older version of the p-o-m source to make this work. Be prepared to read mailing lists. You also need some iptables source, so you could use the one in the version you will build below. Read that and return here. <verbatim> $ cd /path/to/patch-o-matic/ $ export KERNEL_DIR=/usr/src/linux-2.6.10/ $ export IPTABLES_DIR=/tmp/iptables-1.2.10 $ $ ./runme pptp-conntrack-nat </verbatim> Select 'y' to apply the patch. I like to edit the Makefile to set EXTRAVERSION to -vpn as I also apply ipsec patches to my VPN kernels. Now, configure and build the kernel as usual - use make oldconfig to ask questions relevant to the new patch (answer Y or M to anything related to PPTP or GRE). Build your kernel (using make-kpkg(1) if you're on [Debian]) and go for it. !Update iptables When you've changed your kernel, the size of some structures change, so you have to recompile the userspace iptables(8) tool to match this. * If you build from source it's easy, and you can probably do it yourself. * If you're using Debian, the easiest thing to do is download the "latest" iptables source from packages.debian.org and rebuild it. If you're still running Woody, you will need to use the Sarge package (which will work). On Sarge/Hoary: <pre> $ mkdir /usr/src/iptables/ $ cd /usr/src/iptables $ apt-get source iptables $ tar -zvxf iptables_1.2.11-10.tar.gz (sub version numbers as appropriate) $ cd iptables_1.2.11 $ vim scripts/prep.sh </pre> Add "pptp-conntrack-nat" to the line that lists __pomng_extensions__. <pre> $ dch -v 1.2.11-10itp1 Add your comment; this increments the package version number. $ dpkg-buildpackage -uc -us -rfakeroot </pre> You should end up with a iptables_1.2.11-10_i386.deb in the previous directory. Note, this version of iptables and this kernel are married together. You can't use an unpatched iptables with a patched kernel, etc. These next two steps are to give you an IPTABLES_DIR for pom on the kernel, as above: <pre> $ cd /tmp $ tar -zvxf /usr/src/iptables/iptables-1.2.11/upstream/iptables-1.2.11.tar.bz2 </pre>
2 pages link to
PPTPConnectionTracking
:
FirewallNotes
PPTP