LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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 03-12-2005, 07:54 PM   #1
burnt_toast
Member
 
Registered: Aug 2003
Distribution: RedHat (What else?)
Posts: 36

Rep: Reputation: 15
iptables port forwarding question


Hi...

I have an internal network at my home as well as at my office. At home, I use an iptables firewall (with masquerading enabled). I want to be able to access one of the machines on my internal home network from my workstation at my office. My work machine is also behind a firewall, but I don't have access to its configuration.

Here is the problem. I know I can create a chain on my home firewall to do port forwarding from all traffic coming from my work firewall. But I want to specifically only allow traffic from my internal work computer to my internal home computer.

Without having access to the configuration of my work firewall, I was wondering if there is a rule I can create on just my home iptables config that will do this?

Thanks
 
Old 03-12-2005, 10:26 PM   #2
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
Assuming that your work network performs Network Address Translation (NAT), this is not possible, as an incoming connection from any computer on your work network will have the same IP.

I would reccomend using a secure protocol, or performing SSH tunneling.
 
Old 03-13-2005, 08:55 AM   #3
burnt_toast
Member
 
Registered: Aug 2003
Distribution: RedHat (What else?)
Posts: 36

Original Poster
Rep: Reputation: 15
Quote:
I would reccomend using a secure protocol, or performing SSH tunneling.
Could you elaborate? Possibly point me towards some kind of howto or other documentation? What I had actually hoped to do was to do a remote desktop (rdp protocol) into my home windows machinewhen I need to. I already have this capability going the other direction (from home to work) as my work network is setup with secure VPN tunneling. However, I would have no clue how to set anything like this up from home.

Since I'm not running linux on the desktop (only on my router/firewall box) I don't know if this is the proper forum to ask this.
 
Old 03-14-2005, 10:04 PM   #4
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
It can still be done. Just google for "ssh tunneling". This way you can find one for both your SSH client and so forth.
 
Old 03-14-2005, 10:26 PM   #5
chbin
Member
 
Registered: Mar 2005
Distribution: slackware-current
Posts: 379

Rep: Reputation: 31
I would leave my computer on at home and go to work and ping the sh&t out of my home computer while at work. Then go home and look at the logs and see the work IP address. Take that IP and add a rule in iptable to forward only that ip and port 22 (i think that is what ssh) uses to whatever internal computer on my network I want to connect to. Then go to work and connect.
 
Old 03-15-2005, 07:19 AM   #6
burnt_toast
Member
 
Registered: Aug 2003
Distribution: RedHat (What else?)
Posts: 36

Original Poster
Rep: Reputation: 15
Well, that was going to be my solution, but then I thought how many people are behind my work firewall. I wanted to allow access from only my work machine...not every machine on my internal work network
 
Old 03-15-2005, 07:34 AM   #7
fr_laz
Member
 
Registered: Jan 2005
Location: Cork Ireland
Distribution: Debian
Posts: 384

Rep: Reputation: 32
Hi,

since your work machine is nated, you cannot identify it : that's NOT possible.
using ssh can involve using a username/password, that should be a good protection.
 
Old 03-15-2005, 07:58 AM   #8
chbin
Member
 
Registered: Mar 2005
Distribution: slackware-current
Posts: 379

Rep: Reputation: 31
There is no way to see beyond the gateway at work into the internal network from your home. You have to open it on the gateway IP addresses.. i.e. everyone at work. But someone at work would have to try to connect to your home IP in order to know... unlikely. And they still can't log in without a password. Oh the reason I told you to ping is because they might use more than one gateway.. 2 or 3 ip's would have to be forwarded in your iptables then.
 
Old 03-15-2005, 08:01 AM   #9
fr_laz
Member
 
Registered: Jan 2005
Location: Cork Ireland
Distribution: Debian
Posts: 384

Rep: Reputation: 32
you can also connect through ssh from work to home : next time you'll log in at home, you'll have the banner "Last login from xxx.xxx.xxx.xxx" ; unless you've changed thye default behaviour of sshd.
 
Old 03-15-2005, 08:26 AM   #10
chbin
Member
 
Registered: Mar 2005
Distribution: slackware-current
Posts: 379

Rep: Reputation: 31
Quote:
Originally posted by fr_laz
you can also connect through ssh from work to home : next time you'll log in at home, you'll have the banner "Last login from xxx.xxx.xxx.xxx" ; unless you've changed thye default behaviour of sshd.
Funny, he's question is on how to do that in the first place. If he could do that this post wouldn't exist.
 
  


Reply



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 port forwarding geoff3425 Slackware 13 12-20-2011 10:50 AM
IPCHAINS port forwarding and IPTABLES port forwarding ediestajr Linux - Networking 26 01-14-2007 07:35 PM
Question about iptables port forwarding <Ol>Origy Linux - Networking 3 05-21-2005 04:29 PM
Iptables -- Port Forwarding slack_baby Linux - Networking 3 06-03-2004 02:29 PM
Iptables port forwarding question Renfro Linux - Security 1 10-11-2003 07:42 AM

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

All times are GMT -5. The time now is 05:55 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
Open Source Consulting | Domain Registration