1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
|
IP Autoforward for Linux kernels 2.0.0 - June 28, 1996
Written by Richard Lynch (rlynch@scoot.netis.com)
This patch allows linux masquerading available in the 2.0.0 kernel to work
with programs such as RealAudio which don't send out a packet on all ports
they wish to receive on.
For the curious, the patch works by adding an entry to the kernel
masquerading table (viewed from /proc/net/ip_masquerade) whenever a packet
is received on a given range of ports. Normally, the masquerading code
takes care of this, but it can only do so if the masqueraded host first
sends a packet on one of those ports. Programs like RealAudio only send
packets out on one port (7070) and expect to receive packets on a wide range
of ports (6970-7170 inclusive). Without the patch, any packet received on a
port other than 7070 would be discarded.
The patch only needs to be installed on old kernels (i.e. < 2.0.32).
The patch is installed by going to the linux kernel directory, doing a
"patch -p1 < /whereever/ipautofw/2.0.0/ipautofw-2.0.0.diff" and
recompiling. On newer kernels, all you need to do is enable experimental
code and enable ipautofw support when you configure the kernel.
Next, compile the control program by doing a "make" and "make
install" Finally add the configuration commands to your /etc/rc.d/rc.inet1
or /etc/rc.d/rc.local. They should be in the following format:
ipautofw -A -r <proto> <low> <high> [-h <hiddenhost>] [-c <ctltype> <ctlport>]
The <proto> parameter should be either tcp or udp, depending on the type of
packet that will be received (generally udp). <low> and <high> specify the
range of ports which should be forwarded to <hiddenhost>. <ctltype> and
<ctlport> are optional parameters to replace the -h option to determine which
host packets should be sent to. When ever a connection is opened to port
<ctlport>, protocol <ctltype>, the IP address of that host is saved and
will receive packets on the specified ports.
Here's an example installation/configuration:
cd /usr/src/linux
patch -p1 < /usr/local/src/ipautofw/2.0.0/ipautofw-2.0.0.diff
make mrproper
make config
make dep
make clean
make zlilo
cd /usr/local/src/ipautofw/2.0.0
make
make install
Then add the following line to either /etc/rc.d/rc.inet1 or
/etc/rc.d/rc.local
/sbin/ipautofw -F
/sbin/ipautofw -A -r udp 6970 7170 -c tcp 7070
The ipautofw line sets up linux to forward packets on udp ports 6970-7170
inclusive to the last masqueraded host which sent a tcp packet on port 7070
(RealAudio's control connection).
After adding the lines, reboot and the masqueraded machines should be able
to use RealAudio!
Help on additional parameters is available by running ipautofw without any
parameters. Please don't use single port redirection yet (-p), it won't work
and might even make your system a little unstable.
The following is a listing of some common programs which need an ipautofw
entry:
RealAudio:
tcp 7070
udp 6970-7170
Internet Phone:
udp 22555
StreamWorks:
udp 8000
PowWow:
tcp 13223
WebPhone:
tcp 21845
udp 21845
Note: I haven't tested all these apps, I'm copying the list from the slirp
documentation which has some common configurations listed. Some may work,
some may not.
John Fulmer (jfulmer@blanket.com) has also been able to get ipautofw to
redirect X sessions. He accomplished this by redirecting tcp ports 6000-6100
to the masqueraded machine running X windows and using udp port 177 and tcp
ports 23 and 6000 as the control ports. Here are the commands he's using to
get it to work.
/sbin/ipautofw -A -r tcp 6000 6100 -c tcp 23
/sbin/ipautofw -A -r tcp 6000 6100 -c udp 177
/sbin/ipautofw -A -r tcp 6000 6100 -c tcp 6000
Please direct any questions regarding X windows to him as I have little
experience with X.
He has also determined that RealAudio for Linux uses an unusual port range,
udp ports 1024-2048. This is probably a bug that will go away, but if anyone
else is running RealAudio for Linux and the default port range, 6970-7170,
doesn't work, you might want to try 1024-2048. The following command
implements that:
/sbin/ipautofw -A -r udp 1024 2048 -c tcp 7070
Many thanks to John Fulmer for his help.
If you have any questions or comments about the patch, or especially if
you're having trouble getting the patch to work, please let me know at
rlynch@scoot.netis.com (it's hard to fix a problem I don't know exists). I
just rewrote the readme file today and I've started rechecking the patch
today so I'd really appreciate any input you may have on how things are
working and if the readme file still makes sense.. Updates should be
available from ftp://ftp.netis.com/pub/members/rlynch/
|