November 14, 2016

Static IP address on CentOS 7 Server

Linux Tutorial



In this section, i will give you step by step to configure Static IP Address on Centos 7. How can I switch from DHCP to static IP address configuration in a CentOS 7 desktop system? How do I setup a static TCP/IP address on my CentOS Linux 7 or Red Hat Enterprise Linux 7 server using command line option?

If you want to set up a static IP address on a network interface in CentOS 7, there are several different ways to do it, varying depending on whether or not you want to use Network Manager for that.


Network Manager is a dynamic network control and configuration system that attempts to keep network devices and connections up and active when they are available). CentOS/RHEL 7 comes with Network Manager service installed and enabled by default.

On CentOS 7 or RHEL 7 one need to use the NetworkManager daemon. It attempts to make networking configuration and operation as painless and automatic as possible by managing the primary network connection and other network interfaces, like Ethernet, WiFi, and Mobile Broadband devices. In this quick tutorial you will learn about configuring a network interface using ifcfg files located in /etc/sysconfig/network-scripts/ directory in a CentOS 7 and RHEL 7:

Open :  /etc/sysconfig/network-scripts/ifcfg-eth0

edit :
HWADDR=00:08:A2:0A:BA:B8
TYPE=Ethernet
BOOTPROTO=none
# Server IP #
IPADDR=192.168.6.203
# Subnet #
PREFIX=24
# Set default gateway IP #
GATEWAY=192.168.6.254
# 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
# auto active this interface after server restarted or poweron
ONBOOT=yes



Next Command :


# shutdown interface eth0
ifdown eth0

#to reactived interface eth0
ifup eth0


Set optional DNS Static in /etc/resolv.conf
edit :
nameserver 8.8.8.8
nameserver 8.8.4.4
Previous Post
Next Post

post written by:

0 comments: