A stable address matters as soon as Fedora hosts SSH sessions, file shares, port-forwarded services, DNS records, or monitoring checks that should not move after every DHCP renewal. To configure a static IP address on Fedora Linux, keep NetworkManager in charge unless you have a deliberate reason to replace it, then change the active connection profile with GNOME Settings, nmcli, or a root-owned NetworkManager keyfile.
The examples focus on IPv4 because it is the common home lab, office LAN, and small-server case. The same planning rules apply to IPv6: use an address your network actually routes, keep DNS explicit, and make remote changes from a console or rollback-safe session when losing the active address would lock you out.
Configure a Static IP Address on Fedora with NetworkManager
Fedora Workstation and many Fedora Server installs use NetworkManager for persistent network profiles. Use the active profile name, not only the interface name, because profile names can contain spaces and may not match the device.
On fresh Fedora 44 Server or network-installer systems, Anaconda creates persistent profiles only for devices configured during installation. If the target network card was unplugged or skipped during setup, verify the profile with nmcli instead of assuming an old /etc/sysconfig/network-scripts/ifcfg-* file exists.
Network changes can interrupt SSH, remote desktop, file shares, and package downloads. Keep a local console, hypervisor console, or second tested access path available before changing the address on a system you manage remotely.
Record the Active Fedora Connection
Start with read-only checks so you know which profile, device, address, route, and DNS server you are about to change.
nmcli -t -f NAME,TYPE,DEVICE connection show --active
nmcli device status
A typical wired Fedora system can show one Ethernet profile and the loopback profile:
Wired connection 1:802-3-ethernet:ens160 lo:loopback:lo DEVICE TYPE STATE CONNECTION ens160 ethernet connected Wired connection 1 lo loopback connected (externally) lo
Record the current IPv4 address, default route, and DNS server before editing the profile. These values help you choose a compatible static address and give you a quick rollback reference.
ip -br -4 addr show scope global
ip route show default
resolvectl dns
Example output from a DHCP-managed Fedora host looks like this:
ens160 UP 192.168.50.233/24 default via 192.168.50.1 dev ens160 proto dhcp src 192.168.50.233 metric 100 Global: Link 2 (ens160): 192.168.50.1
In this example, ens160 is the interface, 192.168.50.233/24 is the current DHCP address, 192.168.50.1 is the gateway and DNS server, and Wired connection 1 is the NetworkManager profile to edit. If your account cannot run administrative commands yet, add it to Fedora’s wheel group with the guide to add a user to sudoers on Fedora.
Plan the Fedora Static IP Values
Choose an address that belongs to the same subnet but is not already leased to another device. If your router leases 192.168.1.100 through 192.168.1.200, either choose an unused address outside that pool or create a router DHCP reservation instead.
| Value | Example | How to Choose It |
|---|---|---|
| Connection profile | Wired connection 1 | Use the active profile from nmcli connection show --active. |
| Device | ens160 | Use the connected interface from nmcli device status. |
| Static address | 192.168.1.50/24 | Pick an unused address in the subnet and include the prefix length. |
| Gateway | 192.168.1.1 | Use the router shown by ip route show default, unless your network admin gave you another gateway. |
| DNS servers | 1.1.1.1 8.8.8.8 | Use your router, internal DNS, or public resolvers that match your network policy. |
The Fedora addressing reference notes that static addresses should include a prefix length so the system can build the connected route correctly. A dotted netmask such as 255.255.255.0 maps to /24, while 255.255.0.0 maps to /16.
Save Static IPv4 Settings with nmcli
Set variables for the active profile and device you recorded earlier. Keep the quotes around the connection name because Fedora profile names often contain spaces.
CONNECTION="Wired connection 1"
DEVICE="ens160"
Change the NetworkManager profile to manual IPv4 addressing. Replace the address, gateway, and DNS servers with values from your network plan.
sudo nmcli connection modify "$CONNECTION" \
ipv4.method manual \
ipv4.addresses "192.168.1.50/24" \
ipv4.gateway "192.168.1.1" \
ipv4.dns "1.1.1.1 8.8.8.8"
This changes the saved profile, but the running interface may still use the old DHCP lease until NetworkManager reapplies or reconnects the profile.
Review the stored values before applying them. The first line should read manual, and the remaining lines should match the address, gateway, and DNS servers you chose.
nmcli -g ipv4.method,ipv4.addresses,ipv4.gateway,ipv4.dns connection show "$CONNECTION"
Apply the profile to the active device. nmcli device reapply is less disruptive than bringing the whole connection down and back up, but any address or route change can still interrupt remote sessions.
sudo nmcli device reapply "$DEVICE"
If the address does not change after a reapply, activate the edited profile from a local terminal or console.
sudo nmcli connection up "$CONNECTION"
Verify the Static IP Address on Fedora
After applying the profile, check the address, default route, DNS servers, gateway reachability, outbound routing, and hostname resolution. Replace ens160 and 192.168.1.1 with your interface and gateway.
ip -br -4 addr show dev ens160
ip route show default
resolvectl dns ens160
ping -c 3 192.168.1.1
ping -c 3 1.1.1.1
getent hosts fedoraproject.org
Read the checks in order. The address check should show the static IPv4 address, the route check should show the correct gateway, the DNS check should show the intended resolvers, the gateway ping should prove local LAN access, the public IP ping should prove outbound routing, and getent hosts should prove name resolution.
Set a Static IP from Fedora Workstation Settings
Fedora Workstation users can set the same NetworkManager values from GNOME Settings. Use this path when you are at the desktop and prefer a graphical workflow over terminal commands.
- Open Settings.
- Select Network for wired connections or Wi-Fi for wireless connections.
- Open the gear icon for the active connection.
- Select the IPv4 tab and change the method from automatic DHCP to Manual.
- Enter the static address, netmask, gateway, and DNS servers. For example,
192.168.1.50,255.255.255.0, and192.168.1.1describe the same network as192.168.1.50/24. - Apply the change and reconnect the edited connection if Fedora does not reapply it automatically.
If the Fedora desktop is also the remote host you depend on, make the change from the local screen, VM console, or provider console. A wrong gateway or duplicate address can disconnect SSH, remote desktop, and network shares at the same time.
Use a Router DHCP Reservation Instead
A DHCP reservation is often safer on a home or office LAN because Fedora can keep using DHCP while the router always gives the same address to the same MAC address. Use this method when you control the router and need stable SSH, port forwarding, media server, printer, or lab-host addressing.
Find the MAC address for the interface you want to reserve. Replace ens160 with your Fedora device name.
nmcli -f GENERAL.DEVICE,GENERAL.HWADDR device show ens160
Open the router or DHCP server, add a reservation for that MAC address, and choose an address that does not conflict with another host. Then reconnect Fedora so it requests a fresh lease. Replace Wired connection 1 with your active profile name.
sudo nmcli connection up "Wired connection 1"
Use the same verification checks after the new lease appears. If the reservation is for a server, confirm SSH on Fedora still answers at the reserved address before you change DNS records or port-forwarding rules.
Write a NetworkManager Keyfile on Fedora
NetworkManager keyfiles are useful for provisioning, Fedora CoreOS or bootc-style image workflows, and advanced systems where network profiles need to exist before the first boot. On an ordinary running Fedora workstation or server, prefer GNOME Settings or nmcli because they update the profile through NetworkManager’s normal API.
For Fedora CoreOS first-boot networking, Fedora’s Host Network Configuration documentation covers Ignition, kernel arguments, and embedding NetworkManager keyfiles before the installed system starts. Keep those provisioning paths separate from live nmcli edits on a normal Fedora install.
Modern Fedora stores new profiles as NetworkManager keyfiles under /etc/NetworkManager/system-connections/, /usr/lib/NetworkManager/system-connections/, or /run/NetworkManager/system-connections/. The upstream NetworkManager keyfile reference states that keyfiles are INI-style files and must be root-only, because they can contain secrets. The 0600 mode in the example follows normal chmod permission syntax: root can read and write the file, while group and other users cannot read it.
Do not edit a keyfile for the active remote connection without console access. A missing permission bit, wrong interface name, duplicate profile, or bad gateway can prevent NetworkManager from activating the profile you need.
Create a new keyfile for an Ethernet profile. Replace ens160, static-ens160, the address, gateway, and DNS servers with values from your network. Use a new file name so you do not overwrite an existing profile by accident. This sequence creates the root-owned file first, then writes through sudo tee so normal shell redirection does not try to write to a protected path.
KEYFILE=/etc/NetworkManager/system-connections/static-ens160.nmconnection
sudo install -m 0600 -o root -g root /dev/null "$KEYFILE"
printf '%s\n' \
'[connection]' \
'id=static-ens160' \
'type=ethernet' \
'interface-name=ens160' \
'autoconnect=true' \
'' \
'[ethernet]' \
'' \
'[ipv4]' \
'method=manual' \
'address1=192.168.1.50/24' \
'gateway=192.168.1.1' \
'dns=1.1.1.1;8.8.8.8;' \
'' \
'[ipv6]' \
'method=auto' | sudo tee "$KEYFILE" > /dev/null
sudo chmod 0600 "$KEYFILE"
Load the new keyfile into NetworkManager and confirm the connection appears from the expected file.
sudo nmcli connection load "$KEYFILE"
nmcli -f NAME,TYPE,DEVICE,FILENAME connection show
Activate the keyfile profile from a local console when you are ready for the address to change.
sudo nmcli connection up static-ens160
Fedora’s older ifcfg examples under /etc/sysconfig/network-scripts/ are legacy material for upgraded or specially configured systems. If your real task is replacing NetworkManager with another manager, use the separate workflow to disable NetworkManager on Fedora instead of mixing managers on the same interface.
Use ip Commands Only for Temporary Tests
The ip command can add an address at runtime, but that change is not a persistent Fedora NetworkManager profile. Use it only for short tests, lab recovery, or adding a secondary address while you confirm that the address is unique.
sudo ip address add 192.168.1.50/24 dev ens160
ip -br -4 addr show dev ens160
Remove the temporary address after the test so NetworkManager’s saved profile remains the source of truth.
sudo ip address del 192.168.1.50/24 dev ens160
A temporary address does not replace a persistent NetworkManager profile. If the address must survive reconnects or reboots, save it with nmcli, GNOME Settings, a router reservation, or a keyfile.
Return Fedora to DHCP
Return to DHCP when the router will own the reservation, when the host moves to another network, or when troubleshooting needs a clean automatic lease. For a NetworkManager profile changed with nmcli, set the current shell variables again if needed, then switch IPv4 back to automatic addressing and clear the manual values.
CONNECTION="Wired connection 1"
DEVICE="ens160"
sudo nmcli connection modify "$CONNECTION" \
ipv4.method auto \
ipv4.addresses "" \
ipv4.gateway "" \
ipv4.dns "" \
ipv4.ignore-auto-dns no
Reapply or reconnect from a local console when you are ready for Fedora to request a DHCP lease again.
sudo nmcli device reapply "$DEVICE"
If you created a separate static keyfile profile, first reactivate a known DHCP profile, then delete only the static profile you created.
nmcli connection show
sudo nmcli connection up "Wired connection 1"
sudo nmcli connection delete static-ens160
Run the verification checks again after the DHCP lease appears. The default route should return to proto dhcp or another DHCP-managed form, depending on your network.
Troubleshoot Static IP Problems on Fedora
The troubleshooting commands use the same NetworkManager profile and device variables from the nmcli workflow. If you are in a new terminal, set them again before running commands that reference $CONNECTION or $DEVICE.
CONNECTION="Wired connection 1"
DEVICE="ens160"
SSH Drops After Applying the Profile
A dropped SSH session usually means the active address, route, or DNS settings changed before the new path was reachable. Use a local console, VM console, or provider recovery console to inspect the active profile.
nmcli device status
nmcli -g ipv4.method,ipv4.addresses,ipv4.gateway,ipv4.dns connection show "$CONNECTION"
ip -br -4 addr show
ip route show default
If the address is wrong, return the profile to DHCP or correct the static values from the console, then bring the profile up again. Once the host is reachable, verify SSH on Fedora from a second terminal before closing the recovery session.
Fedora Still Uses the Old DHCP Address
NetworkManager may have saved the profile but not reapplied it to the device yet, or you may have edited a disconnected profile with a similar name. Check the active profile and stored IPv4 method together.
nmcli -t -f NAME,TYPE,DEVICE connection show --active
nmcli -g ipv4.method,ipv4.addresses connection show "$CONNECTION"
If the active profile is correct but the old lease remains, reapply the device or bring the connection up from a console.
sudo nmcli device reapply "$DEVICE"
sudo nmcli connection up "$CONNECTION"
Gateway Works but DNS Fails
When gateway pings work but hostnames fail, the address and route are probably correct while DNS is missing or wrong. Check the DNS servers attached to the interface and retest name resolution.
resolvectl dns ens160
getent hosts fedoraproject.org
If the DNS list is empty or points to the wrong resolver, update the profile and reapply it.
sudo nmcli connection modify "$CONNECTION" ipv4.dns "192.168.1.1 1.1.1.1"
sudo nmcli device reapply "$DEVICE"
If applications report resolver errors after these checks pass, the DNS troubleshooting flow for curl could not resolve host helps separate local resolver state from upstream DNS or proxy issues.
NetworkManager Ignores a Keyfile
NetworkManager ignores keyfiles that are readable or writable by non-root users. Check ownership and permissions, then load the corrected file again.
sudo ls -l /etc/NetworkManager/system-connections/static-ens160.nmconnection
sudo chown root:root /etc/NetworkManager/system-connections/static-ens160.nmconnection
sudo chmod 0600 /etc/NetworkManager/system-connections/static-ens160.nmconnection
sudo nmcli connection load /etc/NetworkManager/system-connections/static-ens160.nmconnection
nmcli -f NAME,TYPE,DEVICE,FILENAME connection show
If the profile still does not load, check the key names, section names, and interface name. A typo in interface-name= can leave the profile valid but unattached to the device you expected.
Old ifcfg Examples Do Not Match Fedora
Many older Fedora and RHEL-family examples edit /etc/sysconfig/network-scripts/ifcfg-*. Fedora moved new NetworkManager profiles toward keyfiles years ago, and Fedora’s ifcfg-to-keyfile migration notes explain why current systems may not include the old ifcfg plugin unless they were upgraded or specially configured.
Check where your active profile is stored before following any file-based example.
nmcli -f NAME,TYPE,DEVICE,FILENAME connection show
If the file path points under /etc/NetworkManager/system-connections/ or /run/NetworkManager/system-connections/, use NetworkManager keyfile or nmcli syntax instead of legacy ifcfg variables. If the profile truly lives under /etc/sysconfig/network-scripts/, consider migrating it during a maintenance window rather than expanding an old ifcfg workflow.
Conclusion
Fedora keeps its address consistently when the static values live in the same place that manages the connection: NetworkManager profiles for normal systems, router reservations for LAN-owned addresses, and keyfiles for advanced provisioning. After the address is stable, review exposed services with Firewalld on Fedora and keep host identity clear with the Fedora hostname configuration workflow.


Formatting tips for your comment
You can use basic HTML to format your comment. Useful tags currently allowed in published comments:
<code>command</code>command<strong>bold</strong><em>italic</em><blockquote>quote</blockquote>