Which one is right command for static route?
You may have noticed that it’s the dynamic routing protocols that get all the glory. Since I like rooting (routing?) for the underdog, let’s talk about static routes! Show
As you may recall, a router has three methods for learning a route. A route can appear in the routing table if it is:
A static route is a route that manually inserted into the routing table. Static routes appear in the routing table as “S” routes, and are often used:
Static routes are created in global config mode, and require a destination prefix and a way to get there. For example, let’s say that our router’s Serial 1/1 interface, with an IP address of 192.168.1.5/30, has a point-to-point link to another router’s Serial 2/2, with IP address 192.168.1.6/30. We’ve been told that we can reach the 10.2.3.0/24 subnet via the neighbor router. To configure a static route, the command could be:
Note that the next hop address is our neighbor’s address (not ours). In the case of a point-to-point serial link, you also have the option of using the outbound interface, like this:
Note that when the interface option is specified, it’s our interface (not the neighbor’s). The interface option only works with point-to-point links, such as serial links running HDLC or PPP. The interface option will not work with multi-point interfaces, such as LANs, Frame Relay, or ATM. This is because the multi-point topologies require a Layer 2 address (MAC, DLCI, or VPI/VCI, for example), and it’s necessary to have the next-hop’s IP address to resolve this. If you configure a static route using the outbound interface on a multi-access link (such as Ethernet or Frame Relay), you won’t get a syntax error, but routing will fail. In fact, “debug ip packet” will reveal “encapsulation failed” for packets following that route, indicating that the router was unable to build the frame header due to lack of a Layer-2 destination address. You must use the “next-hop” option when configuring a static route on a multi-access media. Note that although they appear in the running config as soon as they are created, by default a static route will only be inserted into the routing table if the router believes that the next hop is actually reachable. In other words, for the static route to appear in the routing table, the interface used to reach the next hop must be “up/up”. Contrary to what you might read (including in some Cisco documentation), the default administrative distance (AD) for a static route is one, regardless of whether the next hop or outbound interface is used. By default, the only thing that beats a static route is a connected route, with an AD of zero. You can however, change the AD of a static route. Let’s say that your router is learning the route to 10.2.3.0/24 via OSPF, which has a default AD of 110. Now suppose that you configure a static route to 10.2.3.0/24 with an
AD of 250, like this:
If the link is point-to-point, you could also do it like this:
Note that the value following the next hop, or outbound interface, is the AD for the static route. Since when choosing a route it’s the low AD that wins, as long as the route is being learned by OSPF, it’s the OSPF route that will appear in the routing table (110 beats 250). If the OSPF route is no longer available, then the static route will appear in the routing table. This type of static route is referred to as a “floating” static route, and it is sometimes used for backup links. You can also specify a “tag” when configuring a static route. This is done by using the keyword “tag”, like this:
The tag can then be matched with a route map (a glorified access list that allows you to permit, deny, and change parameters of routing advertisements). And, of course, you can also specify a tag along with an admin distance:
Static routes have other options as well. No sense letting the dynamic protocols have all the fun! Author: Al Friebe For those of you who missed Parts 1 and 2 of my IP Addressing and Routing mini-series you can see the articles here:
I suggest taking a look at the first two parts before moving on to the third one, just because there is a lot of fundamental concepts and information that you will need to get a clear understanding of what I will be talking about in this part. For those of you who have been able to keep up with the first two parts, let's get started. As promised, today we are going to talk about different types of routing:
I'll start with an explanation of how you can setup static and default routing on your Cisco routers. I will also illustrate how you can use Administrative Distances in your static routes. Dynamic routing, as mentioned above, is a more advanced topic that requires a separate post -- I don't want to overload you with too much information right now. What You Must Know About RoutingFor those of you who did have the chance to go through my previous posts you will know by now that routers in order to be able to route packets to their final destination, need to maintain a routing table in which all the necessary information will be held. The information needed is simply a combination of networks and output interfaces on the router that can reach those networks. Each time a router receives a packet it inspects the destination IP address and tries to find, by looking in its routing table, a possible route to that IP address. Routers do not send broadcasts looking for the remote networks; therefore if a network is not listed in a routers table, the router simply discards the packets. Now how does a router maintain its routing table? The answer is pretty straightforward. Either manual route directions are configured on the router or dynamic protocols are used to populate routing information to routers. Static Routing Pros and ConsManually configuring routes on your router can be both beneficial and disadvantageous. Static routing has the following benefits:
Disadvantages of static routing include the following:
Getting Familiar with Static RoutingTo manually insert a static route into the Cisco routers routing table the following command syntax needs to be followed in global configuration mode: Let's take a look at each part of the static route command:
When to Use Default RoutingDefault routing is used only in stub networks. Stub are the networks that have only one output interface and everything going through these networks has to cross the single exit point. Instead of having many static routes pointing to remote networks via the single output interface, a single default route is configured that matches all possible routes. Using Administrative Distances in Static RoutesBy default, Static routes have an administrative distance (AD) of 1. ADs are used for prioritization purposes. Different routes, in a specific destination network can be assigned different weights so that one of the routes is used in favor of the other. Routes having the same weight load share the traffic. We will see in practice further on how we can change ADs in static routes. Putting Routing into PracticeLet's use an example to illustrate the configuration process for static and/or default routes. RouterA is directly connected to networks 195.14.25.40/30, 195.14.125.48/30 and 192.168.10.0/24. In order for RouterA to be able to route packets to all other networks the following static routes need to be configured on the router:
The configuration provided above is only one possible solution. A second solution could be defining a default route pointing to network 195.14.25.40/30 since RouterA is a stub router. Once this is configured, everything will be routed to that specific network. The command to configure this default route is:
You may have already noticed that we have two links connecting RouterA and RouterB together. If we wanted to share traffic between these two links then we could use the following set of commands:
Using the commands above, all traffic from RouterA is load shared between these two links (this is a load share per destination and not a 50-50 load sharing). In case we wanted one of the links as a backup, so that it will be activated only when the primary link goes down, then we could assign different Administrative Distances to the links like, the following:
The route with the lower AD (in our case AD=1) would be the primary route and the other would be the backup route (in our case AD=100). Guess What? The Rest is Up To You!So far, I've shown you how static routes/default routes/priority routes can be defined on RouterA. Still, RouterB and RouterC cannot fully route all subnets to each other and to RouterA. Similar configuration needs to be performed on the other routers as well. But I will leave that for you to carry out. Remember that routers only know about networks directly connected to them. Static routes or routes learned by dynamic protocols have to be configured in order for the routers to do their job: Routing packets of course. Also keep in mind that default routes are chosen when there is no specific match in the routing table to a given network. They are preferably used in stub networks. So go ahead and give this a try! Start by configuring either Static routes, or Default routes. You could even load share traffic when appropriate. And as always, feel free to leave me a comment if you run into any difficulties, or if you have any questions. Ready to test your skills in CISCO? See how they stack up with this assessment from Smarterer. Start this CISCO test now What is the command for static route?The ip-route command manages static routes in the routing table. Issue this command for each static route to add to the routing table. To delete a static route, use the no ip-route command. Issue this command for each static route to delete from the routing table.
What command is there to assign static route to router?Perform these steps to configure a default route.. Enter global configuration mode. device# configure terminal.. Enter 0.0. 0.0 0.0. ... . (Optional) Enable the default network route for static route next-hop resolution. ... . (Optional) Configure next-hop recursive lookup to resolve the next-hop gateway.. What is the correct command to configure a default static route?Use the ip route next-hop command to allow protocol resolution through the default route. If the default route itself is a static route, you must configure the ip route next-hop-enable-default command to resolve other static routes through the default route.
What are 4 types of static routes?The following types of IPv4 and IPv6 static routes will be discussed:. Standard static route.. Default static route.. Summary static route.. Floating static route.. |