Skip to content

Instantly share code, notes, and snippets.

@ashrithr
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ashrithr/8dc95229324d400c4e52 to your computer and use it in GitHub Desktop.
Save ashrithr/8dc95229324d400c4e52 to your computer and use it in GitHub Desktop.
Centos 7 Static IP
## Get a list of NIC names using `ifconfig -a` or `ip -a`
#
# vi /etc/sysconfig/network-scripts/ifcfg-en0xxxxxxx
NAME=en0xxxxxx
NM_CONTROLLED=no
ONBOOT=yes
HWADDR=A4:BA:DB:37:F1:04
TYPE=Ethernet
BOOTPROTO=static
UUID=5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03
IPADDR=192.168.1.44
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS1=192.168.1.1
DNS2=8.8.8.8
DOMAIN=cw.com
## Configure Default Gateway
#
# vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=centos7
GATEWAY=192.168.1.1
## Restart Network Interface
#
systemctl restart network.service
## Configure DNS Server
#
# vi /etc/resolv.conf
nameserver 8.8.8.8 # Replace with your nameserver ip
nameserver 192.168.1.1 # Replace with your nameserver ip
## Configure hostname
#
# vi /etc/hostname
centos7.cw.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment