Skip to content

Instantly share code, notes, and snippets.

@gmelodie
Last active October 15, 2020 02:09
Show Gist options
  • Save gmelodie/9d0acf4e6959947b6e62c58f6d03cb10 to your computer and use it in GitHub Desktop.
Save gmelodie/9d0acf4e6959947b6e62c58f6d03cb10 to your computer and use it in GitHub Desktop.
NetworkManager connection workflow to when a network doesn't have DHCP enabled
nmcli dev status # show devices connected and not connected
nmcli con show # show active and old connections
nmcli con mod CONNECTION_NAME ipv4.method manual # modify a connection from DHCP to static IP connect
nmcli con mod CONNECTION_NAME ipv4.addresses 192.168.0.X/24 # set the static IP to use in a connection
nmcli con mod CONNECTION_NAME ipv4.gateway 192.168.0.Y # set the default gateway of a connection
# Finally, revert changes after DHCP is setup
nmcli con mod CONNECTION_NAME ipv4.method auto ipv4.addresses "" ipv4.gateway ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment