This document describes the steps to configure a Linux System with a static IP Address.
Configure Static IP Address
Open the Network Interface configuration file |
vi /etc/sysconfig/network-scripts/ifcfg-eth0
|
Set IP Address |
DEVICE=”eth0″
NM_CONTROLLED=”yes”
ONBOOT=yes
HWADDR=A4:BA:DB:37:F1:04
TYPE=Ethernet
BOOTPROTO=static
NAME=”System eth0″
UUID=5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03
IPADDR=192.168.1.44
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
|
Configure Default Gateway
Open the network configuration file |
vi /etc/sysconfig/network
|
|
NETWORKING=yes
HOSTNAME=centos6
GATEWAY=192.168.1.1 # Optional. Not required if already provided in interface configuration file.
|
Activate the changes
Restart Network Interface |
service network restart
|
Or use scripts to stop/start individual interfaces by changing directory to |
cd /etc/sysconfig/network-scripts
|
Stop/Start a interface |
ifdown eth0
ifup eth0
|
Configure DNS Server
Open the resolving configuration file |
vi /etc/resolv.conf
|
Define your name servers IP addresses |
search domain1.com domain2.com #optional
nameserver 8.8.8.8
nameserver 192.168.1.1
|