IP Configuration


This guide explains how to setup an additional IPv4 address on your Woktron Dedicated Server or VPS. We will assume the following:

After purchasing an additional IPv4 address you must restart the VPS using the "Restart VPS" feature from within our control panel. This must be done regardless of the installed operating system.

Each example below will configure the secondary IP address to become automatically available, and remain configured even after your server is rebooted. You can test if the IP address is configured by pinging it with the ping utility on your client computer.

 

Requirements

  • a Woktron Dedicated Server or Woktron VPS
  • at least one additional failover IP address attached to the server

 

Determine the gateway address for VPS

A Gateway address is not required in most cases. However, in case a user wishes to create for example a network bridge, a gateway address and a virtual MAC address are required in order to achieve a working connection to the internet.

To configure the failover IP addresses for your virtual machines, you will need to know the main IP address of the host node (the server hosting your vps). The gateway address is made up of the first three octets of your host node's main IP address, with 254 replacing the last octet.

For example, if the main IP address of the server hosting your VPS is: 1.2.3.4, the gateway address is 1.2.3.254

 

How to determine what the host node's IP address is?

  • Open a support ticket
  • Click on the VNC icon in your VPS control panel.

 

Determine the gateway address for Dedicated Servers

To configure the failover IP addresses for your dedicated server, you will need to know the main IP address of your server. The gateway address is made up of the first three octets of your server's main IP address, with 254 replacing the last octet.

For example, if your Dedicated Server’s main IP address is: 1.2.3.4, the gateway address is 1.2.3.254

 

Virtual MAC address

Virtual MAC addresses for your IP addresses are assigned by default to each IP address connected to your dedicated server or VPS. If you'd like to know what the Virtual MAC address is for your failover IP addresses you can open a support ticket. If you have a dedicated server and would like to host virtual machines, you MUST configure virtual machines with the virtual MAC addresses that have been provided.

Exception: when using OpenVZ, virtualization virtual MAC addresses are not required.

 

Netmask

Netmask = 255.255.255.255

 

 

Configuration

 

CentOS and Fedora

First, make a copy of the configuration file so that you can use it as a template:

cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0:0

 

Edit the configuration file with the following command:

nano /etc/sysconfig/network-scripts/ifcfg-ethX:Y

|X|main interface number (usually eth0 )| |xxx.xxx.xxx.xxx|failover IP to configure| |Y|the number of the alias (starting from 0, where eth0:0 is the server main IP address)|

 

Add these lines to the configuration file:

DEVICE="ethX:Y"
ONBOOT=yes
BOOTPROTO=static
IPADDR="FAILOVER_IP"
NETMASK=255.255.255.255
BROADCAST="FAILOVER_IP"

 

Reboot the network services with the following command:

ifup ethX:Y

 

Debian 6/7/8 and derivatives

First, make a copy of the configuration file, so that you can revert at any time:

cp /etc/network/interfaces /etc/network/interfaces.bak

 

You can now modify the configuration file:

editor /etc/network/interfaces

You will need to add a secondary interface:

auto eth0:0
iface eth0:0 inet static
address FAILOVER_IP
netmask 255.255.255.255

 

To ensure that the secondary interface is enabled or disabled whenever the eth0 interface is enabled or disabled, you need to add the following line to the eth0 configuration:

post-up /sbin/ifconfig eth0:0 FAILOVER_IP netmask 255.255.255.255 broadcast FAILOVER_IP
pre-down /sbin/ifconfig eth0:0 down

 

If you have two failover IPs to configure, the /etc/network/interfaces file should look like this:

auto eth0
iface eth0 inet static
address SERVER_IP
netmask 255.255.255.0
broadcast xxx.xxx.xxx.255
gateway xxx.xxx.xxx.254

auto eth0:0
iface eth0:0 inet static
address FAILOVER_IP1
netmask 255.255.255.255

auto eth0:1
iface eth0:1 inet static
address FAILOVER_IP2
netmask 255.255.255.255

 

Or like this:

auto eth0
iface eth0 inet static
address SERVER_IP
netmask 255.255.255.0
broadcast xxx.xxx.xxx.255
gateway xxx.xxx.xxx.254

# IPFO 1
post-up /sbin/ifconfig eth0:0 FAILOVER_IP1 netmask 255.255.255.255 broadcast FAILOVER_IP1
pre-down /sbin/ifconfig eth0:0 down

