How to Set IP Address on Fedora Linux

Fedora Network Scripts

In Fedora Linux, network scripts are configuration files that are used to configure network interfaces and network settings. These scripts are stored in the /etc/sysconfig/network-scripts/ directory and are used to define the settings for each network interface on the system.

The network scripts are named using the following convention: ifcfg-<interface>, where <interface> is the name of the network interface. For example, the configuration file for the Ethernet interface would be named ifcfg-eth0.

Each network script contains a series of options that are used to configure the network interface. Some of the common options include:

  • DEVICE: The name of the network interface.
  • BOOTPROTO: The method used to obtain the IP address. Options include “static” for a static IP address and “DHCP” for a dynamic IP address.
  • IPADDR: The static IP address to be assigned to the interface.
  • NETMASK: The netmask for the IP address.
  • GATEWAY: The default gateway for the interface.
  • DNS1: The primary DNS server to be used by the interface.
  • ONBOOT: Controls whether the interface is brought up automatically when the system boots.

By modifying the options in the network scripts, you can configure the network settings for each interface on your Fedora system. You can also use these scripts to enable or disable specific interfaces, or to change the IP address and other settings for an interface.

How to Set IP Address on Fedora Linux

To set the IP address on a Fedora Linux system, follow these steps:

  1. Open a terminal window and enter the following command to edit the network configuration file:
sudo vi /etc/sysconfig/network-scripts/ifcfg-eth0
  1. Replace “eth0” with the name of your network interface if it is different.
  2. In the file, locate the following lines and update them with the desired IP address, netmask, and gateway:
  1. Save the file and exit the text editor.
  2. Restart the network service to apply the changes:
sudo systemctl restart network
  1. You can verify the new IP address by running the ip a command.

Note: If you want to configure the system to use a dynamic IP address, you can set the BOOTPROTO option to “dhcp” instead of specifying a static IP address.