Saturday, December 21, 2013

Network Mapping in Linux

1) How to get Default Gateway in linux:

:~$ route -n

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.3.1   0.0.0.0         UG    0      0        0 wlan0
192.168.3.0     0.0.0.0         255.255.255.0   U     9      0        0 wlan0

Then 192.168.3.1 is the default gateway (which resides in the router)

2) traceroute:

Gives echo response from every networking device that we go through.

e.g.:
~$ traceroute linkedin.com
traceroute to linkedin.com (216.52.242.86), 30 hops max, 60 byte packets
 1  * * *
 2  24.4.96.1 (24.4.96.1)  12.809 ms  18.279 ms  18.287 ms
 3  te-0-2-0-0-ur05.santaclara.ca.sfba.comcast.net (68.85.191.161)  18.279 ms  18.277 ms  18.271 ms
 4  te-1-1-0-10-ar01.sfsutro.ca.sfba.comcast.net (68.87.226.118)  25.134 ms te-1-1-0-1-ar01.sfsutro.ca.sfba.comcast.net (69.139.198.90)  25.115 ms te-1-1-0-0-ar01.sfsutro.ca.sfba.comcast.net (69.139.198.82)  25.056 ms
 5  he-3-8-0-0-cr01.sanjose.ca.ibone.comcast.net (68.86.94.85)  28.455 ms  28.475 ms  28.472 ms
 6  50-242-148-34-static.hfc.comcastbusiness.net (50.242.148.34)  45.187 ms  38.972 ms  37.976 ms
 7  vlan70.csw2.SanJose1.Level3.net (4.69.152.126)  47.620 ms  47.597 ms  47.543 ms
 8  ae-71-71.ebr1.SanJose1.Level3.net (4.69.153.5)  47.486 ms  44.121 ms ae-91-91.ebr1.SanJose1.Level3.net (4.69.153.13)  47.694 ms
 9  ae-2-2.ebr3.LosAngeles1.Level3.net (4.69.132.10)  44.047 ms  44.664 ms  44.634 ms
10  ae-73-73.csw2.LosAngeles1.Level3.net (4.69.137.38)  47.430 ms ae-93-93.csw4.LosAngeles1.Level3.net (4.69.137.46)  45.049 ms ae-63-63.csw1.LosAngeles1.Level3.net (4.69.137.34)  46.555 ms


The above command shows all the routers this command goes through to reach the server for linkedin.com. Above shows that linkedin have their main router in Los Angeles.

3) How to get address resolution protocol address:
~$ arp -n

4)How much time does it take to get response from a server/website:

dig archlinux.org | grep "Query time"

5)Who is on my network??

:~$ whowatch

The above is a utility which tells you people connected to the network.

6) Excellent article on loopback:
http://askubuntu.com/questions/247625/what-is-the-loopback-device-and-how-do-i-use-it

7) how to check devices (hosts) in your network:
nmap -w -sP 192.168.3.100/24
 


No comments:

Post a Comment