How to setup static IPv4 in centos7 ?

To Know about network interface installed in your computer with command

ip a  or # nmcli –p dev

Step 1: Create/edit the file

Create or edit this file /etc/sysconfig/network-scripts/ifcfg-eth0.

Check if the file exist to edit or create a file in the path with file name “ifcfg-eth0” or as per network interface.

DEVICE="eth0"

ONBOOT=yes

NETBOOT=yes

UUID="45682a6f-brt1-43te-8v7e-cf4t692f8bd6"

IPV6INIT=yes

BOOTPROTO=dhcp

HWADDR="10:02:c2:0n:qw:y8"

TYPE=Ethernet

NAME="eth0"

Step 2: Configuring an eth0 interface

There are 2 ways to configure static IP

First method:

Edit or create a new file by the name of ifcfg-eth0 in /etc/sysconfig/network-scripts/ directory with command

# vi /etc/sysconfig/network-scripts/ifcfg-eth0

Update IPADDR with preferred IP address. 

 

Save and close file. 

Restart the network service using command 

# systemctl network restart 

Check and verify the whether the IP has been assigned to the network interface using command 

# ip a or # ip a s eth0 

Check the internet connectivity using ping command 

# ping –c 3 google.com  

Second Method:

Using network manager interface command 

# nmtui edit eth0. 

Manually input the IP in the eth0 interface save and restart.

 

 

 

 

 

 

 

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to add IP Address to servers

1.Login to the server via RDP. 2.In the Run window type NCPA.CPL. 3.In the network properties...

How to configure IP's on Ubuntu 18?

To configure a static IP address on your Ubuntu 18.04 server you need to modify a relevant...

How to install Wordpress in webmin

  The following steps are followed for installing Wordpress in Webmin   Open File Manager in...

How to install Webmin in CentOs

  Installing webmin using YUM repository Create a .repo file using a command # nano...

How to install Virtualmin in webmin

  Steps for Installing Virtualmin on Webmin (Ubuntu):   Setting the hostname and FQDN For...