How do I configure and add IP addresses to my Linux Dedicated Server ?
Posted by - NA -, Last modified by on 21 July 2009 05:29 AM
When your dedicated server is provisioned you are given a block of 8 (or more) ip addresses. On an standard 8 IP block assigned to your server (called a /29 "slash 29" in network lingo, or netmask 255.255.255.248 block of IPs) only 5 can be used by your operating system because of how network routing works (the first IP is called a 'network' address, the next IP is your gateway address, and then the last IP is your broadcast address. So 3 of the IP's you are initialy provisioned used to provide your dedicated server network connection, and the rest of the IP's can be used by your operating system for things like web hosting, email hosting, and more).

If your server has a control panel such as cPanel, Plesk, ServerCP, etc - you will access the control panel to configure your IP addresses (just click on the link that says 'add ip address').

If you are on a Linux dedicated server, without a control panel, you can configure the additional IP's via the command line (login via SSH as 'root' and edit/create the following files):

For example, your server was assigned the following /29 (8 total IP's)

208.85.0.224 (the 'network' address, you can't use this)
208.85.0.225 (this is the gateway IP, you do not use this either)
208.85.0.226 - this is your server's main IP already configured
208.85.0.227 - this is a usable IP (not yet configured)
208.85.0.228 - this is a usable IP (not yet configured)
208.85.0.229 - this is a usable IP (not yet configured) 208.85.0.230 - this is a usable IP (not yet configured)
208.85.0.231 (the 'broadcast' address, you can't use this)


The server's main IP is configured for you ahead of time in this file:

/etc/sysconfig/network-scripts/ifcfg-eth0

This file is your main IP for the server, and should NEVER be modified, it should look something like this:

# Intel Corporation 82566DC Gigabit Network Connection DEVICE=eth0 BOOTPROTO=static DHCPCLASS= HWADDR=00:1C:C0:B9:83:5D
IPADDR=208.85.0.226
NETMASK=255.255.255.248
ONBOOT=yes

Now, as mentioned, on a standard server you get 5 total usable IP's to work with. So to make your server utilize the 4 extra IP's, you need to create the following file:

/etc/sysconfig/network-scripts/ifcfg-eth0-range0

The file should read something like this:

IPADDR_START=208.85.0.227
IPADDR_END=208.85.0.230
CLONENUM_START=0
NETMASK=255.255.255.248

If you were assigned additional IP blocks to your server, you need to create another 'range' file like this:

/etc/sysconfig/network-scripts/ifcfg-eth0-range1

IPADDR_START=67.231.242.56
IPADDR_END=67.231.242.63
CLONENUM_START=4
NETMASK=255.255.255.255

The above will create '8' more IP's (for a 2nd /29), and will utilize the server's main gateway/ip addresses so you can actually utilize all 8 IP's on this block.

Finally, to have the server load the new configuration, type:

service network restart &

Be sure to put that "&" at the end of that line, before hitting return, or you may accidenty loose your connection.

Powered by TurnKey Internet