Iptables-script: Difference between revisions
From OpenSimulator
Jump to navigationJump to search
imported>Phrearch mNo edit summary |
imported>Phrearch No edit summary |
||
| Line 1: | Line 1: | ||
==Descriptioon== | |||
This script will reroute all LAN->WAN traffic that's normally blocked(router loopback prevention). It solves the issue where only LAN-users OR WAN-users can connect, but not both. | |||
==Source== | |||
<source lang="bash"> | <source lang="bash"> | ||
#!/bin/sh | #!/bin/sh | ||
Revision as of 17:08, 4 May 2008
Descriptioon
This script will reroute all LAN->WAN traffic that's normally blocked(router loopback prevention). It solves the issue where only LAN-users OR WAN-users can connect, but not both.
Source
#!/bin/sh
wanip=`wget -qO- http://checkip.dyndns.org/ | sed 's|.* \([[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*\).*|\1|'`
lanip=`ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'`
echo "Rewriting iptables using $wanip(wan) and $lanip(lan)..."
iptables -t nat -A OUTPUT --dst $wanip -p tcp --dport 9000:9010 -j DNAT --to-destination $lanip
iptables -t nat -A OUTPUT --dst $wanip -p udp --dport 9000:9010 -j DNAT --to-destination $lanip