Network - Static Routes, Policy Based Routing and Routing Tables: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
== RHEL 8 | == RHEL 8 == | ||
# Create the default route for the interface | # Create the default route for the interface | ||
#: <tt>'''nmcli con modify <interface> ipv4.routes "0.0.0.0/0 <gateway IP address> table=<table_id>"'''</tt> | #: <tt>'''nmcli con modify <interface> ipv4.routes "0.0.0.0/0 <gateway IP address> table=<table_id>"'''</tt> | ||
# Add the subnet route | # Add the subnet route | ||
#: <tt>'''nmcli con modify <interface> +ipv4.routes "<IP Range>/<CIDR subnet mask> <gateway IP address> table=<table_id>"'''</tt> | #: <tt>'''nmcli con modify <interface> +ipv4.routes "<IP Range>/<CIDR subnet mask> <gateway IP address> table=<table_id>"'''</tt> | ||
# Create the routing rules from the IP to lookup the <table_id> | # Create the routing rules from the IP to lookup the <tt>'''<table_id>'''</tt> | ||
#: <tt>'''nmcli con modify <interface> ipv4.routing-rules "priority <number> from <interface IP address>/32 table <table_id>"'''</tt> | #: <tt>'''nmcli con modify <interface> ipv4.routing-rules "priority <number> from <interface IP address>/32 table <table_id>"'''</tt> | ||
# Add the iif rule to route all traffic coming in/out through the <interface> using <table_id> | # Add the iif rule to route all traffic coming in/out through the <tt>'''<interface>'''</tt> using <tt>'''<table_id>'''</tt> | ||
#: <tt>'''nmcli con modify <interface> +ipv4.routing-rules "priority <number + 1> iif <interface> table <table_id>" | #: <tt>'''nmcli con modify <interface> +ipv4.routing-rules "priority <number + 1> iif <interface> table <table_id>"'''</tt> | ||
# 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 | # 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 "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. | #: <tt>'''nmcli con modify ens160 +ipv4.routes "192.168.174.0/24 192.168.174.1 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 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 con modify ens160 +ipv4.routing-rules "priority 32765 iif ens160 table 174"'''</tt> |
Latest revision as of 15:22, 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.1 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