Thursday, May 17, 2018

Switching Static IP Addresses in LInux (Manjaro Gnome) with NetworkManager

Sometimes changing static IP addresses via the GUI alone on your Linux computer can be frustrating. You change the static IP in the GUI but it doesn't actually change.  This can be frustrating especially in the situation where you are troubleshooting an issue and need to quickly change IP addresses.

Here's a method, or a series of steps, that works for me.  The sequence is:
  • Flush the current static IP address using the "ip" utility
  • Assign the new IP address using either GUI or command line (GUI in this post)
  • Restart NetworkManager
First "flush" any previous static IP configuration by issuing the "flush" command:

 sudo ip address flush dev enp0s20f0u2u1 

Substitute your device name for enp0s20f0u2u1 in the previous command.  You can find your device name by issuing the "ip link show" command:

 ip link show  



Assign a new IP address to the device.  In this case using the GUI to expedite the assignment of IP, Subnet Mask and Gateway.  In the Gnome desktop navigate to Settings>Network (or WiFi if applicable) and enter the desired IP address.



Finally to apply the settings issue the command "systemctl restart NetworkMangaer".

 sudo systemctl restart NetworkManager  

That should do it!  To change the static IP again, repeat the steps.

No comments:

Post a Comment