•  Home
  •  Dashboard
  •  Company
    • About Us
    • Blog
    • Careers
    • Contact Us
    • Data Centers
    • Looking Glass
    • Network
    • Reseller
  •  Hosting Services
    • Infrastructure
      • iColocation
    • Compute
      • cMetal
      • cVirtual
    • Storage
      • sObject
      • sBlock
    • Networking
      • nCDN
      • nIP Transit
      • nWavelength
    • Protection
      • pBackup
      • pDDoS
  •  Solutions
    • Ecommerce
    • Finance
    • Gaming
    • Hosting
    • Management
    • Security
    • System Integrator
  •  Support
    • Community
    • Knowledge Base
    • Open A Ticket
  •  USA & Canada: 800-933-1517
  •  International: 626-549-2801
  •  Email: sales@psychz.net
  • Services
    • new-colocation-header-img
      Infrastructure
      • iColocation
    • new-compute-header-img
      Compute
      • cMetal
      • cVirtual
    • new-storage-header-img
      Storage
      • sObject
      • sBlock
    • new-networking-header-img
      Networking
      • nCDN
      • nIP Transit
      • nWavelength
    • new-protection-header-img
      Protection
      • pBackup
      • pDDoS
  • Solutions
    • Ecommerce
    • Security
    • Gaming
    • Hosting
    • Management
    • Finance
    • System Integrator
  • Dashboard

How to configure IP's On Centos 7?

  • Home
  • Client
  • Knowledgebase
  • Linux
  • Centos 7
  • How to configure IP's On Centos 7?

Table Of Content

Related Articles

  • Installing MariaDB on Centos 7
  • How to install the GCC compiler in CentOS 7?
  • How to Install SSL Certificate On Centos 7
  • Linux Command Line Tutorial For Git
  • How To Install Git On Centos 7
  • Installation of Lamp Stack on CentOS 7
  • Yum Update Not Working on Centos 7
  • Views: (4716)
  • Votes: (0)
Was this article helpful?
VOTE

How to configure IP's On Centos 7?

Publisher: Psychz Networks,  February 05,2020

CentOS 7 uses NetworkManager daemon to manage primary network connection and other network interfaces, like Ethernet, WiFi, etc. This tool is easy to use and makes network configuration and operations as painless as possible. In the following article, we will configure a network interface using 'ifcfg' files located in /etc/sysconfig/network-scripts/ directory in a CentOS 7. NetworkManager is a software utility that aims to simplify the use of computer networks. NetworkManager is available for Linux kernel-based and other Unix-like operating systems.

In the following steps we will learn how to configure IPs on CentOS 7 using NetworkManager for both IPv4 and IPv6. Following are the steps covered

  • Configuring IPv4
    • Step 1: Edit Network Configuration File
    • Step 2: Restart Network Service
    • Step 3: Verifying DNS Settings
  • Configuring IPv6
    • Step 1: Editing sysctl.conf file
    • Step 2: Editing Network file
    • Step 3: Editing ifcfg-eth0 file
    • Step 4: Restart Network service

Steps to configure IPv4

Step 1

Open and edit the network configuration file for (eth0 or eth1) an editor to assign IP Address to eth0 or eth1 interface as follows.

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

Output:

HWADDR=00:11:AA:BB:CC:DD
TYPE=Ethernet
BOOTPROTO=none
# Server IP #
IPADDR=192.XXX.XX.XXX
# Subnet #
PREFIX=24
# Set default gateway IP #
GATEWAY=192.XXX.XX.XXX
# Set dns servers #
DNS1=8.8.8.8
DNS2=8.8.4.4
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
# Disable ipv6 #
IPV6INIT=no
NAME=eth0
# This is system specific and can be created using 'uuidgen eth0' command #
UUID=41171a6f-bce1-44de-8a6e-cf5e782f8bd6
DEVICE=eth0
ONBOOT=yes

