70. Static Routing – Part 2
Let’s continue our discussion on static routing. So here we have the three routers, router one, two and three. And here we have the IP addresses of the interfaces of these routers. Router two has a connected network. And similarly, router three also has a connected network, which is one to 168.3.0/24. Now, let’s say we need to add a route on router one that points to one nine eight two one six dead 3.0/24, which is connected to router three. What would the route look like? We know what the destination will look like. The destination will be 190 to 168, 3.0/twenty four. But what will be the next hop IP address? Well, we could configure the next top IP address as the router that knows how to get there. In this case, it is 190 to 160 at one . twelve, which is router three. We could configure it that way. So the configuration looks like this. The destination is 192, 168.3.0/24. It’s a static route. And the next hop IP address is the router that knows how to get there, which is one nine to 168, one . 12th.
But this configuration has a problem. The next top IP address, 190 to 168, one . 12 is not a directly reachable IP address. If the next top IP address is not directly reachable, there is an additional configuration that we need to make. Let’s talk about it. By default, Junos requires that the next hop IP address of static routes be reachable using a direct route. Unlike software from other vendors, Junos does not perform recursive lockups of next hops by default. This behavior can be changed by using the results. Keyword. So when you’re configuring a static route with a next top IP address, that is not a directly reachable IP address. You must include the keyword resolve in your configuration. In addition to using the resolve option, a route to the indirect next hop is also required because otherwise Junos will not know how to reach the next top IP address. So it’s a two step process. So when you’re adding a route that has a indirect next top IP address, you must include the key would result and you must make sure there is a route that allows Junos to reach the next top IP address.
So going back to the configuration, this is how you would normally configure that froud under the edit routing options hierarchy, we would set a static route for the destination one 90 to 168.3.0/24. And we would provide the next top IP address, which is one ninety to 168, one . twelve. But since the next top IP address is not directly reachable, we’ll need to update this configuration to include the result. Keyword. Also, keep in mind, we will need to add a route on router one that allows it to reach the next top IP address. In this case, the route will be pointing to router two because router two knows how to get to one to 160 at one . twelve. So two things to configure. Add the result keyword and add a route pointing to the indirect next top IP address. Now, let’s talk about the no re advertize option, static routes are eligible to be advertised that is exported from the routing table into dynamic routing protocols. If a policy to do so has been configured.
This means static routes configured on your device can be shared by the routing protocols running on your device with their neighbors. So static routes can be advertised by the routing protocols to its neighbors. Sometimes you may not want to do this. So to mark an IPv4 static route as being ineligible for re advertisement. We need to include the no re advertize statement. It is recommended to use the no re advertise option on static routes used for management traffic. So let’s say you have a static route on your device that allows management traffic to flow in. This route is exclusively used for management purposes. There is no other traffic flowing on this. This is a route that you typically don’t want to advertise on the network because that is only used for management purposes. That is a good candidate for using the no re advertise option. Let’s take a look at this on the Junos terminal.
All right, I’m here at the Junos terminal. I’ll first enter the edit routing options hierarchy and we’ll start with a show. So here’s the static route that we configured, also set static route and then the destination. And if we do a question mark here, you’ll notice we have the option called no re advertise. This will mark the route as ineligible to be re advertised. Also, notice we have the option called resolve. This is the option that we talked about earlier. Back over here. Let’s consider a scenario. So we have a router, router one which has a connected network, and this router has two parts to reach the Internet. Let’s say it has two connections from two different service providers. They decided to use one as the primary connection. And the other one as a backup connection. The primary connection has this IP addressing two hundred . one, . 1.0/30. And the interface on the Internet side is . one. The interface on the router side is . too to and for the secondary connection.
The IP address range is two hundred ., one ., one . force left 30 on the Internet side or on the service provider side. It is . five. And on the router side, it’s a . six. When you have a setup like this, which connection will router one used to reach the Internet? Both these routes are configured as static routes, which means they both have the same preference value. So which connection will be used to send traffic to the Internet? Let’s talk about this. A static route can have multiple next hops associated with it. In the example that we saw, the destination was for the Internet, which is 0.0.0.0 slices 0. And we saw that the router had two ways to reach the Internet. So when you have multiple next hops associated with a destination, multiple routes are inserted into the routing table and Junos must make a route selection. By default, Junos chooses in a random fashion.
One of the next top addresses to install into the forwarding table. This is very important to remember from the examination perspective. By default. When you have multiple Patts having the same preference value, Junos will perform a random selection. That qualified next top feature allows you to configure multiple next top IP addresses for a root and have them treated differently. It allows you to specify a different preference value for the qualified next hop. So this is how we’ll configure this. Let’s say we want to ensure that the primary connection is always used and the secondary connection is used as a backup. In this case, we can configure it like this under the edit routing options. Iraqi will set the static route to the destination 0.0.0.0 0. The next top IP address is 200 . wondered one . one, which is the IP address on the primary link. And then we use the keyword qualified. Next HOP, which has a next hop IP address of two hundred . one, not one . five. This is from the secondary connection. But for this one, we change the preference value. We know that the default preference value for a static route is five, but for the qualified next top, we are setting the preference as seven. With a configuration like this, router, one will always use two hundred ., one ., one . one at the next top IP address. If that fails, it will switch to the secondary link, which is 200 at one . one, . five.
Some vendors also refer to this concept as a floating static route. Let’s now talk about route retention by default, static routes are not retained in the forwarding table when the routing process shuts down. For example, when the device is rebooted. When the routing process starts up again, any routes configured as static routes must be added to the forwarding table. Again. This can cause latency to avoid this. Routes can be configured as written, causing them to be kept in the forwarding table even after the routing process shuts down. Retention ensures that the roots are always in the forwarding table, even immediately after a system reboot. So if you have a route that must always be kept in the forwarding table, even if the routing process shuts down, we can use the retain key keyword to make sure it is always retained in the forwarding table. Back to the Junos terminal here. I’m under the added routing options hierarchy and the command we are using is set static route.
And when I do a question mark here, you will notice that we have this keyword here called Retain that allows us to always keep the route in the forwarding table. Back over here. Let’s talk about passive road. When a static road’s next hop IP address is unreachable. The route is marked as passive and it is removed from the routing or forwarding tables. Mocking a route as passive will force the route to be included in the routing table regardless of the next hop reach ability. If the route is flagged as passive and its next top IP addresses unreachable, the route is included in the routing table and all traffic designed for the route is rejected. So marking a route as passive will force the device to include that proud in the routing table, regardless of the next hop reach ability. But if the next top IP address is unreachable, the route is still going to be included in the routing table. But it will not be possible to forward the traffic because the next top IP address is unreachable. In this case, all traffic designed for that network will be rejected because the next top is unreachable. So back over here, when we do sex static roud. Destination. And when we do a question mark, we have this option called passive, which allows us to retain inactive routes in the forwarding table. So the key takeaways from this video are the use of results qualified? Next, top retain and passive keywords while configuring static routes.
71. Dynamic Routing
Let’s now talk about dynamic routing. So static routing works well for smaller networks or when you need tight control over routing. But for large networks, static routing is hard to manage. And the reason is that when you have a large network, you’ll have a lot of routes that need to be added, deleted or updated, which makes it difficult to manage this with static routing. For large networks or networks that change frequently, dynamic routing is a better choice. With dynamic routing, you can figure out the network interfaces of the device to participate in the routing protocol. Devices running routing protocols can dynamically learn routing information from each other. When there is a change on the network, routing information is automatically updated. So unlike static routing, where you’re providing the destination address and the next top IP address with dynamic routing. All you need to do is configure the network interfaces to participate in your routing protocol. And the interfaces will exchange routing information with other routers participating in the routing protocol.
The advantages of dynamic routing is that it is easy to configure because devices learn routing information, automatically eliminating the need for manual routing entries. It also provides increased network availability. So when the routes change or when droughts fail. Dynamic routing will automatically detect this and reroute the traffic. Automatically. It also provides better network scalability. When the network grows, new routes will be automatically learned. While dynamic routing has all these benefits or advantages, an important thing to keep in mind is that dynamic routing has associated costs because they advertise routes, they consume bandwidth, and because they rely on the transmission and receipt of routing information to build a routing table. Dynamic routing protocols have a delay between the time the router is powered on and the time during which the routes are imported into the routing table. So that’s an important thing to keep in mind that would dynamic routing. You do have some associated costs and there will be a bit of delay because the device has to learn the routing information and build the route table. What static routes, you do not have bandwidth costs and there is no root import latency.
Before we talk more about dynamic routing, we need to understand a term called Autonomous System and Autonomous System is a collection of routers under a common administrative domain. Typically, it’s a collection of devices commonly managed by the same organization or network administrator. Sometimes it’s also called as routing domain. Dynamic routing protocols can be classified into two types. The first one is exterior gate. We have protocols. And the second one is interior gate, where protocols. Routing protocols used for routing between autonomous systems, meaning from one autonomous system to another autonomous system, which is also referred to as inter autonomous system routing. These are called as exterior gateway protocols, also known as e.g. piece. An example is Border Gateway Protocol. Border Gateway Protocol is the AGP used on the Internet. In fact, it’s the only AGP used on the Internet. On the other hand, routing protocols used for routing inside an autonomous system, which means within an autonomous system, which is also known as intra autonomous system routing, are called as interior gate, where protocols also known as IGP is. Examples include rip routing information, protocol, open shortest path first.
Oh, SPF Interior, Gateway Routing Protocol, IJI, et, etc.. Intricate Web protocols can be further classified as distance vector and links state routing protocols. So here’s a diagram to understand the difference between peace and peace. We have four outers connected to each other. And these four outers belong to an organization. Since these routers are managed within the same organization, it’s referred to as an autonomous system. Let’s say this is a 100. Similarly, on the right hand side, we have another organization having its own collection of routers. And it is is 200. These organizations talk to each other over the Internet. Extreme gateway protocols are used for communication between the autonomous systems. Interrogate are protocols are used within the autonomous system. So EDP is a used for communication between the autonomous systems and IGP, so used for communication within the autonomous systems. Let’s not talk about the two types of IGP. Let’s start with distance vector routing protocol. Routers that share a link and are configured to use the same routing protocol are called as neighbors. The term neighbors is not specific to a distance vector routing protocol. It is a generic term used to explain routing.
So routers that share a link and are using the same routing protocol are called as neighbors with distance vector routing protocols. Routing updates are shared only with neighbors. Routing updates include what is known as a distance vector, which is typically expressed as the number of hops to the destination. Routing updates are flooded out. All protocol enabled interfaces at regular intervals. The router only knows about its own interfaces and the remote network that can be reached through its neighbors. The router is not aware of the network topology. So the key features is that with distance vector routing protocol, a router will only share routing updates with its neighbors. Routing updates are flooded out all the enabled interfaces. And this is done periodically or at regular interfaces. The router is only aware of its own interfaces and the remote network that can be reached through its neighbors. But the router is not aware of the entire network topology.
Now, let’s talk about Lync state routing protocol with LINQ, state routing protocol routers have a complete view of the network topology. Also known as showed us Pat first protocols, links to protocols compute the best path to each destination. Routing updates are shared with all routers. Unlike distance vector routing protocol, we’re routing updates are only shared with the neighbors. In this case, routing updates are shared with all routers that are participating in the protocol. Routing updates are sent only when there is a change on the network and only the changes are sent. This is again different from the distance vector routing protocol with distance vector protocol. Routing updates are prebiotic, but with links, state routing protocol routing updates are only sent when there is a change on the network and convergence time is less compared to distance vector protocols. From the JND CIA examination standpoint, it is important to remember the key features of dynamic routing, the different types of dynamic routing protocol, which is e.g. Piece and IGP and the different types of IJI piece, which is Distance Vector and Lagu State routing protocol.
72. Longest Route Matching
Now let’s talk about an interesting topic. Longest route matching. Before we understand how the longest route is selected, let’s begin with a simple routing example. Let’s say we have a router called Router eight, which is connected to three other routers router B, router AC and router D and here is the routing table of router eight. So in the first column, we have the different destination addresses. In the second column, we have the root type and in the third column we have the next hop. So if Router H receives a packet that belongs to this network, which is ten .1.1.0/24, it will forward the packet to router b. If it receives a packet that is on this network, it will forward it to router C. And similarly, if it receives a packet that is destined for this network, which is 190 216.1.0/24, it will forward the packet to router D. So as an example, if router it receives a packet that is destined to ten .1.1.5, this packet will be forwarded to router B because that’s the matching route. And similarly, if it receives a packet that is destined to 192.160 at 1.10, it will forward the packet to router D because that is the matching route. With this understanding. Now, let’s talk about longest route matching.
Longest route matching is an algorithm used by routers to select an entry from a routing table. This is only used if multiple routes exist to a destination. In the example that we looked at earlier, we had different distinct routes. But what if we had two routes pointing to the same destination? In that case, how would the router make a selection? And that’s when longest route matching is used. So it’s used if multiple routes exist to the same destination. The way this works is that the router uses the longest match to determine the next hop address. So the routing entry that has the longest number of network bits that match the destination is the best match. Let’s understand this with an example. We have the same scenario. We have router eight, which is connected to three of the routers B, C and D, and the routing table looks like this. Let’s start with the last round, which is 192.168.0.0/16. The next hop is router D and the next route is 192.168.1.0/24.
The next hop is router C and the last route is 192.168.1.64/26 and the next hop is router B. As you can see, these are overlapping routes and to determine the next hop router, it would need to use the longest route matching algorithm. So let’s take a look at an example. Let’s say a router receives a packet that is destined for 192.168.1.70. In this case, all the routes match this packet 192.168.1.70 could belong to this network and this network and this network as well. So to determine the next hop router, it will use the longest drought matching algorithm, which says that the entry with the longest number of network bits that matched the destination is the best match. Let’s try this. So here I have a table that contains two columns. On the left side, we have all the addresses, and on the right side we have the binary representations. The first address 192.one 61.70 is the address of the packet or the destination address of the packet. And here is the binary representation for that address. I’ve put that in yellow because that is the one that we need to compare against. Let’s start with the bottom. Let’s start with 192.160 80.0. last 16. Here is the binary representation.
And when we compare this representation with the representation of the destination, we can see that these bits are matching. These bits are exactly the same as the bits of the destination. Now you might think that these bits are matching as well, but remember we are just going to match the network bits. So 192.168.0.0/16. We have 16 network bits, so that’s what we’re going to match. So we have 16 matching bits over here. If you look at this one here, 192.168.1.0/24. The binary representation of this network here has these matching bits. We could go up to here because this is also a matching bid with the destination, but we must only match the network bit, which in this case is 24 bits. And if we look at the last routing entry, which is 192.168, 1.64/26. If you look at this binary representation, we can see that 26 bits are matching with the destination IP address. So clearly this route here has the most number of matching network bits and that is the routing entry that will be used by router eight. So back over here to the diagram for this destination, 190 to 160 at 1.70, the routing entry that has the maximum number of matching network bits is the first one here. So the packet will be forwarded to router B.
73. Routing Instances
Let’s now talk about routing instances. What is a routing instance? Well, a routing instance is a collection of routing tables, interfaces and routing protocol parameters. The default routing instance, also known as the master routing instance, uses the main eyen, it does see where routing table. So simply put, a routing instance is a group of routing tables and its associated interfaces. On any Junos device, you will have at least one routing instance, the master routing instance, to which all interfaces and routing tables belong. There can be multiple routing tables for a single routing instance. And we’ve seen this earlier. For example, we have a round table for unicast IPv4. We have a round table for unicast IPv6. We may also have a round table for multicast, IPv4. And they all exist in the same routing instance, which is the master routing instance. Each routing instance has a unique name and a corresponding IP unicast table. For example, if you can figure a new routing instance with the name my instance, the corresponding IP unicast table will be called my instance.
I net DDC 0. When talking about routing instances, a question that comes to mind is why should we create additional routing instances? Well, by using routing instances, a single device can effectively imitate multiple devices. Let me explain with an example. So here we have a Junos device and this device has seven interfaces. This device only has the default routing instance, which is the master routing instance. Now, let’s say we can figure an additional routing instance that contains the four interfaces that you see on the right side. By doing this, we have configured the Junos device to behave like two separate devices. The last four interfaces is one routing instance, and the first three interfaces is another routing instance. Well, let’s say we have two customers to manage and we need to make sure that the routing information of one customer is not exchanged with another customer. By creating two routing instances, it’s like having two different devices. They can be managed separately and the routing information from one routing instance will not be shared with another routing instance. So effectively, we can manage two customers with one Junos device. Surrounding instances make the Junos device very flexible. Every routing instance consists of the following. It has its own routing tables. It has interfaces that belong to these routing tables.
And it has its own routing configuration. An important thing to keep in mind is that only one instance of a routing protocol can be configured in a single routing instance. Which means we can only have one instance of RIP or one instance of, oh, SPF running within a single routing instance. Now let’s get to the Junos terminal and understand how to configure this. All right, I’m here at the Junos terminal. Let’s first start with the command run show route. I’m in the configuration mode, which is why I have prefixed my command with the run keyword run show route. And you can see here we only have the default routing instance. I need 0 and I need six start 0. They belong to the default routing instance. To view the routing instances, we can use the command run show route instance. And that will show us the routing instance in this case. We only have the master routing instance. Let’s now configure an additional routing instance. The configuration is really simple. We’ll start with edit and the keyword is routing instance, routing instances. And then we need to provide a routing instance name. Let’s call this one as our one. So now we are in the configuration mode for that routing instance. Let’s start with question mark, search based question mark.
And here we can specify the routing instance type routing instances have several different types. In fact, over here we have 12 different types of routing instances that we can configure. And every routing instance type has a specific purpose. Right now, I’ll configure the instance type as virtual router, which is one of the most commonly used routing instance types. Press enter. Let’s do set space question mark. And we can also add interfaces over here. The keyword is interface. I’m going to add one interface over here. Set Interface G 0 0 one 0. And that’s all the configuration we need at this point to create the routing instance. We’ve set the instance type and we’ve set the interface. I’ll go to the top and perform a commit operation. And now let’s do run show route instance. And here we can see that we’ve got the, ah, one routing instance. And if we did run show route. We’ll notice that we have an additional routing table, so this is a net Dods 0. This is our one . net . 0. We have a net six starts 0. And we also have our one . Einat . six. Start 0. Notice that the interface G is 0 0 one is now associated with this routing table. So every routing instance will have its own routing table. Like in this case, this is the routing table for that, or this is the IPv4 routing table for our one, every routing instance will also have its own interfaces. In this case, we have assigned this interface and every routing instance can have its own routing configuration. For example, we can configure static routes for this routing instance. We can also configure a dynamic routing protocols to run within this routing instance. The key takeaway here is that a routing instance allows you to logically split your Junos device into multiple devices and by default routing information from one routing instance will not be shared with another routing instance. They can be configured to share this information. Meaning we can have this information exported from this routing instance to this routing instance. But by default, they do not share information.