Unix: Getting from here to there (routing basics)

You need to understanding routing tables if you're going to do any kind of network troubleshooting. Let's take a look at what Linux commands can tell you about how your system is making connections.

By  

The traceroute command does this by sending a number of echo request packets (like ping does) but with varying time-to-live (TTL) settings so that it can calculate the time that each hop requires. For example, for the first hop, the TTL is set to 1. For the second hop, it's set to 2, etc.

$ traceroute world.std.com
traceroute to world.std.com (192.74.137.5), 30 hops max, 40 byte packets
 1  * * *
 2  gig0-8.umcp-core.net.ums.edu (136.160.255.33)  2.634 ms  2.632 ms  2.610 ms
 3  ten2-0.stpaul-core.net.ums.edu (136.160.255.198)  3.515 ms  3.508 ms  3.486 ms
 4  te4-3.ccr01.bwi01.atlas.cogentco.com (38.104.12.17)  4.169 ms  4.163 ms  4.143
     ms
 5  te4-2.ccr01.phl01.atlas.cogentco.com (154.54.2.174)  6.268 ms  6.262 ms 
     te3-3.ccr01.phl01.atlas.cogentco.com (154.54.83.221)  6.950 ms
 6  te0-0-0-19.mpd21.jfk02.atlas.cogentco.com (154.54.2.110)  9.835 ms 
     te0-0-0-7.ccr22.jfk02.atlas.cogentco.com (154.54.31.53)  8.937 ms  8.925 ms
 7  te0-1-0-4.ccr22.bos01.atlas.cogentco.com (154.54.6.9)  14.768 ms 
     te0-2-0-6.ccr22.bos01.atlas.cogentco.com (154.54.44.58)  14.129 ms te0-1-0-    
     2.ccr21.bos01.atlas.cogentco.com (154.54.44.6)  14.740 ms
 8  te4-1.mag01.bos01.atlas.cogentco.com (154.54.43.50)  14.450 ms 
     te7-1.mag02.bos01.atlas.cogentco.com (154.54.7.42)  13.859 ms  
     te4-1.mag01.bos01.atlas.cogentco.com     
     (154.54.43.50)  14.816 ms
 9  vl3884.na31.b000502-0.bos01.atlas.cogentco.com (38.20.55.82)  18.336 ms  16.398
     ms  16.699 ms
10  cogent.bos.ma.towerstream.com (38.104.186.82)  13.925 ms  13.840 ms  13.720 ms
11  g6-2.cr.bos1.ma.towerstream.com (64.119.143.81)  21.495 ms  15.647 ms  15.458 ms
12  69.38.149.18 (69.38.149.18)  33.680 ms  33.602 ms  33.419 ms
13  64.119.137.154 (64.119.137.154)  31.961 ms  30.079 ms *
14  world.std.com (192.74.137.5)  34.695 ms  34.698 ms  34.159 ms

The ping command is popularly used to test connectivity with a remote system and verifies that you can (or can't) reach the remote system.

Route Caching

The route -Cn command displays routing cache information. This shows routes associated with active connections. Linux caches this information so that it can route packets faster.

route -Cn
Kernel IP routing cache
Source          Destination     Gateway         Flags Metric Ref    Use Iface
192.168.0.3     192.168.0.6     192.168.0.6     il    0      0       13 lo
192.168.0.6     204.111.97.254  192.168.0.1           0      0        0 eth0
192.168.0.6     204.111.97.254  192.168.0.1           0      2        0 eth0
192.168.0.6     204.111.97.254  192.168.0.1           0      0        4 eth0
192.168.0.6     192.168.0.3     192.168.0.3           0      1        0 eth0
204.111.97.254  192.168.0.6     192.168.0.6     l     0      0       79 lo

Rejecting connections

You can also specifically reject specific network connections using route commands.

Photo Credit: 

flickr / Ramkarthikblogger

Join us:
Facebook

Twitter

Pinterest

Tumblr

LinkedIn

Google+

Answers - Powered by ITworld

ITworld Answers helps you solve problems and share expertise. Ask a question or take a crack at answering the new questions below.

Join us:
Facebook

Twitter

Pinterest

Tumblr

LinkedIn

Google+

Ask a Question