Skip to content

Instantly share code, notes, and snippets.

@xdemocle
Forked from fernandoaleman/Linux Static IP
Last active August 29, 2015 14:14
Show Gist options
  • Save xdemocle/357c6f1abbece91b4993 to your computer and use it in GitHub Desktop.
Save xdemocle/357c6f1abbece91b4993 to your computer and use it in GitHub Desktop.
How To Configure Static IP On CentOS 6
## Configure eth0
#
# vi or nano /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
NM_CONTROLLED="yes"
ONBOOT=yes
# Retrieve the current MAC address with: ifconfig
HWADDR=A4:BA:DB:37:F1:04
TYPE=Ethernet
BOOTPROTO=static
NAME="System eth0"
# Random uuid, if you need another random: uuidgen eth0 (eth0 is the name of device visible from ifconfig command)
UUID=5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03
# Set you static IP below
IPADDR=192.168.1.44
# Set your netmask
NETMASK=255.255.255.0
## Configure Default Gateway
#
# vi or nano /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=centos6
GATEWAY=192.168.1.1
## Restart Network Interface
#
/etc/init.d/network restart
## Configure DNS Server manually
#
# vi /etc/resolv.conf
nameserver 8.8.8.8 # Replace with your nameserver ip
nameserver 192.168.1.1 # Replace with your nameserver ip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment