Facebook Twitter Instagram
    Trending
    • Bash Scripting Introduction
    • How to change your hostname
    • Configuring a static IP on AlmaLinux
    • How to migrate from CentOS 8 to a supported distro
    • Hands on with Rocky Linux 8.3 RC
    • AlmaLinux is Here!
    • AlmaLinux launches in 1 week
    • How to transfer files with SCP command
    Facebook Twitter Instagram
    The Linux Lab
    • Home
    • AlmaLinux

      How to change your hostname

      April 11, 2022

      Configuring a static IP on AlmaLinux

      February 12, 2022

      AlmaLinux is Here!

      March 30, 2021

      AlmaLinux launches in 1 week

      March 24, 2021

      AlmaLinux Beta 1 is here!

      February 2, 2021
    • CentOS
    • Rocky Linux
    • Tutorials
    • About Us
    The Linux Lab
    You are at:Home»AlmaLinux»Configuring a static IP on AlmaLinux

    Configuring a static IP on AlmaLinux

    0
    By Travis on February 12, 2022 AlmaLinux, CentOS, Red Hat, Rocky Linux
    Advertisement

    When you install AlmaLinux, you have two options when it comes to networking – use DHCP or set a static IP. In some cases, you may decide that you want to change from a DHCP to static IP. There are a few ways to do this, and I’ll show you the two I use the most.

    Option 1: Modify Interface Configuration File

    To find your interface name, run the command ip a which will show you your interface IPs.

    Advertisement

    Now, run the following command as root:

    vi /etc/sysconfig/network-scripts/ifcfg-ens18

    Looking at the config, you can see BOOTPROTO is set to dhcp.

     

    Change this line to “none”. Now we just need to add our IP details.

    IPADDR=10.200.1.20
    PREFIX=24
    GATEWAY=10.200.1.1
    DNS1=1.1.1.1

    Prefix is our subnet mask represented in bits.

    Save the config and restart the network.

    nmcli connection down ens18 && nmcli connection up ens18

     

    Option 2: Using nmtui

    Run the following command as root:

    nmtui

    Select Edit a connection.

    Select the connection.

    Modify the connection details.

    Once you’ve modified the connection, restart it.

    nmcli connection down ens18 && nmcli connection up ens18

     

    facebookShare on Facebook
    TwitterTweet
    FollowFollow us

    Advertisement
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Previous ArticleHow to migrate from CentOS 8 to a supported distro
    Next Article How to change your hostname
    Travis

    I am a Cloud Engineer currently working in the financial and web hosting industry. My passion has been Linux since I first discovered it in 2005. Throughout my career, I have always implemented Linux wherever possible and am an advocate of using open source software over proprietary whenever possible. I strongly believe in the UNIX philosophy of "Do One Thing and Do It Well". I started The Linux Lab as a way for people to discover Linux (and UNIX in general, even macOS users) and to find solutions to problems and learn about Linux.

    Related Posts

    How to change your hostname

    How to migrate from CentOS 8 to a supported distro

    Hands on with Rocky Linux 8.3 RC

    Leave A Reply Cancel Reply

    This site uses Akismet to reduce spam. Learn how your comment data is processed.

    Buy Me a Coffee

    Recent Posts
    • Bash Scripting Introduction
    • How to change your hostname
    • Configuring a static IP on AlmaLinux
    • How to migrate from CentOS 8 to a supported distro
    • Hands on with Rocky Linux 8.3 RC
    Recent Comments
    • Travis Newton on Zabbix 4.4 on CentOS 8 Installation
    • Gulman on Zabbix 4.4 on CentOS 8 Installation
    • Sam Andrews on SSH Clients – Which is best?
    • gila on Zabbix 4.4 on CentOS 8 Installation
    • Alex on Zabbix 4.4 on CentOS 8 Installation
    Categories
    • AlmaLinux
    • Bash Scripting
    • CentOS
    • Red Hat
    • Rocky Linux
    • Security
    • Software
    • SSH
    • Tutorials
    • Ubuntu
    • VPN
    • Zabbix
    Copyright © 2022. The Linux Lab.

    Type above and press Enter to search. Press Esc to cancel.

    This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Cookie settingsACCEPT
    Privacy & Cookies Policy

    Privacy Overview

    This website uses cookies to improve your experience while you navigate through the website. Out of these cookies, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may have an effect on your browsing experience.
    Necessary
    Always Enabled
    Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
    Non-necessary
    Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
    SAVE & ACCEPT