Jack Wallen reveals you the way straightforward it’s to set a static IP in Rocky Linux 9 from the terminal.
Rocky Linux 9 is a good server working system that comes from the person who created CentOS. This working system affords loads of options that nicely serve enterprise wants. Given that the majority admins are already conversant in the likes of Red Hat Enterprise Linux and CentOS, they shouldn’t have any drawback getting up to pace with Rocky Linux both.
SEE: 40+ open supply and Linux phrases you want to know (TechRepublic Premium)
However, there may be one difficulty that you just’ll want to take care of nearly instantly: the IP deal with. Out of the field, Rocky Linux defaults to DHCP for its IP deal with. Yes, you possibly can configure a static IP deal with throughout set up, however that step tends to slip previous admins wanting to get the OS up and operating rapidly. Even I’ve discovered myself responsible of forgetting to set the IP deal with to guide in the title of pace.
When that occurs, what do you do? You do what all good admins do: Don your greatest geek hat, and dive into the configuration. Let me present you the way it’s finished.
What you’ll want to set a static IP deal with in Rocky Linux
The solely stuff you’ll want for this are a operating occasion of Rocky Linux 9 and a person with sudo privileges.
I’m going to assume you didn’t set up Rocky Linux with a GUI, as configuring a static IP by way of the community supervisor UI may be very easy (Wired Settings | IPv4 | Manual). Instead, we’re going to do that from the command line.
Fun instances! Let’s get to work.
How to set a static IP deal with
Log in to your Rocky Linux occasion and it is best to end up on the terminal. You mustn’t do that over SSH, as a result of you’ll wind up unable to attain the server at one level. Because of that, be sure to are bodily on the Rocky Linux server terminal.
The very first thing you’ll do is find the title of the community interface to be used, which is finished by way of the command:
You’ll be searching for a title like enp0s3, which is able to have already got an IP deal with assigned by way of DHCP.
For instance, mine seems like this:
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
hyperlink/ether 08:00:27:e1:01:43 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.190/24 brd 192.168.1.255 scope international dynamic noprefixroute enp0s3
Now that you realize the title of the interface, we’ll be utilizing an ncurses device, named nmtui, to set the deal with. Issue the command:
In the ensuing window (Figure A), choose Edit A Connection and hit Enter in your keyboard.
In the subsequent window, choose the title of the interface you need to edit utilizing your arrow keys, tab to the correct pane, choose Edit and hit Enter in your keyboard.
In the ensuing window (Figure B), tab down to IPv4 CONFIGURATION <Automatic> and hit Enter in your keyboard.
A popup will seem the place you’ll want to choose Manual along with your arrow keys after which hit Enter in your keyboard. Tab to <Show> and hit Enter to reveal with static IP deal with configuration (Figure C).
Tab down to every part and configure Address, Gateway, and DNS servers at a minimal. Do observe that with the DNS server configuration, you have to add one per line — no comma-separated values.
Once you’ve configured these bits, tab down to OK and hit Enter in your keyboard. You then want to again out of the Edit window and go to Activate A Connection. Deactivate the interface after which reactivate it by tabbing to Deactivate (Figure D) and hitting Enter in your keyboard.
Once you’ve activated the interface, the brand new static IP deal with will take impact and also you’re prepared to work.
And that’s all there may be to set a static IP deal with on Rocky Linux. If you’re paying consideration through the set up course of, you possibly can maintain this job earlier than the OS is deployed. But, should you’re like me and also you recurrently overlook that step, you now have the data to repair that oversight.
Subscribe to TechRepublic’s How To Make Tech Work on YouTube for all the newest tech recommendation for enterprise execs from Jack Wallen.