LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 07-10-2004, 09:57 AM   #1
dadi
LQ Newbie
 
Registered: Mar 2004
Posts: 10

Rep: Reputation: 0
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
 
Old 07-10-2004, 10:13 AM   #2
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,230

Rep: Reputation: 724Reputation: 724Reputation: 724Reputation: 724Reputation: 724Reputation: 724Reputation: 724
Your office router has to be set to forward ports 22 tcp and 3306 tcp from external ip to your office server.
 
Old 07-10-2004, 10:17 AM   #3
ppuru
Senior Member
 
Registered: Mar 2003
Location: Beautiful BC
Distribution: RedHat & clones, Slackware, SuSE, OpenBSD
Posts: 1,791

Rep: Reputation: 50
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

Last edited by ppuru; 07-10-2004 at 10:27 AM.
 
Old 07-10-2004, 10:58 AM   #4
dadi
LQ Newbie
 
Registered: Mar 2004
Posts: 10

Original Poster
Rep: Reputation: 0
wow.. that was quick... thanks a lot for your help.. I'll try it tommorrow.. first thing in the morning...

thanks again...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
iptables: if connected to localhost, forward to remote ip sl_king Linux - Networking 4 08-19-2005 06:52 PM
iptables and remote desktop gontarski Linux - Networking 3 04-05-2005 06:15 PM
iptables and remote desktop in fedora 3 lucas4ever Linux - Security 3 01-06-2005 02:37 AM
fordwarding remote desktop through iptables dlm4444 Linux - Security 4 01-04-2005 09:30 PM
Restricting XWindows remote connections (iptables) Harpune Linux - Networking 4 02-17-2004 06:03 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 05:00 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration