I really hope Google and YouTube allow this video to stay up. If you have the time and want to learn more about computer networking, watch the video in full.
If you only have 10 minutes, I have set the start time at the best explanation of how routing is done.
My home router is the Asus RT-N66u. It has been an excellent machine for as long as I have had it. My ISP has also been quite good. At the time of writing this, I live in rural Canada.
A little while ago, I setup Kubernetes on my workstation and I want to access the deployments from all my devices connected to my LAN.
In the video I linked to above, the instructor explained how routes work.
This picture shows how to configure my home LAN to route all traffic belonging to the subnet 10.8.8.1/24
to gateway 192.168.1.130
I wish I could specify a CIDR address, but it doesn't really matter.This router is a little quirky; network addresses must end in 0.
It doesn't matter if my netmask is 255.255.255.0. If it doesn't end it 0, the route will not work properly.
On my workstation, the routing table has the following information.
$ ip route
default via 192.168.1.1 dev enp3s0 proto dhcp src 192.168.1.130 metric 100
10.8.8.0/24 dev lxdbr0 proto kernel scope link src 10.8.8.1
192.168.1.0/24 dev enp3s0 proto kernel scope link src 192.168.1.130
192.168.1.1 dev enp3s0 proto dhcp scope link src 192.168.1.130 metric 100
lxdbr0 is the bridge setup by LXD. It knows how to route everything to the proper containers.
From my laptop, when I run traceroute, to see where packets are sent I get the following.
$ traceroute 10.8.8.254
traceroute to 10.8.8.254 (10.8.8.254), 30 hops max, 60 byte packets
1 router.asus.com (192.168.1.1) 1.032 ms 1.298 ms 1.275 ms
2 dilbert.vandorp.home (192.168.1.130) 5.057 ms 5.047 ms 5.030 ms
3 10.8.8.254 (10.8.8.254) 5.001 ms 4.982 ms 4.967 ms
Before I had configured my asus router, traffic from my laptop was sent out into the void instead of reaching the destination I was hoping for.