# IPFO 2
post-up /sbin/ifconfig eth0:1 FAILOVER_IP2 netmask 255.255.255.255 broadcast FAILOVER_IP2
pre-down /sbin/ifconfig eth0:1 down

 

You now need to restart your network interface:

/etc/init.d/networking restart

 

Debian 9+, Ubuntu 17.04, Fedora 26+ and Arch Linux

On these distributions, the naming of interfaces as eth0, eth1 (and so on) is abolished. We will therefore use systemd-network.

First, make a copy of the config file, so that you can revert at any time:

cp /etc/systemd/network/50-default.network /etc/systemd/network/50-default.network.bak

 

You can now add your failover IP to the config file as follows:

editor /etc/systemd/network/50-default.network

 

[Address]
Address=FAILOVER_IP/32
Label=failover1 # optional

 

The label is optional. It’s just for distinguishing between your various failover IPs.

You now need to restart your interface:

systemctl restart systemd-networkd

 

Ubuntu 17.10 and following

Each failover IP address will need its own line in the configuration file. The configuration file is called 50-cloud-init.yaml and is located in /etc/netplan

Determine the interface

ifconfig

Note the interface name and its MAC address

 

Connect to your server via SSH and run the following command:

editor /etc/netplan/50-cloud-init.yaml

Next, edit the file with the content below, replacing INTERFACE_NAME MAC_ADDRESS and FAILOVER_IP:

network:
    version: 2
    ethernets:
        INTERFACE_NAME:
            dhcp4: true
            match:
                macaddress: MAC_ADDRESS
            set-name: INTERFACE_NAME
            addresses:
            - FAILOVER_IP/32

Save and close the file. You can test the configuration with the following command:

netplan try

Apply the configuration changes:

netplan apply

 

openSUSE

First, make a copy of the config file, so that you can revert at any time:

cp /etc/sysconfig/network/ifcfg-ens32 /etc/sysconfig/network/ifcfg-ens32.bak

 

Open the configuration file:

editor /etc/sysconfig/network/ifcfg-ens32

 

Add the following:

IPADDR_1=FAILOVER_IP
NETMASK_1=255.255.255.255
LABEL_1=ens32:0

 

FreeBSD

Determine the name of your primary network interface. You can use the ifconfig command for this operation:

ifconfig

 

This will return the following:

ifconfig
>>> nfe0: flags=8843 metric 0 mtu 1500
>>> options=10b
>>> ether 00:24:8c:d7:ba:11
>>> inet 94.23.196.18 netmask 0xffffff00 broadcast 94.23.196.255
>>> inet 87.98.129.74 netmask 0xffffffff broadcast 87.98.129.74
>>> media: Ethernet autoselect (100baseTX )
>>> status: active
>>> lo0: flags=8049 metric 0 mtu 16384
>>> options=3
>>> inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
>>> inet6 ::1 prefixlen 128
>>> inet 127.0.0.1 netmask 0xff000000 v comsdvt#

In our example, the name of the interface is therefore nfe0.

Next, make a copy of the configuration file, so that you can revert at any time:

cp /etc/rc.conf /etc/rc.conf.bak

 

Edit the /etc/rc.conf file:

editor /etc/rc.conf

 

Then add this line at the end of the file:

ifconfig_INTERFACE_alias0="inet FAILOVER_IP netmask 255.255.255.255 broadcast FAILOVER_IP"

Replace INTERFACE and FAILOVER_IP with the name of your interface (identified in the first step) and your failover IP, respectively.

 

For example:

ifconfig_nfe0_alias0="inet 87.98.129.74 netmask 255.255.255.255 broadcast 87.98.129.74"

 

You now need to restart your interface:

/etc/rc.d/netif restart && /etc/rc.d/routing restart
  • 1 Users Found This Useful
Was this answer helpful?

Related Articles

Binding multiple IPs to one interface in Centos

The steps to add additional IP's to one network card / interface in Centos are as follows:1.)...

What is a dedicated server?

Unlike normal hosting plans, which put many customers' accounts on a single server, a dedicated...

Mounting Partitions in CentOS 5.x

This is a basic security tip that can be executed to help protect your system. This is not an...

Bandwidth allocation

Bandwidth is the amount of data that can be transferred to and from your account in one month....

Creating Strong Passwords

Passwords provide the first line of defense against unauthorized access to your computer. The...