LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 06-10-2006, 06:08 AM   #1
MattijsR
LQ Newbie
 
Registered: Jun 2006
Posts: 3

Rep: Reputation: 0
router ip address


Hello all,


I'm looking for a solution for the following problem:

My server registers the internal ip address from the router when there is a connection from an external source.
But not always...

Here's my network setup:
ISP -- cablemodem -- router (PC with Coyote Linux) -- switch -- internal PC's (2x Windows workstations, 1x Fedora 5 server)

When I connect with SSH, mail or web from one of the workstations to the server, I get their ip's logged, but when I connect from outside the ip of the router is logged.

But on the other hand, in the mail Logwatch sends me, there are external ip's registered of people who fail to log in with SSH.

Some help resolving this problem would be apreciated.

Thanks,
Mitzi.
 
Old 06-11-2006, 09:31 AM   #2
Notwerk
Member
 
Registered: Apr 2005
Location: Jordan
Distribution: Debian (Sarge), Ubuntu (6.06)
Posts: 271

Rep: Reputation: 31
Your router is setup to DNAT SSH traffic to the server, right?

If this is the case (which IMHO, I strongly think is), then the server is acting exactly as it should.

DNATing changes the packets that arrive at the server so they seem to originate from the router, which is why the router's IP is being logged.

I have a very similar setup, but I run SSH on the router, and from there I get into the network and SSH to other machines.

Needless to say, when I login to the router the correct IP is logged, however, the other machines all log the IP of the router.
Code:
#iptables -nvL
Should show your iptables rules, look for rules in the NAT table (under POSTROUTING), with a "-j DNAT " to confirm this.

Happy hunting
 
Old 06-16-2006, 05:04 AM   #3
MattijsR
LQ Newbie
 
Registered: Jun 2006
Posts: 3

Original Poster
Rep: Reputation: 0
Thanks for the reply.


Well, everything was working perfectly...

Newbie me was still on the local network connecting trough the router to the server... This logged the IP of the router.
When I'm outside the local network, the external IP gets logged......

 
Old 06-16-2006, 05:12 PM   #4
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
Quote:
Originally Posted by Notwerk
DNATing changes the packets that arrive at the server so they seem to originate from the router, which is why the router's IP is being logged.
With all due respect, this is not what DNATing does. Destination Network Address Translation does just that --- change the destination address (and maybe port) of a packet.

So for example, consider that I have one public ip address (64.179.4.146) and have setup a simple private network (192.168.0.0/24). On said network, I have a gateway which connects to both the internet (64.179.4.146) and the network (192.168.0.1). I also have an ssh server (192.168.0.3). If I go outside and start using the internet from a different machine (64.233.167.147), I want to ssh into my own. So I send a packet to my other ip (64.179.4.146) with tcp port 22. Now it is recieved by my gateway/router on the public interface. The destination packet of the interface is obviously the public ip, but the router knows that the packet was not intended for itself. What it does is change the destination address from 64.179.4.146 to 192.168.0.3. So ssh should recieve a source address matching the foreign ip.

What you were describing above is called SNAT (Source Network Address Translation).
 
Old 06-17-2006, 01:41 AM   #5
Notwerk
Member
 
Registered: Apr 2005
Location: Jordan
Distribution: Debian (Sarge), Ubuntu (6.06)
Posts: 271

Rep: Reputation: 31
Thanx for your explanation, it is perfectly correct and the examples is easy to understand too

However, maybe my post was a little ambigious (but I think it was also correct):
Quote:
Your router is setup to DNAT SSH traffic to the server, right?
Quote:
DNATing [Ed: At the Router] changes the packets that arrive at the server so they seem to originate from the router, which is why the router's IP is being logged.
I hope this clears it up
 
  


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
Why does my ip address points to my router? The MJ Linux - Networking 2 05-15-2006 11:59 PM
How do I get external IP address of router... The_JinJ Linux - Networking 2 02-05-2005 07:43 AM
how to use my Ip address if having a NAT router poeta_boy Linux - Networking 5 04-17-2004 06:10 PM
IP address of broadband router... lnxkido Linux - Networking 5 12-31-2003 03:47 PM
IP address behind router intl99 Linux - Networking 5 08-21-2003 11:41 PM

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

All times are GMT -5. The time now is 12:54 PM.

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