2013年7月16日星期二

ip route 0.0.0.0 0.0.0.0 x.x.x.x fa0/1

Question:

Can someone explain Cisco 3560V2 Price about the below mentioned command ?

ip route 0.0.0.0 0.0.0.0 x.x.x.x(Nxt Hop IP)  fa0/1


Answer:

is there something in particular you want to know?
Static routes, in your case the default route, can be configured to point to a numerical next hop (IP address), an exit-interface, or -like your example shows- both:
ip route <network> <subnetmask> <numerical-next-hop>
ip route <network> <subnetmask> <exit-interface>
ip route <network> <subnetmask> <exit-interface> <numerical-next-hop>
The differences are explained in this document:
http://www.cisco.com/en/US/tech/tk365/technologies_tech_note09186a00800ef7b2.shtml

Dinesh Kumar Mariappan:
This is command for default route.. What ever packet received to the router it simply forward to fa0/1 interface or to next IP.

This is true as long as no more specific route for the destination exists.

There are situations, where the combination of exit-int and numerical next-hop is desired.
Let me give you an example.
Lets say you have an AS and use the IP address range 192.168.0.0/16.
Your default route points to 192.168.12.2

ip route 0.0.0.0 0.0.0.0 192.168.12.2

Now imagine that there's another route to the next-hop address 192.168.12.2, e.g. a discard route (just an example):

ip route 192.168.0.0 255.255.0.0 Null0

Do you know what happens when you disable the interface connecting 192.168.12.2 (say Fa0/0)?

interface FastEthernet0/0
      ip address 192.168.12.1 255.255.255.0
      shutdown

Because of the recursive nature of the this type of routes, there's still a valid route to 192.168.12.2:

R1#show ip route 192.168.12.2
Routing entry for 192.168.0.0/16, supernet
Known via "static", distance 1, metric 0 (connected)
Routing Descriptor Blocks:
* directly connected, via Null0

R1#show ip route
S*   0.0.0.0/0 [1/0] via 192.168.12.2
S    192.168.0.0/16 is directly connected, Null0


So the link is down, however, the default-route is still there.
This behavior changes if you add the exit-interface:

ip route 0.0.0.0 0.0.0.0 FastEthernet0/0 192.168.12.2
ip route 192.168.0.0 255.255.0.0 Null0

R1#show ip route

S    192.168.0.0/16 is directly Cisco 3560V2  connected, Null0

没有评论:

发表评论