CentOS Minimal Installation Network Configuration
By default CentOS minimal install does not come with pre-configured network, here’s how to make it work:
$ ping google.com ping: unknown host google.com
To fix this we’ll need to edit the set up for the ethernet. Let’s start with editing this file:
$ vim /etc/sysconfig/network-scripts/ifcfg-eth0 IPADDR=x.x.x.x BOOTPROTO=none NETMASK=255.255.255.0 GATEWAY=y.y.y.y DNS1=y.y.y.y DNS2=y.y.y.y USERCTL=yes HWADDR='your mac address'
where x.x.x.x is your static ip, and y.y.y.y is your router ip
If you’re not sure what your mac address is, run this command
$ ifconfig eth0 | grep -o -E '([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}'now edit the networks config and make sure you added the line below:
$ vi /etc/sysconfig/network
Add the line:
GATEWAY = y.y.y.y
Now restart the network interface:
$ /etc/init.d/networking restart
Now ping the router:
$ ping y.y.y.y Request timeout for icmp_seq 0 64 bytes from y.y.y.y: icmp_seq=1 ttl=56 time=1.792 ms Request timeout for icmp_seq 1 64 bytes from y.y.y.y: icmp_seq=3 ttl=56 time=1.790 ms 64 bytes from y.y.y.y: icmp_seq=4 ttl=56 time=1.762 ms
Looks good, now let’s see if we can see anything outside.
$ ping google.com PING google.com (173.194.67.138) 56(84) bytes of data. 64 bytes from wi-in-f138.1e100.net (173.194.67.138): icmp_seq=1 ttl=49 time=7.88 ms 64 bytes from wi-in-f138.1e100.net (173.194.67.138): icmp_seq=2 ttl=49 time=7.35 ms 64 bytes from wi-in-f138.1e100.net (173.194.67.138): icmp_seq=3 ttl=49 time=7.13 ms
Now you can connect to the internet, and get all the packages you need.
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)




