•  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

Centos 7 Network Config

  • Home
  • Client
  • Qa Forum
  • Centos 7 Network Config

Posted By: Wun | 1 Replies | Last Reply On: Oct 25, 2017 05:14:57

How to configure network under centos 7? 

Psychz - Raviteja

Votes: 0Posted On: Oct 25, 2017 05:14:57
 

This article will help you to configure the network on a CentOS 7 operating system. Configuring network on any operating system involves configuring an IP range for the system. Also, you have to decide whether you want to configure a static IP or dynamic IP. We will guide you towards configuring both.


Prerequisites

1) Operating system: CentOS 7
2) Minimum of one Active network interface
3) Root permission


Static IP configuration

Step 1 - Check the network interfaces by using the command:

ifconfig


The network configuration file in CentOS 7 is stored in “/etc/sysconfig/network-scripts”. There are multiple network files under “network-scripts” directory depending on the number of interfaces configured. The following steps will show you how to bind a range of IPs.

 

Step 2 - Edit the network interface file to which you want the static IP assigned.

vi /etc/sysconfig/network-scripts/ifcfg-enp2s0

Note: This file can be edited using a VI editor to configure static IP in the server. The different parameters to be added are:

 

BOOTPROTO – It is the protocol to be implemented during Boot time. It has to be changed to “static” for static IP configuration.
IPADDR – Edit the IP address in the IPADDR field
PREFIX – Add the IP range that has to be configured.
NETWORK – Add the network IP of the IP range.
GATEWAY – Add the Gateway IP
DNS - Add the address of the DNS server.

Save and close the file.
 
Step 3 - Restart the network services by the command

Systemctl restart network

 

 

DHCP Configuration on CentOS 7

 

DHCP server Installation

1.Please run the following command to install DHCP server.

yum -y install dhcp

 

2.Once the server is installed, copy the sample configuration file.

cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcpd.conf

 

3.Once the sample configuration file is copied, we edit the configuration file using vi editor.

vi /etc/dhcp/dhcpd.conf

 

DHCP file configuration

1. Edit the "dhcpd.conf" file with the help of an editor and modify it as follows.
 

# specify domain name
option domain-name "linux.host";
# specify name server's hostname or IP address
option domain-name-servers dlp.srv.world;
# default lease time
default-lease-time 600;
# max lease time
max-lease-time 7200;
# If the DHCP server is to be declared valid
authoritative;
# specify network address and subnet mask
subnet 192.168.1.0 netmask 255.255.255.0 {
    # specify the range of lease IP address
    range dynamic-bootp 192.168.1.200 192.168.1.254;
    # specify broadcast address
    option broadcast-address 192.168.1.255;
    # specify default gateway
    option routers 192.168.1.1;
}

 
As we can see in the latter part of this configuration, a subnet "192.168.1.0" is defined with a netmask of 255.255.255.0, that is 256 IPs. Also, default lease time of 600 is provided which means that the DHCP will reserve an IP for only 600 seconds by default. The maximum lease time that can be allotted is set to 7200 seconds. 
Other parameters that are provided are the broadcast address, the DNS servers among others.
 
The following command is used to make this DHCP server the official DHCP server for the local network. 

authoritative;


Once the changes are made, restart the DHCP service for the changes to take effect.

systemctl start dhcpd
systemctl enable dhcpd

 

 

 


  

Was this reply helpful?

Related topics

  • CentOS 7: "CALL IT RED HAT 7 LITE"
  • Is Centos 8 the last stable OS release?
  • How to secure Mongodb on Centos 7?
  • How to configure an IP range on Centos 7?
  • BBR : A new way to increase Internet speed
  • server rent for php application
  • affordable dedicated server for woocommerce
  • Setup VPN on CentOS 8
  • Yum Update Not Working on Centos 7
  • Single vs Dual vs Multi-homed Network
  • Upgrade Centos 6 to Centos 7
  • Best 10Gbps Unmetered Dedicated Server In North America - Top 10 List
  • Linux Command Line Tutorial For Git
  • Psychz Networks Safeguards Cut Abuse And Spam By Nearly 100%
  • sObject - Python Examples
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