Jump to content


Photo

How To Configure Static IP On CentOS 7


  • Please log in to reply
No replies to this topic

#1 brent

brent

    Administrator

  • Administrators
  • 65 posts

Posted 22 April 2015 - 12:45 PM

Before we convert our server to a static IP we need to backup resolv.conf under the etc folder.

cp /etc/resolv.conf /etc/resolv.conf.backup

Now we are going to edit the following file:

sudo nano /etc/sysconfig/network-scripts/ifcfg-enp0s3
TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPADDR=10.1.1.200
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME=enp0s3
UUID=75a170ba-6bfa-4553-8070-e658eb8ffb1e
ONBOOT=yes

save and exit:

 

Next we need to set the hostname and gateway

sudo nano /etc/sysconfig/network

and we modify to our network:

NETWORKING=yes
HOSTNAME=unixmen-centos7
GATEWAY=10.1.1.253

Save and exit.

 

Restart your network or reboot

 

Now we need to restore the resolv.conf backup file.

 

Complete.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users