How to Set a Static IP for Your Fedora VM: A Step-by-Step Guide

An important and helpful step before diving into any project is to assign a static IP to your VM. This ensures that you don’t have to repeatedly check the server IP for SSH access or modify your automation scripts and Spring Boot projects every time the IP changes. 1. Log in to Your Fedora VM and Discover Your Current IP Address Log into the VM using Virtual Machine Manager. To set up Virtual Machine Manager, follow this guide from my ongoing series: KVM setup on Fedora Once the setup is complete, search for “Virtual Machine Manager” in your system’s search bar. Open the app, “run” the VM by selecting your server, and click on “Open”. This will launch your Fedora QEMU/KVM console. To use SSH, go to your host system’s terminal and run the following command (you’ll be prompted for the root user and password): It’ll look something like this: After logging in, run the following command inside the VM: ip a | grep inet Sample Output: inet 127.0.0.1/8 scope host lo inet6 ::1/128 scope host noprefixroute inet 192.168.124.54/24 brd 192.168.124.255 scope global noprefixroute enp1s0 inet6 fe80::5054:ff:fe57:17c5/64 scope link noprefixroute From the sample output above, you can see the server IP is 192.168.124.54. 2. Determine Your Active Network Interface Before making any changes, let’s identify the active network interface: nmcli connection show Sample Output: NAME UUID TYPE DEVICE enp1s0 19d67abb-cd75-377e-a963-eb9f13582a50 ethernet enp1s0 From the output, our device is enp1s0, which we’ll use in the next step. 3. Set Up a Static IP Profile for Your Fedora VM Create or edit the connection file using the command below. Ensure the IPv4 configuration matches your desired static IP setup. vi /etc/NetworkManager/system-connections/enp1s0.nmconnection Ensure the file contains the following structure: [connection] id=enp1s0 uuid=19d67abb-cd75-377e-a963-eb9f13582a50 type=ethernet autoconnect-priority=-999 interface-name=enp1s0 timestamp=1742568216 [ethernet] [ipv4] address1=192.168.124.54/24,192.168.124.1 dns=8.8.8.8;8.8.4.4; method=manual [ipv6] addr-gen-mode=eui64 method=auto [proxy] After verifying or editing the configuration, set appropriate permissions: chmod 600 /etc/NetworkManager/system-connections/enp1s0.nmconnection 4. Save and Apply Your Network Configuration Changes To apply the new static IP configuration without rebooting: nmcli connection down enp1s0 && nmcli connection up enp1s0 Alternatively, you can simply reboot the VM. 5. Verify Your Static IP Configuration Run the following commands to confirm everything is set correctly: ip a show enp1s0 # You should see your static IP in the output ping 8.8.8.8 # Check internet connectivity ping google.com # Check DNS resolution ✅ You're Done! Happy Learning! Feel free to drop a comment if you face any issues — I’ll try to recreate the error and share steps to resolve it.

May 3, 2025 - 22:12
 0
How to Set a Static IP for Your Fedora VM: A Step-by-Step Guide

An important and helpful step before diving into any project is to assign a static IP to your VM.

This ensures that you don’t have to repeatedly check the server IP for SSH access or modify your automation scripts and Spring Boot projects every time the IP changes.

1. Log in to Your Fedora VM and Discover Your Current IP Address

Log into the VM using Virtual Machine Manager.

To set up Virtual Machine Manager, follow this guide from my ongoing series: KVM setup on Fedora

Once the setup is complete, search for “Virtual Machine Manager” in your system’s search bar. Open the app, “run” the VM by selecting your server, and click on “Open”. This will launch your Fedora QEMU/KVM console.

To use SSH, go to your host system’s terminal and run the following command (you’ll be prompted for the root user and password):

It’ll look something like this:

How to Set a Static IP for Your Fedora VM: A Step-by-Step Guide

After logging in, run the following command inside the VM:

ip a | grep inet

Sample Output:

inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host noprefixroute 
inet 192.168.124.54/24 brd 192.168.124.255 scope global noprefixroute enp1s0
inet6 fe80::5054:ff:fe57:17c5/64 scope link noprefixroute 

From the sample output above, you can see the server IP is 192.168.124.54.

2. Determine Your Active Network Interface

Before making any changes, let’s identify the active network interface:

nmcli connection show

Sample Output:

NAME    UUID                                  TYPE      DEVICE 
enp1s0  19d67abb-cd75-377e-a963-eb9f13582a50  ethernet  enp1s0 

From the output, our device is enp1s0, which we’ll use in the next step.

3. Set Up a Static IP Profile for Your Fedora VM

Create or edit the connection file using the command below. Ensure the IPv4 configuration matches your desired static IP setup.

vi /etc/NetworkManager/system-connections/enp1s0.nmconnection

Ensure the file contains the following structure:

[connection]
id=enp1s0
uuid=19d67abb-cd75-377e-a963-eb9f13582a50
type=ethernet
autoconnect-priority=-999
interface-name=enp1s0
timestamp=1742568216

[ethernet]

[ipv4]
address1=192.168.124.54/24,192.168.124.1
dns=8.8.8.8;8.8.4.4;
method=manual

[ipv6]
addr-gen-mode=eui64
method=auto

[proxy]

After verifying or editing the configuration, set appropriate permissions:

chmod 600 /etc/NetworkManager/system-connections/enp1s0.nmconnection

4. Save and Apply Your Network Configuration Changes

To apply the new static IP configuration without rebooting:

nmcli connection down enp1s0 && nmcli connection up enp1s0

Alternatively, you can simply reboot the VM.

5. Verify Your Static IP Configuration

Run the following commands to confirm everything is set correctly:

ip a show enp1s0
# You should see your static IP in the output

ping 8.8.8.8      # Check internet connectivity
ping google.com   # Check DNS resolution

✅ You're Done!

Happy Learning!

Feel free to drop a comment if you face any issues — I’ll try to recreate the error and share steps to resolve it.