In this chapter, we finally get to the meat and potatoes of what Cisco is known for, and that is routing.
When we speak of routing, we are talking about layer 3 devices, and their function is to route data from source to destination, across WANs or multiple LANs.
Before we begin, let's get something straight. I know that a lot of you are already in the IT field and use layer 3 switches; well, I am not going to be talking about that in this book. Layer 3 switches have the capabilities of routing, but they do not even come close to the functionality of a router. So, use the appropriate equipment for the job intended.
In this chapter, we will be discussing the following topics:
- Routing concepts:
- Packet switching
- Routing table
- Breaking down the routing table:
- Network mask
- Next hop address
- Administrative distance
- Metrics
- Gateway of last resort
- How the routing table gets built, by using multiple routing sources
- Configuring IPv4 and IPv6 static routing
- Default routes
- Network routes
- Host routes
- Floating static routes
- Configuring RIPv2
One thing to remember, before we begin our journey into the wonderful world of routing, is we will be understanding the difference between routing protocols and routed protocols.
Routing protocols, such as RIPv2, EIGRP, and OSPF, are used to determine the best path from source to destination, based on their particular algorithms.
For routed protocols, once the path is determined and all the routers have converged, the protocols will send packets found in the routing table through the path that has been already been laid out by the routing protocols. Examples of routed protocols are IPv4, IPv6, AppleTalk, and IPX. Obviously, the most used routed protocol would be IPv4, followed by IPv6, but this is due to a syndrome called resistance to change, but soon enough IPv6 will be more dominant in the force. Still, IPv4 will always exist somewhere, so you must know it.
As I mentioned before, we will be discussing the fundamentals of routing such as the following:
- The routing basics—as tedious as this may be, this is an invaluable lesson you must undergo
- The IP routing process
- Default routing
- Static routing
- Dynamic routing
As I have mentioned, routing is the act of sending source packets to a different destination; they could go across a WAN or a different VLAN, but some sort of routing must take place, by using a router. If you do not have multiple VLANs or must go across the internet to reach a branch office, well, then there is no routing needed. If that's the case, you must be on a small network or a bogged-down network.
Think about the scenario in the following screenshot:
The preceding screenshot shows a very common configuration used by schools: they have switches in their classrooms, all in the native VLAN, connected to a core switch, which then gets connected to a router. At this point we are all still on the same network, but with different IP addresses; however, once it goes to the public side of the router, we use a public IP address so we can access the internet.
Does anyone see a problem with this? We are all on the same network; this could be hundreds of computers! What would happen if someone in IT wanted to throw an image to a classroom or a PC? It would slow down the network to a crawl.
The simple fact is that when every student comes to class and starts working on their respective projects, it will bog down the network. We know this is not true, the priority is, we must check our social media, watch YouTube video, or find some way around the firewall.
The point of all this is that the preceding diagram is not the ideal configuration for a network, and we must VLAN everything out, meaning that every department and classroom should be on their own VLAN. That means it would be a different subnetwork for which we need to create inter-VLAN routing on the router and sub-interfaces with a gateway for each VLAN with the correct encapsulation, so everyone can communicate. But any packets that flow through a specific VLAN will not be heard by other VLANs, increasing the overall bandwidth.
So, there are five requirements or factors that a router must know to send packets across a network:
- Destination addresses
- Its neighbor's router so it can learn about other networks, using routing protocols
- Based on the routing protocol, all possible routes to remote networks
- Based on the routing protocol, the best route to remote networks
- Based on the routing protocol, maintain and verify routing information
The router must learn about remote networks in two different ways statically, meaning you are the one creating the routing table entries, and dynamically, using a routing protocols such as RIP; through the updates sent by neighboring routers, it will create the routing table. I said remote networks because routers know who they are directly connected to, so using routing protocols, they learn about remote networks beyond their directly connected networks. We could also do it statically, which means the IT person in charge of the router would manually have to input all the routes to the remote networks. In a small network, that is fine, but if it's a large network, then that could be very time consuming, not to mention mind numbing.
So, let's discuss the differences between static routing and dynamic routing. In dynamic routing, the routing protocols algorithm does all the work, and it actually snitches you out. Using a multicast address specific to that routing protocol, it will send updates to their neighboring router about the network it knows, and all the other routers would do the same thing. So, when all the routers have learned about the networks that are remote to them, it would be called fully converged. So, the routing protocol does all the heavy lifting for us, but it means more burden on the router and not us.
If we use static routing, we need to input all the remote networks manually, and if a network goes down or is taken down, you must remove that network from the routing table manually also. Static routing is used mainly for backups or small networks. It opens the door for lots of human error, and, as I said previously, it will put you to sleep, but you free...