LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 01-31-2010, 01:19 PM   #1
carolus
Member
 
Registered: Feb 2008
Posts: 45

Rep: Reputation: 15
is there a traceroute-like tool that shows ports as well as IP addresses?


Is there some traceroute-like tool that shows ports as well as IP addresses?

This is more for seeing how NAT works (on my home network) than for a practical need.
 
Old 01-31-2010, 01:23 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,962
Blog Entries: 11

Rep: Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865
not that I'm aware of ... you can always script it and use
a combo of traceroute and nmap to get what you asked for.
 
Old 01-31-2010, 01:38 PM   #3
carolus
Member
 
Registered: Feb 2008
Posts: 45

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Tinkster View Post
you can always script it and use
a combo of traceroute and nmap to get what you asked for.
Can this tell which ports are being used for a specific connection? For example, which ports on my router are being used for this connection to LinuxQuestions? And if I am simultaneously connected to LinuxQuestions from another computer on my network, what ports does that connection use? The IP address for both local computers is the same, so NAT in the router must be fudging the ports.

Skimming the man page for nmap, it does not appear capable of tracking a given connection the way that traceroute does.
 
Old 01-31-2010, 01:43 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,962
Blog Entries: 11

Rep: Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865
Ummm ... I'm confused.

I assumed that when you asked about tracerout and ports you wanted
to know which ports are open on machines along the route.

If you want to know what ports your local machine uses for which
connection use
Code:
netstat -tdn
(for all tcp and udp ports in numeric representation)

And no, an external tool won't be able to tell which ip & port
a connection is going to from a different machine. Only the
router itself could do that (or if you stuck a Linux box in
between the router and the others as a packet sniffer).

Last edited by Tinkster; 01-31-2010 at 01:45 PM.
 
Old 01-31-2010, 02:08 PM   #5
carolus
Member
 
Registered: Feb 2008
Posts: 45

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Tinkster View Post
an external tool won't be able to tell which ip & port
a connection is going to from a different machine. Only the
router itself could do that (or if you stuck a Linux box in
between the router and the others as a packet sniffer).
traceroute will give the IP's but not the ports. I have both a wireless router (under my control) and a combination DSL modem-router (supplied and configured by the ISP) and I would like an external way of viewing how the two routers in series are handling NAT by fudging the ports. I was hoping there might be an easy and educational way.

Last edited by carolus; 01-31-2010 at 02:09 PM. Reason: clarity
 
Old 01-31-2010, 02:15 PM   #6
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
You may prefer looking at "netstat -tdp". It will show the protocols, domain names and the program (such as firefox) that the traffic is for.

If you use "netstat -tdpc", the output will be continuous. Did you look at the netstat output? It lists the destination address, local address and the ports. As suggested you could run

Since you are interested in how networking works, learning these tools is probably where you want to start. There is an excellent book "Network Administrators Guide" on the www.tldp.org website.

Also, this site http://www.grc.com/nat/nat.htm explains how NAT routers work including having two NAT routers in series.

NAT doesn't fudge ports. It records the source IP, destination IP and port, then then changes the outgoing packets source IP to that of your ISPs assigned address. While the source IP address is mangled, the destination IP address isn't changed. That is how you can have two NAT routers in series.

Quote:
The IP address for both local computers is the same
Be sure to study what a TCP header looks like. It has source and destination IP addresses and ports.

Last edited by jschiwal; 01-31-2010 at 02:47 PM.
 
  


Reply

Tags
nat, traceroute


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
LXer: traceroute - a very useful troubleshooting tool which reveals the bottlenecks on the Internet LXer Syndicated Linux News 0 01-18-2007 12:33 PM
Sheilds up shows opened ports with Firestarter? badmofo666 Linux - Security 4 01-02-2007 01:53 AM
What these IP addresses shows about my ISP!!! b0nd Linux - Networking 5 12-31-2005 09:43 PM
What file in /etc shows the number of ports? thatgentleman Linux - General 2 03-22-2002 10:38 PM
traceroute comes up with some wierd ip addresses ForumKid Linux - Security 1 02-01-2002 12:13 PM


All times are GMT -5. The time now is 08:07 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration