To reach another network, a machine sends its packets to a router, a machine on both networks that passes them on. Which router, for which network, is in its routing table. Each line is a route.
New command
ip route
Shows the routing table: one route per line.
Usageip route
text
learner@ops:~$ ip route
default via 10.0.0.1 dev eth0 ← everything else: to the router 10.0.0.1
10.0.0.0/24 dev eth0 proto kernel scope link src 10.0.0.5 ← the office: directly, out of eth0
192.168.50.0/24 dev eth1 proto kernel scope link src 192.168.50.5viais the router a packet goes to next. A route with noviais for a network the machine is on: it sends straight there.devis the interface it goes out of;srcis the address it sends from.proto kernelmeans Linux added the route itself, when the interface got its address.defaultmatches any address the other routes don't. Its router is the default gateway.
Objectives
- Which address does ops send packets for every other network to?
- Which interface does ops use for the stockroom network?