Linux Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsLinux Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 29th, 2003, 01:54 AM
Galewind Galewind is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2002
Location: Phoenix
Posts: 42 Galewind User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Port forwarding dilemna

I'm using a Debian Linux system as a router for my cable connection, using iptables. I'm forwarding some ports for certain programs to work correctly & I've run into a problem.
I just started using a laptop as my primary system & I'm trying to figure out how to forward those ports to the correct IP address whether I'm using the wired NIC or the wireless card. Now, of course each network interface is assigned a different IP by the DHCP server (also running on the Linux router), so I'm not sure what can be done to accomplish the port forwarding. Does anyone have ideas?

EDIT: I'm currently running Windows XP Pro on the laptop, BTW.

Reply With Quote
  #2  
Old June 29th, 2003, 11:40 AM
alexgreg's Avatar
alexgreg alexgreg is offline
Full Access
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Jun 2000
Location: London, UK
Posts: 2,019 alexgreg User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 sec
Reputation Power: 11
Quote:
Now, of course each network interface is assigned a different IP by the DHCP server

Your DHCP server should allow you to always assign certain IP addresses to certain MAC addresses, so that the laptop always gets the same IP address. See the documentation for your DHCP server for details.
__________________
Alex
(http://www.alex-greg.com)

Reply With Quote
  #3  
Old June 29th, 2003, 09:01 PM
Galewind Galewind is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2002
Location: Phoenix
Posts: 42 Galewind User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
I think you misunderstood my question. I have 2 separate interfaces, each with a separate MAC address. If they were the same, that would certainly be the best way to go.

Reply With Quote
  #4  
Old June 30th, 2003, 03:28 PM
alexgreg's Avatar
alexgreg alexgreg is offline
Full Access
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Jun 2000
Location: London, UK
Posts: 2,019 alexgreg User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 sec
Reputation Power: 11
Quote:
I have 2 separate interfaces

A port can only be forwarded to one address. You can change this address quite easily using iptables, though.

Reply With Quote
  #5  
Old June 30th, 2003, 03:52 PM
M.Hirsch M.Hirsch is offline
Contributing User
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: Oct 2000
Location: Back in the real world.
Posts: 5,969 M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 22 h 39 m 55 sec
Reputation Power: 184
I think it *is* possible.
How are you managing your routing right now? To automatically switch to another interface once it comes available, you probably already have some kind of dynamic routing setup.

It could work like this (untested):
- setup a dummy interface on the router with an IP that is unused but on the same network as the router and your laptop.
- make your services listen to the dummy IP address / forward the ports to this one (maybe forward again to the "real" destination then)
- setup the dynamic routing to use either interface to connect to it (the dummy)

Plz tell us your results.
__________________
--
Manuel Hirsch - Linux, FreeBSD, programming, administration articles, tutorials and more.

Reply With Quote
  #6  
Old July 1st, 2003, 01:28 AM
Galewind Galewind is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2002
Location: Phoenix
Posts: 42 Galewind User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Quote:
Originally posted by M.Hirsch
It could work like this (untested):
- setup a dummy interface on the router with an IP that is unused but on the same network as the router and your laptop.
- make your services listen to the dummy IP address / forward the ports to this one (maybe forward again to the "real" destination then)
- setup the dynamic routing to use either interface to connect to it (the dummy)

That sounds like a quite sensible solution, M. I'm not entirely sure how to execute it, though.
I would assume this dummy interface would be best set up using IP aliasing? Would you suggest making it an additional node on my existing 192.168.1.0 network, or setting it up as an additional network on 192.168.2.0?
Also, how would you go about forwarding an already-forwarded port?

As for routing, I'm at a pretty basic level. The auto-switching of the interfaces is done by Windows software on the laptop. It monitors the wired ethernet port for a connection & switches the wireless on or off as necessary.

I really appreciate the time you've taken to think about this.

Reply With Quote
  #7  
Old July 1st, 2003, 12:23 PM
M.Hirsch M.Hirsch is offline
Contributing User
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: Oct 2000
Location: Back in the real world.
Posts: 5,969 M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 22 h 39 m 55 sec
Reputation Power: 184
Quote:
I would assume this dummy interface would be best set up using IP aliasing? Would you suggest making it an additional node on my existing 192.168.1.0 network, or setting it up as an additional network on 192.168.2.0?
Also, how would you go about forwarding an already-forwarded port?

Thinking about it again, a dummy interface is probably not of much help in your case. It is useful for using 2 nics, one at a time, but not for port forwarding. With my idea you would have needed a dummy interface on the laptop, not on the router.

Instead you could use a extended version of "rinetd", this is a daemon that does something similar to port forwarding. Extended version because the rinetd that i know does not allow to say "if not available, use this instead" and can use TCP only.

Using windows on the laptop is a big obstacle here. Because the longer I think about it, the more I get the feeling you have to do most of this on your laptop, not on the router...

Quote:
As for routing, I'm at a pretty basic level. The auto-switching of the interfaces is done by Windows software on the laptop. It monitors the wired ethernet port for a connection & switches the wireless on or off as necessary.

I thought I had the idea with the dummy interface from the Linux High Availability Howto, but I just had a short glance at it and they are using another approach (with a heartbeat-ping every second to bring one interface down and another one up once the heartbeat does not go through anymore. This sounds similar to what you told about your windows software)

Make a little test:
- unplug the ethernet cable
- ping the laptopīs ethernet cardīs IP from the router.
Does it pong? (I tested with my linux router and it does. But my workstation has only one nic...)
if yes - problem solved.
if no, activate routing on the laptop. (donīt ask me how to do that on windows )
Still no? - post back, Iīll think of a solution (other than "FORMAT C: /U" )

Last edited by M.Hirsch : July 1st, 2003 at 12:28 PM.

Reply With Quote
  #8  
Old July 2nd, 2003, 01:08 PM
Galewind Galewind is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2002
Location: Phoenix
Posts: 42 Galewind User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Quote:
Originally posted by M.Hirsch
Make a little test:
- unplug the ethernet cable
- ping the laptopīs ethernet cardīs IP from the router.
Does it pong? (I tested with my linux router and it does. But my workstation has only one nic...)
if yes - problem solved.
if no, activate routing on the laptop. (donīt ask me how to do that on windows )
Still no? - post back, Iīll think of a solution (other than "FORMAT C: /U" )

Should I get a response to the ping or no response?

Reply With Quote
  #9  
Old July 2nd, 2003, 01:16 PM
M.Hirsch M.Hirsch is offline
Contributing User
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: Oct 2000
Location: Back in the real world.
Posts: 5,969 M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 22 h 39 m 55 sec
Reputation Power: 184
I hope you do get a response. If the XP machine answers to requests to the Ethernet NICīs IP coming from the WLan NIC with the help of some internal routing, it should be working now.

Reply With Quote
  #10  
Old July 2nd, 2003, 05:58 PM
MRK's Avatar
MRK MRK is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2001
Posts: 191 MRK User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 36 sec
Reputation Power: 8
Um....... If your using both the wired nic and the wireless card on the same laptop, and if you arent going to be using them at the same time, why not just assign both cards the same *STATIC* ip address?

-Mr.K

Reply With Quote
  #11  
Old July 2nd, 2003, 06:51 PM
Galewind Galewind is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2002
Location: Phoenix
Posts: 42 Galewind User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
I'd considered that & I might be stuck with it. I was trying to avoid any reconfiguration between running the laptop at home & at work.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsLinux Help > Port forwarding dilemna


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway