Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
linux_wiki:route_ip_traffic_and_create_static_routes [2016/09/20 23:07] billdozor [Linux Routing] |
linux_wiki:route_ip_traffic_and_create_static_routes [2019/05/25 23:50] (current) |
||
---|---|---|---|
Line 4: | Line 4: | ||
Routing IP traffic and creating static routes. | 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 examples< | ||
---- | ---- | ||
Line 11: | Line 25: | ||
Ensure IP Forwarding is enabled if using router like functionality | Ensure IP Forwarding is enabled if using router like functionality | ||
<code bash> | <code bash> | ||
- | # Temp Immediate Change | ||
- | echo 1 > / | ||
- | |||
# Persistent Change that takes place upon system boot | # Persistent Change that takes place upon system boot | ||
vim / | vim / | ||
Line 26: | Line 37: | ||
</ | </ | ||
- | \\ | + | ===== Persistent Static Route ===== |
- | 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 | + | |
- | \\ | + | Creating a persistent |
- | Remove | + | |
- | <code bash> | + | |
- | ip route delete 216.58.217.0/ | + | |
- | </ | + | |
- | \\ | + | ---- |
- | ===== Persistent Static Route ===== | + | ==== Option A: Use nmcli ==== |
- | Create config file | + | Interface specific route using nmcli. |
- | <code bash> | + | * Create route<code bash>nmcli con mod enp0s3 +ipv4.routes 216.58.219.0/24</code> |
- | vim /etc/sysconfig/static-routes | + | * Bring up the new connection config< |
+ | * Verify route< | ||
+ | ---- | ||
+ | |||
+ | ==== 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 < | ||
+ | * File is created at: / | ||
+ | * Restart the network service< | ||
+ | * View route< | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ==== Option C: Use a static config file ==== | ||
+ | |||
+ | **Note**: This method is considered " | ||
+ | |||
+ | * Create config file< | ||
+ | |||
+ | # Minimal route entry | ||
+ | any net 216.58.217.0/ | ||
+ | |||
+ | # Can also specify a device to use for the route | ||
any net 216.58.217.0/ | 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**: | ||
- | \\ | + | # Can also specify a route metric |
- | Restart the network service | + | any net 216.58.217.0/ |
- | <code bash> | + | * any -> source from any |
- | systemctl restart network | + | * net 216.58.217.0/ |
- | </ | + | * gw 192.168.1.254 -> use this gateway |
+ | * **OPTIONAL**: | ||
+ | |||
+ | * Restart the network service< | ||
+ | * View route< | ||
---- | ---- | ||