iptables port forwarding on dial-up connection
I have done this because I wanted to host a game of Live For Speed over a DSL-line. The following steps have to be applied:
- First thing to do is to enable IP-forwarding (obviously)
- Then we change the DESTINATION of packets coming in on ppp0
- Still the SOURCE of those packets points to some computer on the internet
#!/bin/sh
IF=ppp0
IPT=iptables
IPTNAT="$IPT -t nat -A"
PORT=63392
SERVER=insert_ip_here
GW=insert_ip_here
echo "Activating forwarding... beware!"
echo "1" > /proc/sys/net/ipv4/ip_forward
#$IPT --flush -t nat
# packets coming in from $IF are routed to $SERVER
$IPTNAT PREROUTING -p tcp --dport $PORT -i $IF -j DNAT --to $SERVER:$PORT
$IPTNAT PREROUTING -p udp --dport $PORT -i $IF -j DNAT --to $SERVER:$PORT
# before leaving those packets are modified to look as if they came
# from $GW, so the return packets from $SERVER find their way back to $GW
$IPTNAT POSTROUTING -p tcp --dport $PORT -d $SERVER -j SNAT --to $GW
$IPTNAT POSTROUTING -p udp --dport $PORT -d $SERVER -j SNAT --to $GW
$IPT -L -t nat -vn
Comments:
<< Home
This was a really interesting post about IPv4. I had no idea that they were such a big part of the internet. I want to learn more. I will have to do some more research! Maybe I can find some good information at the library.
Emily Smith | http://iptrading.com/sell-ipv4/
Emily Smith | http://iptrading.com/sell-ipv4/
I was searching online to get some help with hosting a game over my line. The steps you have shared here had been very helpful for me to complete the task.
Thanks. Hailey | IPv4Mall
Post a Comment
Thanks. Hailey | IPv4Mall
<< Home