Over a million developers have joined DZone.
Platinum Partner

CentOS Minimal Installation Network Configuration

· DevOps Zone

The DevOps Zone is brought to you in partnership with New Relic. Improving the performance of your app is easy with New Relic's SaaS-based monitoring.

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
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 ( 56(84) bytes of data.
64 bytes from wi-in-f138.1e100.net ( icmp_seq=1 ttl=49 time=7.88 ms
64 bytes from wi-in-f138.1e100.net ( icmp_seq=2 ttl=49 time=7.35 ms
64 bytes from wi-in-f138.1e100.net ( icmp_seq=3 ttl=49 time=7.13 ms

Now you can connect to the internet, and get all the packages you need.

The DevOps Zone is brought to you in partnership with New Relic. Know exactly where and when bottlenecks are occurring within your application frameworks with New Relic APM.

architects,devops,networking,linux,tips and tricks,centos

Published at DZone with permission of Kasia Gogolek , DZone MVB .

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}