Difference between revisions of "NMCLI"

From Michael's Information Zone
Jump to navigation Jump to search
(Created page with "==Create Bridge Interface== <ref>https://www.cyberciti.biz/faq/how-to-add-network-bridge-with-nmcli-networkmanager-on-linux/</ref> <pre> [root@natasha ~]# nmcli con add type b...")
 
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
==Policy Based Routing==
 +
===Return traffic on interface it came in on===
 +
The key is to add routes to the interface for a dedicated table. In this example I use table 2, add the two routes needed in place of 0.0.0.0/0<ref>https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/networking_guide/configuring-policy-based-routing-to-define-alternative-routes</ref>.
 +
<pre>
 +
set ipv4.routes 0.0.0.0/1 <gateway> table=2
 +
set ipv4.routes 128.0.0.0/1 <gateway> table=2
 +
set ipv4.routing-rules priority 100 to <int IP>/<prefix dev eth3 table 2
 +
set ipv4.routing-rules priority 101 iif eth3 table 2
 +
set ipv4.routing-rules priority 103 from <int IP> table 2
 +
</pre>
 +
 
==Create Bridge Interface==
 
==Create Bridge Interface==
 
<ref>https://www.cyberciti.biz/faq/how-to-add-network-bridge-with-nmcli-networkmanager-on-linux/</ref>
 
<ref>https://www.cyberciti.biz/faq/how-to-add-network-bridge-with-nmcli-networkmanager-on-linux/</ref>

Latest revision as of 13:07, 28 August 2021

Policy Based Routing

Return traffic on interface it came in on

The key is to add routes to the interface for a dedicated table. In this example I use table 2, add the two routes needed in place of 0.0.0.0/0[1].

set ipv4.routes 0.0.0.0/1 <gateway> table=2
set ipv4.routes 128.0.0.0/1 <gateway> table=2
set ipv4.routing-rules priority 100 to <int IP>/<prefix dev eth3 table 2
set ipv4.routing-rules priority 101 iif eth3 table 2
set ipv4.routing-rules priority 103 from <int IP> table 2

Create Bridge Interface

[2]

[root@natasha ~]# nmcli con add type bridge ifname br0
[root@natasha ~]# nmcli con add type bridge-slave ifname eno1 master br0
[root@natasha ~]# nmcli con edit bridge-br0
nmcli> set ipv4.addresses 192.168.11.120/24
nmcli> set ipv4.gateway 192.168.11.1
nmcli> save
nmcli> quit
[root@natasha ~]# nmcli con up br0