There are two different ways router learning routes to remote networks:
- Static Routes -- A network administrator enters them into the router manually.
- Dynamic Routes -- Learned by Routing protocols and added to the routing table.
Compared with static routing, dynamic routing have many advantages:
- Dynamic routing protocols can discover new networks and calculate the best paths to those networks with minimal input from the network admin.
- Dynamic routing protocols also help to quickly detect down networks and adjust the routing table accordingly. They'll do the same for changes in the network topology.
There are many advantages for static routing:
- Static routes can serve as an excellent bandage/tourniquet when a routing issue arises
- Static routes have no overhead, and can be used to keep a routing table "complete and concise"
The ip route command is used to create static routes, whether they be host routes, default routes, or a more-general route.
Some basic static routing IOS commands
To view the current routing table, use command "show ip route".
To get detailed executing information of IOS commands, use command "debug ip packet", to turn off the debug, use command "undebug all". A warning, in the real-world router, running "debug ip packet" could overload your router!
We use the command "ip route" to create a static route to a given host or destination network.
R1(config)# ip route 172.16.0.1 255.255.255.0 fa0/0
This tells the router that all the packets sending to network 172.16.0.1 with network mask 255.255.255.0 will be fowarded via the interface fa0/0.
R1(config)# ip route 172.16.0.1 255.255.255.01718.104.22.168
This tells the router that all the packets sending to network 172.16.0.1 with network mask 255.255.255.0 will be fowarded to the next router hop at address 172.16.1.100.
Default static routes specify the network where we can send data to that have no specific entry in the routing table.
To config default static route, set both the destination network and the mask to 0.
R1(config)#ip route 0.0.0.0 0.0.0.0 fa0/0