Network - Static Routes, Policy Based Routing and Routing Tables: Difference between revisions
Jump to navigation
Jump to search
(Created page with "Network - Static Routes, Policy Based Routing and Routing Tables == RHEL 8+ == # Create the default route for the interface #: <tt>'''nmcli con modify <interface> ipv4.routes...") |
No edit summary |
||
Line 1: | Line 1: | ||
== RHEL 8+ == | == RHEL 8+ == | ||
# Create the default route for the interface | # Create the default route for the interface | ||
Line 11: | Line 10: | ||
# Apply the new settings to the adapter | # Apply the new settings to the adapter | ||
#: <tt>'''nmcli dev reapply <interface>'''</tt> | #: <tt>'''nmcli dev reapply <interface>'''</tt> | ||
# Example | |||
#: <tt>'''nmcli con modify ens160 ipv4.routes "0.0.0.0/0 192.168.174.2 table=174"'''</tt> | |||
#: <tt>'''nmcli con modify ens160 +ipv4.routes "192.168.174.0/24 192.168.174.2 table=174"'''</tt> | |||
#: <tt>'''nmcli con modify ens160 ipv4.routing-rules "priority 32764 from 192.168.174.133/32 table 174"'''</tt> | |||
#: <tt>'''nmcli con modify ens160 +ipv4.routing-rules "priority 32765 iif ens160 table 174"'''</tt> | |||
#: <tt>'''nmcli dev reapply ens160'''</tt> | |||
== Further Reading == | == Further Reading == |
Revision as of 15:17, 29 May 2022
RHEL 8+
- Create the default route for the interface
- nmcli con modify <interface> ipv4.routes "0.0.0.0/0 <gateway IP address> table=<table_id>"
- Add the subnet route
- nmcli con modify <interface> +ipv4.routes "<IP Range>/<CIDR subnet mask> <gateway IP address> table=<table_id>"
- Create the routing rules from the IP to lookup the <table_id>
- nmcli con modify <interface> ipv4.routing-rules "priority <number> from <interface IP address>/32 table <table_id>"
- Add the iif rule to route all traffic coming in/out through the <interface> using <table_id>
- nmcli con modify <interface> +ipv4.routing-rules "priority <number + 1> iif <interface> table <table_id>"
- Apply the new settings to the adapter
- nmcli dev reapply <interface>
- Example
- nmcli con modify ens160 ipv4.routes "0.0.0.0/0 192.168.174.2 table=174"
- nmcli con modify ens160 +ipv4.routes "192.168.174.0/24 192.168.174.2 table=174"
- nmcli con modify ens160 ipv4.routing-rules "priority 32764 from 192.168.174.133/32 table 174"
- nmcli con modify ens160 +ipv4.routing-rules "priority 32765 iif ens160 table 174"
- nmcli dev reapply ens160