how to set static IP on CentOS 7.5 +

Posted by

Trying to install de QRadar CE (community edition) in my home lab I found a pre-requisite, “static IP” so let’s check the steps I used to configure it.

1. Internet adapter

To know the internet adapter just do an [ifconfig], example:

Screen Shot 2019-07-13 at 18.00.28
ifconfig info

There you will see two options, “enp0s3″ and “lo“, specifically “inet” will show you the IP address, Netmask and Broadcast. So, there you can confirm the adapter the device is using is [enp0s3].

Note: if the command “ipconfig” is not working, “command not found” check this post.

2. Locate the adapter file configuration

[root@tonk~]# locate enp0s3
/etc/sysconfig/network-scripts/ifcfg-enp0s3
/var/lib/NetworkManager/dhclient-2baccc40-48c8-4e6c-845d-475bc2911b6e-enp0s3.lease
/var/lib/dhclient/dhclient–enp0s3.lease
[root@tonk~]#

3. Do a backup of the file

[root@tonk~]# cp /etc/sysconfig/network-scripts/ifcfg-enp0s3 /etc/sysconfig/network-scripts/ifcfg-enp0s3.bk

4. Edit the file and add the following lines, “you need to know the ip address, netmask and gateway”

[root@tonk~]# cat /etc/sysconfig/network-scripts/ifcfg-enp0s3
#BOOTPROTO=”dhcp”
BOOTPROTO=”static”
IPADDR=192.168.1.13
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
[root@tonk~]#

5. Restart network service

[root@tonk~]# systemctl restart network

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s