It took me a good few days to finally get through the learning materials for layer 3 routing.
Not only were the materials way more challenging than previous lessons, but the sudden increase in numbers and IP addresses were overwhelming at times.
I write this post as a “Beginner’s Guide”, not because it’s a guide for beginners, but because it is literally written by a beginner — I only just completed my notes for this barely an hour ago.
So take everything here with a grain of salt. It’s not meant to teach you anything, it’s meant as revision for myself.
Routing occurs at the Network layer of the OSI Model (layer 3) and allows packets to be transmitted between end hosts from different local area networks.
Prior to this lesson, device communication was restricted to data being sent between end hosts on a single local area network via a switch and their corresponding MAC addresses.
However, networks would be severely restrictive if they could only connect devices on a local area network. To communicate with other devices externally, such as a PC in another building, or a friend’s phone in another suburb, you will need routers that can connect each end host and their respective local area networks.
Routers employ a routing table that keeps track of network connections, so that it can effectively forward packets using the most direct route possible.
When a router is first set up, there will be two automatic routes established – local routes and connected routes.
Local routes will have a netmask of /32 (for example, 192.168.1.1 /32), which indicates that all bits are fixed (at 192.168.1.1).
This is considered a local route because it is found locally on the router itself (for example, its Gigabit Ethernet 0/0 interface). When a router receives a packet with this address, it knows to store the packet for itself.
Connected routes on the other hand are the local networks that the router is directly connected to (for example, 192.168.1.0/24).
As the /24 netmask would indicate, this network address encompasses all possible addresses between 192.168.1.0 up to 192.168.1.255. When a router receives a packet within this range (for example, 192.168.1.18), it knows that it is able to forward that packet to a device via the connected route.
Static routes are where things started to get challenging for me.
Routers are not able to forward packets to external end hosts (on other networks) because it does not initially know the route to the destination IP address.
Static routes are manually configured so that the router knows how to send a packet towards its external destination via its next step (or (next hop”).
There are several commands you can use to configure a static route, namely:
- ip route ip-address netmask next-hop; or
- ip route ip-address netmask exit-interface; or
- ip route ip-address netmask exit-interface next-hop
It is also important to plan out the static routes to allow for two-way reachability so that communication can travel both ways.
Finally, a router will also have a default route configured, which is set to 0.0.0.0/0. This is the least specific possible address, encompassing all possible values from 0.0.0.0 up to 255.255.255.255.
Also known as the “gateway of last resort”, this route provides an alternative where no other configured route matches the intended destination.
Within a corporate environment, this might mean that if a packet is not destined for any pre-configured routes (i.e. within its own internal network), it will be directed externally into the internet.
Routing is a massive topic that requires understanding the OSI Model and various diagrams labelled with IP addresses.
I’ve barely even cracked the surface of what routing is like in practice – there’s already been too many numbers and tables for me today.
But for now, that’s my Introduction to Routing at the Network layer.
Leave a Reply