Skip to content

Instantly share code, notes, and snippets.

@ilkereroglu
Created September 22, 2015 14:22
Show Gist options
  • Save ilkereroglu/a8f9731e89f16ae1c4e6 to your computer and use it in GitHub Desktop.
Save ilkereroglu/a8f9731e89f16ae1c4e6 to your computer and use it in GitHub Desktop.
How To Configure Static IP On CentOS 7

Configure eth0

vi /etc/sysconfig/network-scripts/ifcfg-eth0 
TYPE="Ethernet"
BOOTPROTO="none"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
NAME="eth0"
UUID="549a3ab7-6cbc-49de-85e2-a366226a127c"
DEVICE="eth0"
ONBOOT="yes"
IPADDR="192.168.0.101"    # [Enter your static IP here]
PREFIX="24"
GATEWAY="192.168.0.1"     # [Enter your Default Gateway]
DNS1="8.8.8.8"            # [Your Domain Name System 1]
DNS2="8.8.4.4"            # [Your Domain Name System 2]
IPV6_PEERDNS="yes"
IPV6_PEERROUTES="yes"
IPV6_PRIVACY="no"

Restart Network Service

/etc/init.d/network restart

Or

service network restart

After restarting network, make sure to check the IP address and network status

 ip addr show
 ping -c4 google.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment