How to configure static IP address on Fedora 31

There ar multiple ways on how to set your Fedora 31 system with a static IP address. Using the nmcli is perhaps the simplest regardless of GUI is currently your system configured with.

In this tutorial you will learn:

  • How to set static IP address
  • How to set DNS server IP address
  • How to Gateway IP address
  • How to apply / restart network

Configure static IP address on Fedora 31

Configure static IP address on Fedora 31

Software Requirements and Conventions Used

Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Fedora 31
Software N/A
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

Configure static IP address on Fedora 31 step by step instructions

  1. Open up terminal and obtain the name or UUID of the network connection you with to configure with static IP address. Example:
    $ sudo nmcli connection show
    NAME                UUID                                  TYPE      DEVICE 
    Wired connection 1  91d78f79-c7cf-32fc-8a91-bc3d587a2461  ethernet  enp0s3 
    virbr0              b5402c70-eb3d-4a45-a7ad-43e1652798b1  bridge    virbr0
    

    The UUID of the network connection we wish to change is 91d78f79-c7cf-32fc-8a91-bc3d587a2461.



  2. Use nmcli command to set the example static IP address 192.168.1.127/24, DNS 8.8.8.8, gateway 192.168.1.1 and configuration method as manual. Change the bellow settings to suit your needs and use the UUID you have retrieved in the previous step:
    $ sudo nmcli connection modify 91d78f79-c7cf-32fc-8a91-bc3d587a2461 IPv4.address 192.168.1.127/24
    $ sudo nmcli connection modify 91d78f79-c7cf-32fc-8a91-bc3d587a2461 IPv4.gateway 192.168.1.1
    $ sudo nmcli connection modify 91d78f79-c7cf-32fc-8a91-bc3d587a2461 IPv4.dns 8.8.8.8
    $ sudo nmcli connection modify 91d78f79-c7cf-32fc-8a91-bc3d587a2461 IPv4.method manual
    
  3. Restart your network to apply changes:
    $ sudo nmcli connection down 91d78f79-c7cf-32fc-8a91-bc3d587a2461
    $ sudo nmcli connection up 91d78f79-c7cf-32fc-8a91-bc3d587a2461
    

    All done.