Network manager CLI (nmcli) is a command-line tool for controlling NetworkManager and reporting network status.

I personally use it to connect / disconnect pre-configured VPNs

Here some useful commands

# Show connections
nmcli con show
# Connect
nmcli con up id "<name>"
# Disconnect
nmcli con down id "<name>"

Assign static ip

# add a new connection name
nmcli con add con-name "<name>" ifname <device> type ethernet ip4 <ip>/24 gw4 <ip-gateway>
# assign dns comma separated
nmcli con mod "<name>" ipv4.dns "<ip1>,<ip2>"
# start the interface
nmcli con up "<name>"
# delete the old one if any
nmcli con del "<old-name>"
Categories: BashServer

0 Comments

Leave a Reply

Avatar placeholder