nmcli - command-line tool for controlling NetworkManager
Tip
use the auto completion
ipv4 status/list command examples #
list of all the devices:
nmcli dev statusshow all connections:
nmcli connection showshow all active connections:
nmcli connection show --activereread the configuration files.:
nmcli con reloadset the hostname:
hostnamectl set-hostname ...ipv4 add command examples #
Example:
Device is eno1, ip address is 192.168.0.99, gateway 192.168.0.254 and netmask is 24.
Using `DHCP`:
nmcli con add con-name eno1 type ethernet ifname eno1Static:
nmcli con add con-name eno1 type ethernet ifname eno1 ip4 192.168.0.99/24 gw4 192.168.0.254
its ip4 and not ipv4 in the command
modify regular #
Basic command: nmcli con mod <<interface>>
Add a DNS server to a connection: nmcli con mod <<interface>> +ipv4.dns <<ipaddress>>
Useful parameters:
| parameter | description |
|---|---|
ipv4.method manual |
IPv4 address is configured statically |
ipv4.method auto |
IPv4 address is configured with DHCP |
ipv4.dns 8.8.8.8 |
set dns server to 8.8.8.8 |
connection.autoconnect yes |
The connection is bound to the network interface with this name |
bring interface up/down #
bring up:
nmcli con up eno1disconnect:
nmcli dev dis eno1ipv6 #
Warning
When including TCP or UDP network ports after an IPv6 address, always enclose the IPv6 address in square brackets so that the port does not look like it is part of the address.
[2001:db8:0:10::1]:80IPv6 has a standard subnetmask, which is used in almost all normal addresses: /64. In this case half of the address is the network prefix and half is the interface ID.
Network providers often apply a subnetmask of /48 which can then be allocated to organisations. The 16 bits left make for up to 65536 subnets.
Network part interfac e ID
2001 0db8 0000 0001 0000 0000 0000 0001
Network Part (48) Local subnets
command examples #
Multicast ping:
ping6 ff02::1%eth0Show ipv6 routing:
ip -6 route showCommon addresses:
| ipv6 | ipv4 |
|---|---|
::1/128 |
127.0.0.1 |
: |
0.0.0.0 |
Look into #
router advertisment daemon
See Also #
- nm-settings