The lines marked in bold are the important ones as you will have to modify them as per your needs.

Note: In case you find no file under /etc/sysconfig/network-scripts/ we need to create one. Create a file named /etc/sysconfig/network-scripts/ifcfg-eth0 using a VI editor and add the above content in the file. Press Esc and then :wq (to save and exit)

Step 2

Now, Restart network service

# systemctl restart network

Let us now verify the IP settings

# ip a s eth0

Output

eth0: <BROADCAST, MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
link/ether 00:08:a2:0a:ba:b8 brd ff:ff:ff:ff:ff:ff
inet 192.XXX.XX.XX/24 brd 192.XXX.X.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::208:a2ff:fe0a:bab8/64 scope link
valid_lft forever preferred_lft forever

Step 3

Verifying DNS server settings

# cat /etc/resolv.conf

Output

# Generated by NetworkManager
nameserver 8.8.8.8
Nameserver 8.8.4.4

The last step to verify that you have successfully configured the network on your CentOS machine is to check if you can reach any site. You can simply use the "Ping" command followed by the web address (e.g. google.com) and you will get the results

Steps to configure IPv6

IPv6 possess certain features that are superior to IPv4 address in terms of efficient routing, directed data flows, simplified network configuration, security and much more.

Following are the steps to assign IPv6 address on your server

Step 1

You need to edit sysctl.conf file. Using VIM editor open the file to edit it.

# vim /etc/sysctl.conf

Add the following two lines at the end of the file

net.ipv6.conf.default.disable_ipv6 = 0

net.ipv6.conf.all.disable_ipv6 = 0

Save and exit using "esc + :wq"

Step 2

Edit the network file using VIM editor which is located under /etc/sysconfig/

# vim /etc/sysconfig/network

Add the following line at the end of the file.

NETWORKING_IPV6=yes

Save and exit using "esc + :wq"

Step 3

Now we will edit the ifcfg-eth0 file under the path /etc/sysconfig/network-scripts/

# vim sysconfig/network-scripts/ifcfg-eth0

Append the following lines to the file,

IPV6INIT=yes

IPV6ADDR=2001:0db8:ABCD:XXXX:XXXX:XXXX:XXXX:XXXX

IPV6_DEFAULTGW=2001:0db8:ABCD:XXXX:XXXX:XXXX:XXXX:XXXX

Save and exit using "esc + :wq"

Note: Kindly replace the IPv6 address and default gateway with the one provided to you.

Step 4

Now you may restart the network service to bring all the changes into effect

# /etc/init.d/network/restart

You can test the connection by pinging any website (e.g. www.google.com)

Related Articles

  • Installing MariaDB on Centos 7
  • How to install the GCC compiler in CentOS 7?
  • How to Install SSL Certificate On Centos 7
  • Linux Command Line Tutorial For Git
  • How To Install Git On Centos 7
  • Installation of Lamp Stack on CentOS 7
  • Yum Update Not Working on Centos 7
  • Views: (4716)
  • Votes: (0)
Was this article helpful?
VOTE
Copyright © 2025 Psychz Networks,
A Profuse Solutions Inc Company
Hosting Services
Infrastructure
  • iColocation
Compute
  • cMetal
  • cVirtual
Storage
  • sObject
  • sBlock
Networking
  • nCDN
  • nIP Transit
  • nWavelength
Protection
  • pBackup
  • pDDoS
Company
  • About Us
  • Blog
  • Careers
  • Contact Us
  • Data Centers
  • Looking Glass
  • Network
  • Reseller
Policies
  • Acceptable Usage Policy
  • Privacy Policy
  • Service Level Agreement
  • Terms and Conditions
Support
  • Community
  • Knowledge Base
  • Open A Ticket
Get In Touch
  • Psychz Networks,
    A Profuse Solutions Company
    611 Wilshire Blvd #300
    Los Angeles,California 90017
    USA
  • US/Canada: 800-933-1517
  • International: 626-549-2801