Hello and welcome! I am currently working on a video course regarding Routing for IP version 4, and I've decided to post my slides and scripts here on STEEM as I go along. I appreciate any feedback or suggestions, or if you are new to the world of computer networking, I hope you enjoy them! If you are brand new to the topic, I recommend that you review my previous course posted on STEEM titled IP Version 4 Addressing And Subnetting Deep Dive.
Here is part 4 of a multi-part series. In this section, we will learn about longest match and default routing, as well as how static routes are manually added to devices. How many parts will there be? I have no idea because I am posting them as I go along. This and all @steempeak initiated posts will have a 4% beneficiary set to @null to help fight inflation.
If you missed any sections, click one of the links below for your favorite front end:
PART 1:
https://steempeak.com/stem/@joshman/steem-course-ipv4-routing-primer-part-1
https://busy.org/@joshman/steem-course-ipv4-routing-primer-part-1
https://steemit.com/stem/@joshman/steem-course-ipv4-routing-primer-part-1
PART 2:
https://steempeak.com/stem/@joshman/steem-course-ipv4-routing-primer-part-2
https://busy.org/@joshman/steem-course-ipv4-routing-primer-part-2
https://steemit.com/stem/@joshman/steem-course-ipv4-routing-primer-part-2
PART 3:
https://steempeak.com/stem/@joshman/steem-course-ipv4-routing-primer-part-3
https://busy.org/@joshman/steem-course-ipv4-routing-primer-part-3
https://steemit.com/stem/@joshman/steem-course-ipv4-routing-primer-part-3

A router that has to decide between two different length prefixes of the same network will always follow the longer mask. This concept is known as longest match routing, and the routes themselves are said to overlap. If you don’t understand why these routes overlap, I recommend you review my other course on IP addressing and subnetting. Let’s take a look an an example. A routing table contains the following routes:
10.0.0.0/8
10.10.0.0/16
10.10.10.0/24
10.10.10.0/25
In terms of the longest match, 10.10.10.0/25, all of these routes overlap. This means that all of these routes are potentially valid to reach the destination. Because the routes are technically different, they can exist in the routing table at the same time. The router will choose the route with the longest bit length subnet mask to reach the 10.10.10.0/25, in a process known as longest match routing. It doesn’t matter what routing protocol is being used, the longest match in the routing table will always win out. If the /25 were to drop out of the routing table, the next longest match will be used.

Let’s review the concept of a default gateway as described in my IP subnetting course. If you are on a device trying to connect to a wide are network, or the Internet, you will need to hit a default gateway first. A default gateway is a device, such as a router, that provides an exit point from the local LAN. In our example, we have a pair of PCs on the same LAN. These PCs are able to reach each other directly, however if they need to get to the WAN or Internet, they will need send their traffic via the Default Gateway. Although a default gateway can be any IP address, it’s typically assigned from either the first IP address in the network, or the last one.

The concept of a default route is similar to the concept of a default gateway. A default route, basically defines the default gateway for traffic with an unknown destination. That is, a destination with no entry in the local routing table. If we took the routing table from our previous example and added a default route, it would show up as an all-zeros route pointed to a desired interface or next hop.

Static routing is the process of manually entering user-defined routes into the routing table. Static routes can be used for a number of purposes, including the manual configuration of a default route.
By default static routes are removed automatically from the routing table should the interface used go down, or the next hop of the route becomes unreachable. Optionally, static routes can be permanently installed into the routing table, but this creates the possibility of black hole routing.

Let’s take a look at an example static route configuration for a Cisco router. To enter a static route, you simply type the command ip route, followed by the destination network and subnet mask, then you enter the next hop address. There are other optional configuration parameters you can use when creating a static route. The important thing to remember is you are creating a routing table entry by defining a destination, and the next hop address that must be traversed to reach that destination. The interface facing that next hop address must be up, and the next hop address must be reachable in order for the static route to remain in the routing table.
When installed into the actual routing table, the static route would be displayed as indicated in blue using the 'show ip route' command. Not the route is signified as static by the ‘S’ entry.

In some cases you might need to configure a static route on a computer. One particular example is when you connect your PC to a VPN and the Internet at the same time, but your PC does not know about networks behind the VPN. If you don’t manually create static routes for those VPN networks, your PC will attempt to reach them via the public Internet.
The configuration steps are very similar to that of a router. You simply use the route add command in a DOS window or Power Shell, followed by the destination network and mask. You must use the term mask when defining the mask. Finally you just specify the next hop address.
To view existing routes on a windows PC, you enter ‘route print’.

Adding a route in Linux, is quite a bit different to Windows. If you are logged in as a normal user, you must perform the command in superuser mode. To invoke superuser privileges, you must preface the ip route command with the sudo command. An additional requirement is that you must add the interface ID of the interface the next hop is pointed to. You can view routes using the ‘ip route show’ command.

Creating a static route on Mac OS is very similar to Linux, though you don’t need to specify the interface.
You can view routes using the ‘netstat –nr’ command.

One way you can get fancy with static routes is referred to as a floating static route. A floating static route allows you to create two identical routes, with different administrative distances. The lower administrative distance route will be installed into the routing table, while the higher one will be suppressed. If that lower AD route should fail, the higher one would then be installed. Floating static routes can also be installed as a backup to dynamic routes. You just have to make sure the AD of the static route is higher than that of the dynamic route.

Cisco routers offer a technique called Reliable Static Routing. This allows the router to install the static route into the routing table, only when certain conditions are met. This is accomplished through the router tracking an external resource such as website or server through ICMP Pings, HTTP Gets, and UDP Echoes.
Reliable static routing uses a technology called IP SLA / Object tracking. Although the SLA itself requires additional configuration, it only requires the track option and number to be added to the ip route command.
The exact configuration of this is beyond the scope of this course, but it shows how much flexibility can be built into static routing.
Thanks for viewing! In the next part, we will have an introduction to dynamic routing.
!SKATE50
Thanks!
Your welcome buddy ✌✌
Posted using Partiko Android
@knowhow92 tipped 50 SKATE TOKENS for this post!
Congratulations @joshman! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :
You can view your badges on your Steem Board and compare to others on the Steem Ranking
If you no longer want to receive notifications, reply to this comment with the word
STOPThis post has been voted on by the SteemSTEM curation team and voting trail. It is elligible for support from @curie and @minnowbooster.
If you appreciate the work we are doing, then consider supporting our witness @stem.witness. Additional witness support to the curie witness would be appreciated as well.
For additional information please join us on the SteemSTEM discord and to get to know the rest of the community!
Thanks for having used the steemstem.io app. This granted you a stronger support from SteemSTEM. Note that including @steemstem in the list of beneficiaries of this post could have yielded an even more important support.