Howto NetworkManager: Difference between revisions

From Vidalinux Wiki
Jump to navigation Jump to search
Line 47: Line 47:
= network teaming =
= network teaming =
add team interface:
add team interface:
  nmcli connection add type team con-name team0 ifname team0 config '{"runner": {"name": "activebackup"}}'
  nmcli con add type team con-name team0 ifname team0 config '{"runner": {"name": "activebackup"}}'
add ipv4 address to interface:
add ipv4 address to interface:
  nmcli connection modify team0 ipv4.addresses 172.25.0.11
  nmcli con modify team0 ipv4.addresses 172.25.0.11
add ipv4 method:
add ipv4 method:
  nmcli connection modify team0 ipv4.method manual
  nmcli con modify team0 ipv4.method manual
add slave interface:
add slave interface:
  nmcli connection add type team-slave con-name team0-eth1 ifname eth1 master team0
  nmcli connection add type team-slave con-name team0-eth0 ifname eth0 master team0
add ports to interface:
add ports to interface:
  nmcli connection add type team-slave ifname eth0 master team0
  nmcli con add type team-slave ifname eth0 master team0
  nmcli connection add type team-slave ifname eth1 master team0
  nmcli con add type team-slave ifname eth1 master team0
start interface team0:
nmcli con up team0
enable interfaces:
enable interfaces:
  nmcli device enable eth0
  nmcli device enable eth0
  nmcli device enable eth1
  nmcli device enable eth1
disable other connections and enable team0:
nmcli connection down System eth0
nmcli connection up team0
test connection disabling one interface:
test connection disabling one interface:
  nmcli device disable eth0
  nmcli device disable eth0
modify configuration:
nmcli connection modify team0 team.config '{"runner": {"name": "activebackup"}}'

Revision as of 04:18, 18 November 2021

install NetworkManager

make sure you have network-manager installed:

yum install networkmanager -y

start and enable NetworkManager:

systemctl enable NetworkManager && systemctl start NetworkManager

add address to ethernet

add ip address to your eth0 interface:

nmcli con add con-name eth0 ipv4.method manual type ethernet ifname eth0 ipv4.address 192.168.75.15/24 ipv4.gateway 192.168.75.1 ipv4.dns 4.2.2.1,4.2.2.2 autoconnect yes

enable network interface eth0:

nmcli con up eth0

configure dhcp to your eth0 interface:

nmcli con add con-name eth0 ipv4.method auto type ethernet ifname eth0 autoconnect yes

NetworkManager commands

show connections using nmcli:

nmcli con show

show active connections using nmcli:

nmcli con show --active

show more details about connection device:

nmcli con show "System eth0"

delete connection device:

nmcli con del "System eth0"

bring down or deactive network profile using nmcli:

nmcli con up static

bring up or enable network profile using nmcli:

nmcli con up static

reload configuration using nmcli:

nmcli con reload
nmcli con up static

modify ip address using nmcli:

nmcli con modify "static" ipv4.address "172.25.0.10/24 172.25.0.254"

add another ip address to interface using nmcli

nmcli con modify "static" +ipv4.address "172.25.0.15/24"

modify dns using nmcli:

nmcli con modify "static" ipv4.dns 8.8.8.8

create bridge interface

create the bridge interface:

nmcli connection add type bridge autoconnect yes con-name br0 ifname br0

add device to bridge:

nmcli connection add type bridge-slave autoconnect yes con-name br0-eth0 ifname eth0 master br0

add ip address to bridge interface:

nmcli connection modify br0 ipv4.address 192.168.75.15 ipv4.method manual ipv4.gateway 192.168.75.1 ipv4.dns 4.2.2.1,4.2.2.2

active bridge interface:

nmcli connection up br0

network teaming

add team interface:

nmcli con add type team con-name team0 ifname team0 config '{"runner": {"name": "activebackup"}}'

add ipv4 address to interface:

nmcli con modify team0 ipv4.addresses 172.25.0.11

add ipv4 method:

nmcli con modify team0 ipv4.method manual

add slave interface:

nmcli connection add type team-slave con-name team0-eth0 ifname eth0 master team0

add ports to interface:

nmcli con add type team-slave ifname eth0 master team0
nmcli con add type team-slave ifname eth1 master team0

start interface team0:

nmcli con up team0

enable interfaces:

nmcli device enable eth0
nmcli device enable eth1

test connection disabling one interface:

nmcli device disable eth0