GNU/Linux Command – IP (Part-4)

ip — Manipulate network device, routing and tunnels

Summary:
The ip is a swiss army knife command. It does many functions like assigning IP addresses to interfaces, for setting up routes and display configurations etc. In this part, we will see some of the Routing table management using the IP command. Read the man page to know more about other routing table options.

Examples:

$ ip route -- Show the routing table 
$ ip route show -- Same as above. 
$ ip route show to 192.168.1.0/24 -- Show routes matching the TO 
  prefix. 
$ ip ro show src 192.168.1.0/24 -- Show routes matching the SRC 
  prefix.
$ ip ro show cloned -- Show all cloned routes. 
$ ip ro show cached -- Show all cached routes. 
$ ip ro show dev eth0 -- Show routes related to device eth0. 
$ ip r get 209.85.153.104 -- Get the route to google.co.in. 
# ip ro add default via 192.168.1.1 -- Add default route. 
# ip ro add 10.1.1.0/24 via 192.168.1.1 -- Add route to 
  10.1.1.0 thru 192.168.1.1 
# ip ro change 10.1.1.0/24 dev eth1 -- Redirect the route thru
  device eth1. 
# ip ro add 10.1.2.0/24 via 10.1.1.1 mtu 1400 -- Set the MTU 
  of this path is 1400. 
# ip ro del default -- Delete the default route. 
# ip ro del 10.1.1.0/24 -- Delete a route entry. 
# ip ro del to 10.0.0.0/8 -- Delete the matching entries. 
# ip ro flush all -- Flush all the entries. 
# ip ro flush cache -- Flush all the cached entries. 

Read: man ip

Advertisements
Tagged with: ,
Posted in Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: