Home Blog CV Projects Patterns Notes Book Colophon Search

Setting up the Free IPs on Hetzner

12 Nov, 2007

Following on from my last article I've now received the email with the free IP addresses:

Dear Mr. James Gardner,

Below you will find your additional IP addresses added to
the server 78.46.35.5.

Please note that you can use the subnet only for this server.

IP: 78.47.146.248
Mask: 255.255.255.248
Broadcast: 78.47.146.255

Useable IP addresses:
78.47.146.249 to 78.47.146.254

Instructions for installing additional IP addresses
you will find at the following link:
http://wiki.hetzner.de/index.php/Zusätzliche_IP-Adressen (in German)

Our competent support team is ready to answer your questions.

Please visit our website at http://www.hetzner.de/support.html.

This entry will show how to set up virtual ethernet interfaces for each of the IPs so they all resolve to the server. Note this isn't what you want for Xen, see my next entry for that.

Following the link results in this page (translated). Which explains that you might have 6 IP addresses rather than 5 depending on the network setup. Looks like I have 6 so that seems good.

The Debian instructions for setting up these IP addresses are translated here but you'll want to compare them to the original because Google reformats the config files in an attempt to translate them.

The basic technique is to create a virtual ethernet interface for each IP address so that the server can connect on each IP address. You do this by adding them to the /etc/network/interfaces config file. Here's what mine looks like before:

### Hetzner Online AG - installimage
# Loopback device:
auto lo
iface lo inet loopback
pre-up iptables-restore < /etc/iptables.up.rules

# device: eth0
auto eth0
iface eth0 inet static
  address 78.46.35.5
  broadcast 78.46.35.31
  netmask 255.255.255.224
  gateway 78.46.35.1

# default route to access subnet
up route add -net 78.46.35.0 netmask 255.255.255.224 gw 78.46.35.1 eth0

and after:

### Hetzner Online AG - installimage
# Loopback device:
auto lo
iface lo inet loopback
pre-up iptables-restore < /etc/iptables.up.rules

# device: eth0
auto eth0
iface eth0 inet static
  address 78.46.35.5
  broadcast 78.46.35.31
  netmask 255.255.255.224
  gateway 78.46.35.1

# Now set up the virtual interfaces for the other IP addresses:

auto eth0:0
iface eth0:0 inet static
address 78.47.146.249
broadcast 78.47.146.255
netmask 255.255.255.248

auto eth0:1
iface eth0:1 inet static
address 78.47.146.250
broadcast 78.47.146.255
netmask 255.255.255.248

auto eth0:2
iface eth0:2 inet static
address 78.47.146.251
broadcast 78.47.146.255
netmask 255.255.255.248

auto eth0:3
iface eth0:3 inet static
address 78.47.146.252
broadcast 78.47.146.255
netmask 255.255.255.248

auto eth0:4
iface eth0:4 inet static
address 78.47.146.253
broadcast 78.47.146.255
netmask 255.255.255.248

auto eth0:5
iface eth0:5 inet static
address 78.47.146.254
broadcast 78.47.146.255
netmask 255.255.255.248

# End of the virtual interfaces setup

# default route to access subnet
up route add -net 78.46.35.0 netmask 255.255.255.224 gw 78.46.35.1 eth0

Do a quick ping test from another machine - the IP addresses won't work yet:

james@dirac:~$ ping 78.47.146.254
PING 78.47.146.254 (78.47.146.254) 56(84) bytes of data.

--- 78.47.146.254 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 2008ms

Now you need to restart networking and cross your fingers. If your networking config is broken you'll have to use the same rescue boot technique I described earlier for SSH:

sudo /etc/init.d/networking restart

Now if you ping the same IP your server should respond:

james@dirac:~$ ping 78.47.146.254
PING 78.47.146.254 (78.47.146.254) 56(84) bytes of data.
64 bytes from 78.47.146.254: icmp_seq=1 ttl=56 time=38.6 ms
64 bytes from 78.47.146.254: icmp_seq=2 ttl=56 time=57.3 ms

--- 78.47.146.254 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1002ms
rtt min/avg/max/mdev = 38.687/48.003/57.319/9.316 ms

Your IP adresses are now setup correctly to point to the server.

I'm not sure how useful this setup actually is as I'm using Xen now, but it is here in case it helps someone.

Comments

Mike

Posted

2007-11-22 17:31

Thanks for writing up how you added the subnet :) It made adding new ips to my server nice and easy.

arri

Posted

2008-01-21 13:27

hoi james,

thanks for this article, it's very usefull. helped me overcome my fear of applying these configurations. the only thing stopping me now are the additional ip addresses.

from the post-dates on your blog about xen and this one i could conclude that you received these ip's the same day as you requested them (nov. 12th). was that the case, or did some days pass before you received them?

thanks! arri

thejimmyg

Posted

2008-01-21 17:32

Hi Arri,

Glad it was useful. I asked for the IP addresses on a Sunday and I had them by the following Monday evening so Hetzner were very quick.

James :URL: http://jimmyg.org

arri

Posted

2008-01-23 08:26

hi james,

appearantly it took a little longer this time, but i also received the extra ip's yesterday.

please keep posting these very usefull blogs :)

arri

Posted

2008-01-27 06:42

the ips arrived a few days later, but with a weekend in between. activating them went very smooth :)

tnx a

Copyright James Gardner 1996-2020 All Rights Reserved. Admin.