Network layer path selection — how packets find their way
Hop-by-Hop Path traceroute
$ traceroute example.com
1 192.168.1.1 1.234 ms
2 10.0.0.1 8.567 ms
3 72.14.215.1 12.891 ms
4 142.250.80.46 15.234 ms
Routing Table netstat -rn
Field
Description
Destination
Network address with CIDR prefix
Gateway
Next hop IP (0.0.0.0 = directly connected)
Interface
Network interface to send packets through
Metric
Cost/priority (lower = preferred)
Default Gateway 0.0.0.0/0
Packet to 8.8.8.8:
1. Check routing table
2. No specific match found
3. Use default route 0.0.0.0/0
4. Forward to gateway 192.168.1.1
CIDR Notation RFC 4632
CIDR
Subnet Mask
Addresses
Usable
/8
255.0.0.0
16,777,216
16,777,214
/16
255.255.0.0
65,536
65,534
/24
255.255.255.0
256
254
/32
255.255.255.255
1
1
Private IP Ranges RFC 1918
Range
Networks
Total Addresses
Common Use
10.0.0.0/8
1
16,777,216
Large enterprises
172.16.0.0/12
16
1,048,576
Medium networks
192.168.0.0/16
256
65,536
Home/small office
Network Address Translation RFC 3022
Direction
Private Address
Public Address
Outbound
192.168.1.10:54321
203.0.113.5:12345
Inbound
192.168.1.10:54321
203.0.113.5:12345
BGP Basics RFC 4271
Attribute
Description
Selection
AS Path
List of AS numbers traversed
Shorter = preferred
Local Pref
Preference within AS
Higher = preferred
MED
Multi-Exit Discriminator
Lower = preferred
Origin
IGP, EGP, or Incomplete
IGP > EGP > Incomplete
BGP Path Selection (simplified):
1. Highest Local Preference
2. Shortest AS Path
3. Lowest Origin type
4. Lowest MED
5. eBGP over iBGP
6. Lowest router ID