Differences
This shows you the differences between two versions of the page.
linux_wiki:route_ip_traffic_and_create_static_routes [2016/10/10 15:56] billdozor |
linux_wiki:route_ip_traffic_and_create_static_routes [2019/05/25 23:50] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== 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 | ||
- | |||
- | ---- | ||
- | |||
- | ====== Linux Routing ====== | ||
- | |||
- | Ensure IP Forwarding is enabled if using router like functionality | ||
- | <code bash> | ||
- | # Temp Immediate Change | ||
- | echo 1 > / | ||
- | |||
- | # Persistent Change that takes place upon system boot | ||
- | vim / | ||
- | |||
- | net.ipv4.ip_forward = 1 | ||
- | </ | ||
- | |||
- | \\ | ||
- | Show Route Table | ||
- | <code bash> | ||
- | ip route show | ||
- | </ | ||
- | |||
- | \\ | ||
- | Create static route (NOT persistent) | ||
- | <code bash> | ||
- | ip route add 216.58.217.0/ | ||
- | </ | ||
- | * 216.58.217.0/ | ||
- | * via 192.168.1.254 -> use this gateway | ||
- | * dev eth1 -> use this interface | ||
- | |||
- | \\ | ||
- | Remove static route | ||
- | <code bash> | ||
- | ip route delete 216.58.217.0/ | ||
- | </ | ||
- | |||
- | \\ | ||
- | |||
- | ===== Persistent Static Route ===== | ||
- | |||
- | **Option A: Use a static config file** | ||
- | |||
- | Create config file | ||
- | <code bash> | ||
- | vim / | ||
- | |||
- | any net 216.58.217.0/ | ||
- | </ | ||
- | * any net -> source from any network | ||
- | * 216.58.217.0/ | ||
- | * gw 192.168.1.254 -> use this gateway | ||
- | * **OPTIONAL**: | ||
- | |||
- | \\ | ||
- | Restart the network service | ||
- | <code bash> | ||
- | systemctl restart network | ||
- | </ | ||
- | |||
- | \\ | ||
- | View route | ||
- | <code bash> | ||
- | ip route show | ||
- | </ | ||
- | |||
- | |||
- | \\ | ||
- | **Option B: Use nmtui** | ||
- | |||
- | * Open nmtui< | ||
- | * Enter on "Edit a connection" | ||
- | * Select the target network interface to use, press Enter. | ||
- | * Scroll down to " | ||
- | * Enter on "< | ||
- | * Type the Destination/ | ||
- | * Next Hop | ||
- | * Optional Metric (default static is 0) | ||
- | * Tab to <OK> and press ' | ||
- | * Scroll to the bottom and Enter on "< | ||
- | * Tab over to < | ||
- | * Restart the network service< | ||
- | * View route< | ||
- | |||
- | ---- | ||