“TeckMile.com – Elevating Your Skills and Creativity, One Project at a Time.”

Setting Up a Static IP on Rocky Linux

This guide provides a numbered step-by-step approach to setting up an Ethernet network with a static IP on Rocky Linux. Customize the IP address and device name as needed for your specific configuration.

Step 1: Check Network Manager Status

systemctl status NetworkManager

Step 2: Edit Interface Configuration

cd /etc/sysconfig/network-scripts

sudo nano 'interface name'

Update the interface configuration as needed. Below is an example with a static IP configuration:

TYPE=Ethernet 
PROXY_METHOD=none 
BROWSER_ONLY=no 
BOOTPROTO=none 
DEFROUTE=yes 
IPV4_FAILURE_FATAL=no 
IPV6INIT=no NAME=ens18 
UUID=74c5ccee-c1f4-4f45-883f-fc4f765a8477 
DEVICE=ens18 
ONBOOT=yes 
IPADDR=192.168.43.44 
PREFIX=24 
GATEWAY=192.168.43.1 
DNS1=192.168.43.1 
DNS2=1.1.1.1 
IPV6_DISABLED=yes

Step 3: Reload Network Configuration

Note: Your interface name may differ.

nmcli connection up 'enp0s3'

Step 4: Check Network Configuration

nmcli device show enp0s3

Step 5: Get Connection State

nmcli connection show

Step 6: Shortcuts to nmcli to Bring Network Up or Down

ifup enp0s3 ifdown enp0s3

Step 7: Get General Network Information

ip a

Step 8: Assign a Static IP Address to a Link

Note: Be sure to Change your IP Address and Device name.

ip addr add 192.168.43.44/24 dev enp0s3

Step 9: Check the IP Address has been changed

ip a show enp0s3

Step 10: Add an Interface to the New IP Address

ifcfg enp0s3 add 192.168.43.44

Additional:

If you wanted to remove the address later you could use:

ifcfg enp0s3 del 192.168.43.44

If you wanted to disable the interface later you could use:

ifcfg enp0s3 stop

To check the public IP of the server you can use the command:

curl http://checkip.amazonaws.com


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *