2.3 KiB
LFCS 2.6: Static routing
Persistent static routes with NetworkManager and netplan, longest-prefix matching, keeping a second interface from adding a default route, and a host that routes between two networks.
Before you start
The lab gives this VM a second network interface, le-net2, with address
10.98.0.1/24: a NetworkManager profile called le-net2 on the RHEL
family, /etc/netplan/60-le-net2.yaml on Ubuntu. Its gateways
10.98.0.254 and 10.98.0.253 don't need to answer for tasks 1 to 4.
For task 5 there are two more machines: the peer at 10.99.0.2 (network
10.99.0.0/24, this VM is 10.99.0.1 there) and far at 10.97.0.2
(network 10.97.0.0/24, this VM is 10.97.0.1 there). Neither has a
default route. Get a shell on them with sudo ip netns exec lepeer bash
and sudo ip netns exec le-far bash. They read their network settings at
boot from /etc/netns/lepeer/network and /etc/netns/le-far/network
(ip -batch commands, without the leading ip).
Tasks
- RHEL family: give this VM a persistent route to
10.20.0.0/16through10.98.0.254, on its second network. - Ubuntu: do the same with netplan.
- Add a more specific route,
10.20.5.0/24, through a different gateway,10.98.0.253, persistently. Predict which gateway10.20.5.9and10.20.6.9go through, and write them to/root/lab-answers/3, one per line, in that order. - RHEL family: make the
le-net2profile never install a default route, so thatip routeshows one default route, through the main interface. - Make this VM route between the peer's network and far's network, and
give the peer and far routes to each other's network through it, all
persistent, so they can ping each other and
tracepathshows this VM as the first hop. If firewalld is running, let it forward between the two networks.
Hints
nmcli connection modify le-net2 +ipv4.routes "NETWORK GATEWAY", thennmcli connection up le-net2.routes:withto:andvia:in netplan, thennetplan apply.ip route get ADDRESS.ipv4.never-default.net.ipv4.ip_forward = 1in a file in/etc/sysctl.d/. firewalld forwards between interfaces it has put in one zone with--add-forward, or between zones with a policy;ufw route allow.tracepath -n.