Switch 1and1 dedicated server default IP from DHCP to static

Apparently, out-of-the-box 1and1 dedicated server – at least the CentOS 6 64 bit minimal configuration – comes with dynamic server IP address. Yes, I know! Pretty stupid and confusing, an oxymoron by itself. But a fact.

I read all over the net for more than an hour to find solution to no avail. Since 1and1 themselves confirmed (to me as well) that there is no problem to use the DHCP IP to configure it as static, everyone seems to advice the obvious: make corresponding changes in /etc/sysconfig/networking/devices/ifcfg-eth0 and /etc/sysconfig/network and it is done!

But that alone doesn’t do it.

What does is adding static routes for the gateway.

Here is how to do it:

* run ifconfig to find your DHCP IPv4 address and netmask

* run
route -n
and find the default gateway, e.g. like

* create static route file /etc/sysconfig/network-scripts/route-eth0 with the following content: dev eth0
default via dev eth0

(no, it does *not* work if you do it via the route command from the shell – it is not remembered after the network interface is restarted)

* create (or replace) file /etc/sysconfig/networking/devices/ifcfg-eth0 with the following content:


* create (or replace) /etc/sysconfig/network with the following content:


* run
/etc/init.d/network restart

NOTE: if you are using 1and1 dedicated and cut yourself off from your server because of some reason, you are up for pleasant surprise: they have a second, serial console connection to get you to your server shell. Just go to the 1and1 CP:
1) if you changed your “initial password” click “Server Access Data” and make note of it.
2) Back to 1and1 CP home page, then click “1 and 1 servers >>” link (what you are looking for is not listed on this main page)
3) On the next page under “More features” click “Serial console”. Find the hostname and SSH to it with the “initial password”.

by theme -> http://www.webhostingtalk.com/showthread.php?t=1243987

Scroll to top