Howto NetworkManager: Difference between revisions

From Vidalinux Wiki
Jump to navigation Jump to search
 
(19 intermediate revisions by the same user not shown)
Line 4: Line 4:
start and enable NetworkManager:
start and enable NetworkManager:
  systemctl enable NetworkManager && systemctl start NetworkManager
  systemctl enable NetworkManager && systemctl start NetworkManager
verify NetworkManager service status:
systemctl status NetworkManager
restart NetworkManager service:
systemctl restart NetworkManager
= add address to ethernet =
= add address to ethernet =
add ip address to your eth0 interface:
add static 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
  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:
enable network interface eth0:
  nmcli connection up eth0
  nmcli con up eth0
if you want to configure dhcp to your eth0 interface use the following command instead:
nmcli con add con-name eth0 ipv4.method auto type ethernet ifname eth0 autoconnect yes


= NetworkManager commands =
= NetworkManager commands =
show connections using nmcli
show connections using nmcli:
  nmcli con show
  nmcli con show
show active connections using nmcli
show active connections using nmcli:
  nmcli con show --active
  nmcli con show --active
show more details about connection device
show more details about connection device:
  nmcli con show "System eth0"
  nmcli con show "System eth0"
delete connection device:
delete connection device:
  nmcli con del "System eth0"
  nmcli con del "System eth0"
bring up new profile using nmcli
bring down or deactive network profile using nmcli:
  nmcli con up static
  nmcli con up static
reload configuration using nmcli
bring up or enable network profile using nmcli:
nmcli con up static
reload configuration using nmcli:
  nmcli con reload
  nmcli con reload
  nmcli con up static
  nmcli con up static
modify ip address using nmcli
add another ip address to interface eth0 using nmcli
  nmcli con modify "static" ipv4.addresses "172.25.0.10/24 172.25.0.254"
  nmcli con modify "static" +ipv4.address "192.168.75.18/24"
add another ip address to interface using nmcli
replace added ip address on interface eth0 using nmcli:
  nmcli con modify "static" +ipv4.addresses "172.25.0.15/24"
  nmcli con modify "static" -ipv4.address "192.168.75.18/24"
modify dns using nmcli
replace current nameservers with 8.8.8.8 using nmcli:
  nmcli con modify "static" ipv4.dns 8.8.8.8
  nmcli con modify "static" ipv4.dns 8.8.8.8
= create bridge interface =
= create bridge interface =
create the bridge interface:
create the bridge interface:
  nmcli connection add type bridge autoconnect yes con-name br0 ifname br0
  nmcli connection add type bridge autoconnect yes con-name br0 ifname br0
add ip address to bridge interface:
nmcli connection modify br0 ipv4.addresses 192.168.75.15 ipv4.method manual ipv4.gateway 192.168.75.1 ipv4.dns 4.2.2.1,4.2.2.2
add device to bridge:
add device to bridge:
  nmcli connection add type bridge-slave autoconnect yes con-name br0-eth0 ifname eth0 master br0
  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:
active bridge interface:
  nmcli connection up br0
  nmcli connection up br0
= create vlan =
create vlan interface:
# vlan105
nmcli con add type bridge ifname vlan105 con-name vlan105 connection.autoconnect yes
nmcli con modify vlan105 ipv4.method disabled ipv6.method ignore
nmcli con up vlan105
nmcli con add type vlan con-name eno2np1.105 dev eno2np1 id 105 master vlan105 connection.autoconnect yes
# vlan104
nmcli con add type bridge ifname vlan104 con-name vlan104 connection.autoconnect yes
nmcli con modify vlan104 ipv4.method disabled ipv6.method ignore
nmcli con up vlan104
nmcli con add type vlan con-name eno2np1.104 dev eno2np1 id 104 master vlan104 connection.autoconnect yes


= 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.address 192.168.75.15/24 ipv4.method manual ipv4.gateway 192.168.75.1 ipv4.dns 4.2.2.1,4.2.2.2
add ipv4 method:
nmcli connection modify team0 ipv4.method manual
add slave interface:
nmcli connection add type team-slave con-name team0-eth1 ifname eth1 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 con-name team0-eth0 ifname eth0 master team0
  nmcli connection add type team-slave ifname eth1 master team0
  nmcli con add type team-slave con-name team0-eth1 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 disconnect eth0
modify configuration:
nmcli connection modify team0 team.config '{"runner": {"name": "activebackup"}}'

Latest revision as of 12:35, 16 October 2024

install NetworkManager

make sure you have network-manager installed:

yum install networkmanager -y

start and enable NetworkManager:

systemctl enable NetworkManager && systemctl start NetworkManager

verify NetworkManager service status:

systemctl status NetworkManager

restart NetworkManager service:

systemctl restart NetworkManager

add address to ethernet

add static 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

if you want to configure dhcp to your eth0 interface use the following command instead:

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

add another ip address to interface eth0 using nmcli

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

replace added ip address on interface eth0 using nmcli:

nmcli con modify "static" -ipv4.address "192.168.75.18/24"

replace current nameservers with 8.8.8.8 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

create vlan

create vlan interface:

# vlan105
nmcli con add type bridge ifname vlan105 con-name vlan105 connection.autoconnect yes
nmcli con modify vlan105 ipv4.method disabled ipv6.method ignore
nmcli con up vlan105
nmcli con add type vlan con-name eno2np1.105 dev eno2np1 id 105 master vlan105 connection.autoconnect yes
# vlan104
nmcli con add type bridge ifname vlan104 con-name vlan104 connection.autoconnect yes
nmcli con modify vlan104 ipv4.method disabled ipv6.method ignore
nmcli con up vlan104
nmcli con add type vlan con-name eno2np1.104 dev eno2np1 id 104 master vlan104 connection.autoconnect yes

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.address 192.168.75.15/24 ipv4.method manual ipv4.gateway 192.168.75.1 ipv4.dns 4.2.2.1,4.2.2.2

add ports to interface:

nmcli con add type team-slave con-name team0-eth0 ifname eth0 master team0
nmcli con add type team-slave con-name team0-eth1 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 disconnect eth0