By default CentOS minimal install does not come with pre-configure network. In this small tutorial i will explain how to set static ip address on CentOS 6.5 minimal.
First, need to edit the set up for the ethernet. Let’s start with editing this file:
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0 HWADDR=1c:65:9d:93:fc:e1 TYPE=Ethernet ONBOOT=yes BOOTPROTO=none IPV6INIT=no USERCTL=no NM_CONTROLLED=yes PEERDNS=yes IPADDR=192.168.0.101 NETMASK=255.255.255.0
Now, configure default getaway:
# vi /etc/sysconfig/network
NETWORKING=yes HOSTNAME=centos6 GATEWAY=192.168.0.1
Configure DNS Server
# vi /etc/resolv.conf
nameserver 8.8.8.8 nameserver 8.8.4.4
[ads]
Now restart the network interface:
# /etc/init.d/networking restart
Check eth0:
# ifconfig eth0
eth0 Link encap:Ethernet HWaddr 1c:65:9d:93:fc:e1 inet addr:192.168.0.101 Bcast:192.168.0.255 Mask:255.255.255.0 inet6 addr: fe80::601:eff:fe41:6901/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:607834 errors:0 dropped:0 overruns:0 frame:0 TX packets:809825 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:145615781 (138.8 MiB) TX bytes:858027829 (818.2 MiB
That’s it for now!.
See also: How to install CentOS 6.5 minimal
minor error. # /etc/init.d/networking restart should read # /etc/init.d/network restart
Very helpful..
After restarting network services, the nameserver entry in /etc/resolv.conf gets erased.
How can it persist?