Sam Hooke

nmcli tips

nmcli is used to control NetworkManager from the command line. This can be very useful to troubleshoot and configure headless machines.

VM has no IP address §

Situation: A VM has a network adapter, but no IP address is shown when running ip a.

To investigate, run nmcli d (short for nmcli device), which lists all devices:

$ nmcli device
DEVICE                   TYPE      STATE         CONNECTION        
eno16777984              ethernet  disconnected  --               
lo                       loopback  unmanaged     -- 

The device in question, eno16777984, is listed as “disconnected”.

Run nmcli con up eno16777984 to bring the connection up.

Then run nmcli d again to check the device status:

$ nmcli device
DEVICE                   TYPE      STATE         CONNECTION        
eno16777984              ethernet  connected     eno16777984               
lo                       loopback  unmanaged     -- 

The device is now connected. Running ip a shows that an IP address has now been assigned!