2018-06-17 NMCLI Commands

Overview

With the persistent issues encountered with the nmcli module in Ansible (as described in NMCLI module fails with No such method 'Update2' #31 ), I had to figure out a way to use the nmcli command directly.

References

Investigation

Current Status of ETH1

The following command on REDFERN2 failed to return any output:

nmcli -g ip4.address connection show eth1

Current Status of ETH0

The following command was run on REDFERN2:

nmcli -g ip4.address connection show eth0

The output was:

192.168.1.141/24

Show All Connections

The following command was run on REDFERN2:

nmcli connection show

The output was

NAME UUID TYPE DEVICE eth0 e744cfd2-9a87-46c7-892d-1701af065ba4 802-3-ethernet eth0 eth1 ce12c49f-9a00-4a1c-a1c5-67fa822243a6 802-3-ethernet --

Add New Connection for ETH1

The following command was run on REDFERN2:

sudo nmcli connection add con-name eth1 ifname eth1 type ethernet ip4 192.168.2.141/24

The output was

[sudo] password for douglas: Connection 'eth1' (97f2c8fb-1f7f-45d9-80c5-9321080a3bf1) successfully added.

Confirm New Connection for ETH1

The following command was run on REDFERN2:

nmcli -p con show eth1

The output has been uploaded as REDFERN2_eth1_connection_profile.txt

Get IP Address for ETH1

The following command was run on REDFERN2:

nmcli -g ip4.address connection show eth1

The output was (notice the first line is blank):

192.168.2.141/24