1and1 Help Center Categories

print article

Add a Public IP Address to a Linux Server (Debian)

For 1&1 Cloud Servers and 1&1 Virtual Server Clouds with Debian

Learn how to add more public IP addresses to your 1&1 Cloud Server.

Requirements:

You have assigned an additional public IP address to your server in the 1&1 Cloud Panel.

You have logged on to the server.

Step 1
To display the state of active and inactive network interfaces, enter the following command:
[root@localhost ~]# ifconfig -a

The active and inactive network interfaces will be displayed. Example:

eth0      Link encap:Ethernet  HWaddr 00:50:56:15:e8:dc
inet addr:10.5.98.233 Bcast:10.5.98.233 Mask:255.255.255.255
inet6 addr: fe80::250:56ff:fe15:e8dc/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:550 errors:0 dropped:0 overruns:0 frame:0
TX packets:93 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:40700 (39.7 KiB) TX bytes:17196 (16.7 KiB)

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:142 errors:0 dropped:0 overruns:0 frame:0
TX packets:142 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:47749 (46.6 KiB) TX bytes:47749 (46.6 KiB)
Step 2
Check which network interface is in use. In the example above, the eth0 network interface is active.
Step 3
To add your additional IP as an alias, you must modify the record for the network interface used in /etc/network/interfaces. This file is responsible for managing the network configuration in Debian. Enter the following to make this change:
[root@localhost ~]# vi /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
iface eth0 inet dhcp
auto eth0:0
iface eth0:0 inet static
name Ethernet alias LAN card
address ABC.DEF.GHI.JKL
netmask 255.255.255.255
broadcast ABC.DEF.GHI.JKL
network ABC.DEF.GHI.JKL

Enter your main IP address for the "address" and "broadcast" entries. Enter your main IP address and the number 0 for "network".

Please note:
The "auto lo" and "iface lo inet loopback" entries must not be changed!
Step 4
Save your changes.
Step 5
Restart the server.