Most networks will use one (or more) routing protocols to automatically share and learn routes. Listed below are several situations when you might want to configure static routes.
A default route is a route that is considered to match all destination IP addresses. With a default route, when a packet's destination IP address does not match any other routes, the router uses the default route for forwarding the packet. Be aware of the following default route details:
The following table lists the commands for configuring static routes:
Use . . . |
To . . . |
Router(config)#ip route <destination> <next_hop> |
Identify a next hop router to receive packets sent to the specified destination network. |
Router(config)#ip route <destination> <interface> |
Identify the interface used to forward packets to the specified destination network. |
Router(config)#ip route 0.0.0.0 0.0.0.0 <next hop or interface> |
Identify a default route to the specified destination network or through an interface. This is a method to set the gateway of last resort on a router. |
Router(config)#ip classless |
Enables the router to match routes based on the number of bits in the mask and not the default subnet mask. |
Router#show ip route |
View the routing table. |
Router#show ip route <hostname or address> |
View details about the specific route. |
Note: Configuring a static route to network 0.0.0.0 with mask of 0.0.0.0 is the most common method of configuring a default gateway. However, the following methods can also be used under certain circumstances:
Examples
The following command creates a static route to network 192.168.1.0 through the router with the IP address 192.168.1.35 and gives it an administrative distance value of 25.
Router(config)#ip route 192.168.1.0 255.255.255.0 192.168.1.35 25
The following command identifies a default route through an interface with address 10.1.1.2.
Router(config)#ip route 0.0.0.0 0.0.0.0 10.1.1.2
Credit: Testout 640-802 CCNA Notes
ไม่มีความเห็น