Static IP Address with NetworkManager for Fedora
Command-Line Instructions
After much digging, I found that the ifcfg-* file names, and the NAME=
variable in the file have very little to do with the actual assignment. You can literally change them to whatever you want... I did a test on my machine changing them to eth0
and the manual/static IP was still applied upon startup. The key here seems to the be HWADDR
variable inside the file. The NAME=
value only seems to be the name displayed in the graphical Network Manager settings. So, that being said I believe all you need to do is...
Make sure
NetworkManager.service
is still enabled, andnetwork.service
is disabled.The most IMPORTANT step is to delete the current ifcfg-enp2s5 script.
sudo rm /etc/sysconfig/network-scripts/ifcfg-enp2s5
Create a new script named ifcfg-p3p1
sudo nano /etc/sysconfig/network-scripts/ifcfg-p3p1
Set the contents of ifcfg-p3p1 to the following, and update the respective IP settings with your desired settings.
TYPE=Ethernet BOOTPROTO=none DEFROUTE=yes IPV4_FAILURE_FATAL=no IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_FAILURE_FATAL=no NAME=p3p1 UUID=7622e20e-3f2a-4b5c-83d8-f4f6e22ed7ec ONBOOT=yes DNS1=10.0.0.1 IPADDR0=10.0.0.2 PREFIX0=24 GATEWAY0=10.0.0.1 HWADDR=00:14:85:BC:1C:63 IPV6_PEERDNS=yes IPV6_PEERROUTES=yes
As for why the ifcfg-* name was different from the actual device name. I don't know but suspect it has something to do with how the Network settings were applied during installation.
Graphical Instructions
- Open System Settings
- Click on Network
- Click on Options...
- Click on the IPv4 Settings* or IPv6 Settings tab depending on what IP version your home network is using (most likely IPv4).
- Click on the Method combo-box and select the Manual option.
- Click on the Add button.
- Type the address you want in the Address columns (e.g. 10.0.0.20).
- Type the netmask for your network in the Netmask column (e.g. 255.255.255.0).
- Enter the gateway (usually your router's IP) in the Gateway column (e.g. 10.0.0.1)
Enter your DNS server in the DNS servers text-box (e.g. 10.0.0.1)
- Click on Save...
- When you return to the Network settings, turn the Wired interface OFF.
It should automatically turn back on with the static address information you entered in the previous steps. If it does not turn on, click the toggle switch to turn it on.
To answer your question about using the NetworkManager.service
over network.service
. There is definitely potential it could be removed in later releases. As a general rule of thumb though, no matter the topic is, you should always try to avoid using anything "included for backwards compatibility". So, you should stick to using NetworkManager
if you can.