Configure Static ipADD
Configure Static ipADD
Configure Static ipADD
on AlmaLinux
17 February 2021 by Korbin Brown
When it comes to IP addresses on AlmaLinux, you have two main options for how
you configure your network interfaces. You can either obtain an IP address
automatically with DHCP, or configure the system to use a static IP address, which
never changes.
In this guide, we’ll show how to configure a static IP address on AlmaLinux. This can
be done either through GUI or command line, and we’ll be going over both methods.
Once a static IP address is configured, it won’t change again unless you
manually change the IP address later, or turn DHCP on. You can follow this guide
whether you’ve migrated from CentOS to AlmaLinux or have performed a
normal AlmaLinux installation.
System AlmaLinux
Software N/A
# – requires given linux commands to be executed with root privileges either directly as a root us
Conventions of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user
If you’re running the default GNOME GUI on AlmaLinux, you can follow the steps
below to configure a static IP address.
1. First, click on the top right taskbar area of the GNOME desktop to open the network
settings menu.
Open network settings from top right corner of GNOME desktop
2. Next, open the settings for the network interface you wish to configure.
Open the network settings of the interface that you want to configure
3. Click on the IPv4 or IPv6 tab, depending on which type of IP you want to configure.
Then, select “manual” and fill in your desired IP address, subnet mask, and default
gateway. Optionally, you can also fill in a DNS server. Click “apply” when you’re
done.
Fill out the desired network information for the interface
Configure static IP address via command line
There are several methods we can use to configure a static IP address on AlmaLinux
via command line. Which one you choose will mostly boil down to personal
preference. Follow along with the step by step instructions for any of the methods
below.
$ ip a
...
On our test machine, the interface we’re interested in working with is ens160. Take
note of your interface name, as you’ll need to know it when following along with the
steps below.
BOOTPROTO="none"
IPADDR=192.168.122.66
PREFIX=24
GATEWAY=192.168.122.1
DNS1=192.168.122.1
Fill out your desired network settings in the interface file
In this example, we’ve set our static IP to 192.168.122.66 and set both our gateway
and DNS server to 192.168.122.1. Now, to make our changes to take effect,
we’ll restart the network.
# nmcli connection down ens160 && nmcli connection up ens160
Finally, we set the method to manual to avoid using any other boot protocol for the
interface. This command sets the BOOTPROTO option to none in the interface
configuration file.
# nmtui
Choose to edit a connection
Select “Edit a connection” and then the name of the interface you want to configure.
Then, you can proceed in changing the desired values. For example:
Fill out the desired network information for the interface
Once you’re done with the configuration, select “OK” and press enter. You will be
taken back to the interface selection menu. Now you can select “back”, and then
choose “quit” to exit. To apply the settings, we need to reload the interface
connection.
Closing Thoughts
In this guide, we saw several methods for configuring a static IP address on
AlmaLinux. This involved GNOME GUI, editing interface configuration files
manually, using nmcli, and using nmtui. As you can see, AlmaLinux gives us no
shortage of options for configuring static IPs. All methods are equally effective, and
the one you use should depend on your situation and preference – whether it’s for
GUI, text files, commands, or an ncurses interface.