Verified and Tested 08/27/15

Introduction

In this article, we will go over how to configure a private IP on a freshly provisioned CentOS 6.6 cloud server. Every cloud account comes with a pre-allocated private IP range that can be used to link cloud servers. This is ideal in certain cases, such as wanting to separate the roles of your web server and database. It is also important to note that private LAN traffic is not metered and does not count towards your allotted outbound data transfer allowance.

Prerequisites

  • CentOS 6.X (32 bit or 64 bit) server.
  • Root permissions.

Determine your private range

Login to your cloud control panel and click on “Private IP’s” to see what private range has been allocated to you.

Assigned Private range.

Cloud control panel Private IP range.


Configure Secondary Network Interface

Let’s start off by taking a look at our current network interface configuration:

ifconfig -a

The output will resemble this:

eth0 Link encap:Ethernet HWaddr 00:00:68:F5:27:34
 inet addr:XXX.XXX.XXX.XXX Bcast:XXX.XXX.XXX.XXX Mask:255.255.254.0
 inet6 addr: XX::XX:XX:XX:XX/64 Scope:Link
 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
 RX packets:1403 errors:0 dropped:0 overruns:0 frame:0
 TX packets:1065 errors:0 dropped:0 overruns:0 carrier:0
 collisions:0 txqueuelen:1000
 RX bytes:95663 (93.4 KiB) TX bytes:72683 (70.9 KiB)
eth1 Link encap:Ethernet HWaddr 00:00:0A:F5:27:34
 inet6 addr:XX::XX:XX:XX:XX/64 Scope:Link
 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
 RX packets:281 errors:0 dropped:0 overruns:0 frame:0
 TX packets:5 errors:0 dropped:0 overruns:0 carrier:0
 collisions:0 txqueuelen:1000
 RX bytes:12114 (11.8 KiB) TX bytes:398 (398.0 b)

As seen above, there are two network interfaces currently on the server. For Atlantic.Net VPS, ETH0 will always be the public interface and ETH1 will always be used for private IP’s.

Now we need to change to the directory where the interface configuration files are located and take a look at the ETH1 config file:

cd /etc/sysconfig/network-scripts/
cat ifcfg-eth1
# Virtio Network Device Private Interface
DEVICE=eth1
BOOTPROTO=static
HWADDR=00:00:0a:f5:27:34
ONBOOT=yes

As you can see, ETH1 does not currently have an IP assigned to it. We will need to edit it with a text editor. In this example, I will be using “nano”:

nano ifcfg-eth1

Append the following to the ETH1 config file and add the private IP you chose to it:

IPADDR=xxx.xxx.xxx.xxx
NETMASK=255.255.255.0

Close and save the changes you made. Then restart the networking service.

service network restart

That’s it! Now go do the same thing on another VPS to establish local connectivity.