LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   how to remote using iptables from outside (https://www.linuxquestions.org/questions/linux-networking-3/how-to-remote-using-iptables-from-outside-203376/)

dadi 07-10-2004 09:57 AM

how to remote using iptables from outside
 
Hello all,

I need to access my linux box in my office from outside, for sure i will need to access ssh and mysql port...

I've look around the net but it seems making me confuse.. or maybe it because I use a diffrent equipment ???

We are using a wireless connection internet, our ip is 202.x.x.x

the router ip is 192.168.5.1

and my server is 192.168.5.2

I'm sure what I need is do something with Iptables PREROUTING.. but I couldn't make it so far..

I really need this thing working asap, and I don't have much time to surf around the net.

So please can anyone help me... please...

thx :newbie:

keefaz 07-10-2004 10:13 AM

Your office router has to be set to forward ports 22 tcp and 3306 tcp from external ip to your office server.

ppuru 07-10-2004 10:17 AM

Asssuming your router is a linux system

you will need rules like

sbin/iptables -t nat -A PREROUTING -p tcp -i eth0 -d xxx.xxx.xxx.xxx --dport 22 -j DNAT --to <localip>:22
sbin/iptables -t nat -A PREROUTING -p tcp -i eth0 -d xxx.xxx.xxx.xxx --dport 3306 -j DNAT --to <localip>:3306

/sbin/iptables -A FORWARD -i eth1 -o eth0 -d <localip> -j ACCEPT


edit /etc/sysctl.conf, set

net.ipv4.ip_forward = 1

and run

#/sbin/sysctl -p

dadi 07-10-2004 10:58 AM

wow.. that was quick... thanks a lot for your help.. I'll try it tommorrow.. first thing in the morning...

thanks again...


All times are GMT -5. The time now is 03:25 AM.