Change font size
It is currently Sun Dec 15, 2019 10:56 am

Forum rules


{L_IMAGE}



Post a new topicPost a reply Page 1 of 1   [ 1 post ]
Author Message
 Post subject: Bash script for non-loopback Actiontec DSL modems.
PostPosted: Mon Jun 13, 2011 11:20 am 
Furious Typer

Joined: Tue Oct 28, 2008 4:53 pm
Posts: 172
This script is used on any system that has access to the DSL modem and runs under Linux ONLY!
2 packages must be installed first:-

1.....expect
2.....telnet

This script is for use ONLY on the Actiontec DSL modem/router (which does not have local loopback supported), the modem access username and password HAVE to be changed in order for this script to work.

This script also allows 11 regions, if more than 11 is required/needed, then change 9010 to the last port of the last region, EG, 20 regions = 9000:9019, assuming each region port runs consecutively, IE, 9000, 9001, 9002, 9003.........

The script also assumes the modem gateway IP is default 192.168.0.1.

The Actiontec modem does not retain any manually added iptables after a power outage or a modem reboot, hence this script.

Do NOT remove the \r on ANY of the lines.

Replace "login name" (do not remove quotes), with the modem access username.
Replace "login password" (do not remove quotes), with the modem access password.
Replace <host name> (including <> characters) with either the WAN IP, or a dynamic host name (EG. myhost.dyndns.org).
Replace <opensim server LAN IP> (including <> characters) with the LAN IP of the computer running opensim.

[NOTE]
The computer running opensim MUST have a static LAN IP address.

{L_CODE}:
#! /usr/bin/expect

spawn telnet 192.168.0.1
expect "BusyBox on (none) login:"
send "login name\r"
expect "Password:"
send "login password\r"
expect "#"
send "iptables -t nat -I PREROUTING --dst <host name> -p tcp --dport 9000:9010 -j DNAT --to-destination <opensim server LAN IP>\r"
expect "#"
send "iptables -t nat -I PREROUTING --dst <host name> -p udp --dport 9000:9010 -j DNAT --to-destination <opensim server LAN IP>\r"
expect "#"
send "iptables -t nat -A POSTROUTING --dst <opensim server LAN IP> -p tcp --dport 9000:9010 -j SNAT --to-source 192.168.0.1\r"
expect "#"
send "iptables -t nat -A POSTROUTING --dst <opensim server LAN IP> -p udp --dport 9000:9010 -j SNAT --to-source 192.168.0.1\r"
expect "#"
close


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 1   [ 1 post ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
610nm Style by Daniel St. Jules of Gamexe.net