Hi techies, as we know Fedora is one of popular open source Linux based operating system. Fedora Linux can be used as workstation, Server, and CoreOS.
In this guide, we learn how to manually configure static ip address on Fedora Linux (Fedora 40 Workstation). A static IP address is an IP address that stays the same over time and remain persistent across the reboot. There are two different ways to configure static IP.
- nmcli utility (Command Line)
- Graphically
Configure Static IP address on Fedora 40 Using nmcli
The nmcli is a command line utility and used to configure a static IP address on Fedora Linux. To use this command, you must first open a terminal window (Ctrl+Alt+T). Then, you will need to type in the following commands:
$ nmcli connection show $ nmcli
This will show you a list of all the connections that are currently configured on your system.
In my case, my Fedora system is connected to modem and got the IP from DHCP server. Now to make the IP address static and persistent, run following nmcli commands.
Following commands will modify the existing connection name ‘Wired Connection 1’
Run beneath command to add static ip address along with the gateway ip.
$ sudo nmcli con modify 'Wired connection 1' ifname enp0s3 ipv4.method manual ipv4.addresses 192.168.1.149/24 gw4 192.168.1.1
To add DNS IP address, run
$ sudo nmcli con mod 'Wired connection 1' ipv4.dns 192.168.1.1
To make above changes into the effect, disable and enable the connection,
$ sudo nmcli con down 'Wired connection 1' $ sudo nmcli con up 'Wired connection 1'
Verify the ip address using ip command,
$ ip a s
Output of above commands would like below,
In case, you don’t want to use the existing connection and want to create new connection for configuring the static IP address, run following commands one after the another,
$ sudo nmcli con add type ethernet con-name 'static-fedora' ifname enp0s3 ipv4.method manual ipv4.addresses 192.168.1.179/24 gw4 192.168.1.1 $ sudo nmcli con mod 'static-fedora' ipv4.dns 192.168.1.1 $ sudo nmcli con up 'static-fedora' $ ip a s enp0s3
Assign Static IP Address on Fedora 40 via Graphically
Note: For this method to work, make sure desktop environment is installed on your fedora system.
Login to the desktop environment, go to Settings and then choose Network
Click on gearbox icon,
In following window, Choose IPv4,
Choose ‘Manual’ to assign static ip address, gateway and DNS IP.
Specify details as below:
- IP address: 192.168.1.189
- Netmask: 255.255.255.0
- Gateway IP: 192.168.1.1
- DNS IP: 192.168.1.1
Note: Replace the IP details as per your environment.
Click on Apply.
Now disable and enable the interface to make above changes into the effect.
Close the window and open the terminal and run ip command to verify the ip address.
Prefect, above commands output confirm that static IP address has been configured successfully on our Fedora Linux.
That’s all from this guide. In case you have found it informative, so please do share it among your technical friends.
super, thanks of lot.