[Gllug] Port forwarding with IP-tables

Alain Williams addw at phcomp.co.uk
Wed Mar 24 11:35:31 UTC 2010


On Wed, Mar 24, 2010 at 11:31:07AM +0000, t.clarke wrote:
> Hi,
> 
> I wonder if anyone who is proficient with iptables can advise what commands I
> need to use to set up the following:
> 
> I have a setup currently with a router connected to a Debian box on 192.168.1.2
> which is also connected to an internal 192.168.123.0 network.  Occasionally
> when the ADSL connection plays up it is necessary to reboot the router remotely.
> Currently to do this I have to telnet from home to the main server (on the
> internal network), then telnet to the Debian box, then telnet from there to
> to the router and then login to the router as 'root' and issue the reboot
> command. This works, although is tedious.  But the router immediately drops
> the telnet connection and I can't gracefully exit the 'chain' of telnets.
> 
> What I would like to do is simply telnet from the main server to the router
> by setting up port-forwarding on the Debian box so that, for example,  I
> can telnet to say port 4567 on the Debian box which port-forwards to port 23
> on 192.168.1.2
> 
> Any quick how-to-do guide would be most gratefully received

	iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 4567 -j DNAT --to-destination 192.168.1.2:23-23

-- 
Alain Williams
Linux/GNU Consultant - Mail systems, Web sites, Networking, Programmer, IT Lecturer.
+44 (0) 787 668 0256  http://www.phcomp.co.uk/
Parliament Hill Computers Ltd. Registration Information: http://www.phcomp.co.uk/contact.php
Past chairman of UKUUG: http://www.ukuug.org/
#include <std_disclaimer.h>
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list