====== Route IP Traffic And Create Static Routes ====== **General Information** Routing IP traffic and creating static routes. ---- ====== Lab Setup ====== The following virtual machines will be used: * server1.example.com (192.168.1.150) -> Configure the routes here ---- ====== Help ====== Finding help in this section. * nmcli examplesman nmcli-examples ---- ====== Linux Routing ====== Ensure IP Forwarding is enabled if using router like functionality # Persistent Change that takes place upon system boot vim /etc/sysctl.d/overrides.conf net.ipv4.ip_forward = 1 \\ Show Route Table ip route show ===== Persistent Static Route ===== Creating a persistent static route. ---- ==== Option A: Use nmcli ==== Interface specific route using nmcli. * Create routenmcli con mod enp0s3 +ipv4.routes 216.58.219.0/24 * Bring up the new connection confignmcli con up enp0s3 * Verify routeip route show ---- ==== Option B: Use nmtui ==== * Open nmtuinmtui * Enter on "Edit a connection" * Select the target network interface to use, press Enter. * Scroll down to "Routing", Enter on "" * Enter on "" * Type the Destination/Prefix * Next Hop * Optional Metric (default static is 0) * Tab to and press 'Enter' * Scroll to the bottom and Enter on "" * Tab over to * File is created at: /etc/sysconfig/network-scripts/route- * Restart the network servicesystemctl restart network * View routeip route show ---- ==== Option C: Use a static config file ==== **Note**: This method is considered "legacy", but if it works, that is all that matters on the exam. * Create config filevim /etc/sysconfig/static-routes # Minimal route entry any net 216.58.217.0/24 gw 192.168.1.254 # Can also specify a device to use for the route any net 216.58.217.0/24 gw 192.168.1.254 dev eth0 # Can also specify a route metric any net 216.58.217.0/24 gw 192.168.1.254 dev eth0 metric 110 * any -> source from any * net 216.58.217.0/24 -> traffic to this network destination * gw 192.168.1.254 -> use this gateway * **OPTIONAL**: dev eth0 -> use this device * Restart the network servicesystemctl restart network * View routeip route show ----