How to configure a static IP address ?
To configure a network interface with a static ip address in Fedora <= 39, create a file called
ifcfg-interface-name
under the folder
/etc/sysconfig/network-scripts
where interface-name is the interface name as reported by the "ifconfig" command.
Example: ifcfg-en01
Edit the file and add the following:
- Modify IPADDR to match your desired static ip address.
- Modify HWADDR to match the MAC address, as reported by ifconfig command (ether)
- DEVICE must match the interface name reported by ifconfig command
- BROADCAST, NETWORK and GATEWAY have to be modified according to your local network.
After a reboot, the Ethernet port will take the fixed address if physically connected.
To configure a network interface with a static ip address in Fedora >= 42, create a file called
ifcfg-interface-name.nmconnection
under the folder
/etc/NetworkManager/system-connections
where interface-name is the interface name as reported by the "ifconfig" command.
Example: ifcfg-en01
Edit the file and add the following:
- Modify "id" and "interface-name" to match the interface name as reported by the "ifconfig".
- Modify "mac-address" to match the MAC address, as reported by "ifconfig" command (ether)
- Modify "addresses" to match your desired static ip address.
- "dns" and "gateway" have to be modified according to your local network.
After a reboot, the Ethernet port will take the fixed address if physically connected.