LinuxQuestions.org
Review your favorite Linux distribution.
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-02-2014, 09:48 AM   #1
Cristiano Urban
Member
 
Registered: Jul 2013
Location: Gonars (UD), Italy
Distribution: Slackware 14.2 x86_64
Posts: 76

Rep: Reputation: 10
How to find a subnet behind nat?


Hy guys I've two questions to submit to you:

1) Is there a way to read the destination ip address of a tcp packet in transit between two hosts with nat enabled?

2) Is there a way to scan a subnet situated "behind a nat"?

Thank you in advance for your answers.
 
Old 06-02-2014, 03:18 PM   #2
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 3,340

Rep: Reputation: Disabled
1) You can see the current source or destination addresses of any IP packet in transit if you're able to sniff the traffic.

You won't be able to tell if the packet has been subject to NAT, with one exception: some application protocols make direct references to endpoint IP addresses, and in those cases the contents of the packet may reveal the NATed IP address. FTP does this (which is why NAT breaks FTP unless the NAT gateway has an FTP ALG), and so does SIP (which is why SIP clients usually have STUN support).

2) If the subnet is NATed because RFC 1918 addresses are being used (which is usually the case) then no, you typically won't be able to scan the subnet since there's no way to route packets to hosts in such networks.

By itself, NAT does nothing to prevent scanning or otherwise improve security. It is perfectly possible to NAT outbound traffic (with or without overloading) while still accepting inbound traffic to the IP network(s) behind the NAT gateway. However, if the network consists of non-routable addresses, there's no way to get the packets to the gateway in the first place.
 
Old 06-02-2014, 04:33 PM   #3
dkm999
Member
 
Registered: Nov 2006
Location: Seattle, WA
Distribution: Fedora
Posts: 407

Rep: Reputation: 35
To amplify on what Ser Olmy said, if your sniffing point is on the "private network" side of a NAT router, you will be able to see the (public) destination IP address, but if your sniffing point is on the public side, you won't.

An RFC 1918 address matches one of these patterns: 10.x.x.x, 172.16.x.x through 172.31.x.x, or 192.168.x.x. Any IP address in one of these ranges is not permitted as a destination on the public Internet, and will be filtered out by any well-behaved router. The way a NAT router works is to alter the source address of an outbound packet so that, when an Internet server responds, the reply will come to the public side of the NAT router. That router then looks up the target address in a side table it has kept, which recorded the substitution it has made, undoes that substitution to restore the intended target address on the private side, and forwards the reply to the correct computer.

This whole scheme was designed fairly carefully to make it impossible for a public-side host to discover anything about how the Network Address Translation was set up (thus its original name -- masquerading).
 
  


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 used to route RDP connection across subnet with NAT borgy95 Linux - Networking 5 10-14-2013 10:48 AM
NAT'ing a subnet for Internet access with IP tables rookiepaul Linux - Security 18 09-06-2010 05:47 PM
NAT'ing a subnet for Internet access with IP tables rookiepaul Linux - Networking 0 08-18-2010 05:16 AM
DNS Problem in subnet with NAT soroka2000 Linux - Networking 8 11-15-2006 04:40 AM
NAT'd subnet routing question ealpert1 Linux - Networking 10 05-19-2003 02:07 PM

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

All times are GMT -5. The time now is 10:17 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