LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 03-17-2012, 10:23 PM   #1
yngens
LQ Newbie
 
Registered: Mar 2012
Posts: 1

Rep: Reputation: Disabled
How to change DHCP IP to static IP with 1and1.com?


I have just rented a 1and1.com Root Server with Ubuntu 10.04 LTS minimum installation. 1and1.com has a specific way of assigning IPs through DHCP to dedicated servers and I would happily live with DHCP, but I want to utilize Virtualmin, for which static IP is recommended as it stated reads on http://www.virtualmin.com/documentation/dns/faq:

Quote:
While obtaining an IP address, the DNS servers provided by your DHCP server are used in place of what's currently setup on your server.

For a server, we'd suggest using static IP's where possible. That would prevent your DNS servers from being overwritten, as well as removing any chance of your server obtaining the wrong IP address.
I've been struggling to turn 1and1's DHCP IP to static IP for already two days, exhausted and gladly will offer some bounty to anyone who solves this Gordian Knot.

Given data:

Server IP: 84.208.133.16 (1and1 gives only one free IP with the server, so no other IPs)

Code:
cat /etc/hosts

127.0.0.1 localhost.localdomain localhost
84.208.133.16 u16150189.onlinehome-server.com u16150189
84.208.133.16 default-domain.com
(I don't change anything here for now, since my goal to get DHCP IP changed to static one.)


Code:
cat /etc/network/interfaces

# The loopback network interface
auto lo eth0
iface lo inet loopback

iface eth0 inet dhcp

# auto eth0
# iface eth0 inet static
# address 84.208.133.16
# netmask 255.255.255.255
# broadcast 84.208.133.16
# network 84.208.133.16
# gateway 10.255.255.1
Code:
ifconfig
eth0      Link encap:Ethernet  HWaddr 00:25:90:57:f1:4a  
          inet addr:84.208.133.16  Bcast:84.208.133.16  Mask:255.255.255.255
          inet6 addr: fe80::225:90ff:fe57:f14a/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3541 errors:0 dropped:0 overruns:0 frame:0
          TX packets:571 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:292548 (292.5 KB)  TX bytes:70346 (70.3 KB)
          Interrupt:17 Memory:fe9e0000-fea00000 

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:28 errors:0 dropped:0 overruns:0 frame:0
          TX packets:28 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:2704 (2.7 KB)  TX bytes:2704 (2.7 KB)
Code:
netstat -nr
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         10.255.255.1    0.0.0.0         UG        0 0          0 eth0
10.255.255.1    0.0.0.0         255.255.255.255 UH        0 0          0 eth0

After commenting out dhcp, opening static interface

Code:
# The loopback network interface
auto lo eth0
iface lo inet loopback

# iface eth0 inet dhcp

auto eth0
iface eth0 inet static
address 84.208.133.16
netmask 255.255.255.255
broadcast 84.208.133.16
network 84.208.133.16
gateway 10.255.255.1
and running
Code:
/etc/init.d/networking restart
I loose SSH connection and the networks never comes back.

Luckily 1and1 provides console through which I can access my server and change the settings.

What else I should do to get this done? Anyone can help me with this for some bounty, please?
 
Old 03-26-2012, 05:41 PM   #2
Deac
LQ Newbie
 
Registered: Mar 2012
Posts: 1

Rep: Reputation: Disabled
Hi there,

I've just spent all afternoon into looking into a similar problem, I think the problem is because they're using a gateway that's on a different subnet and when setting statically it can't talk to the gateway (kind of guessing), however after a load of fiddling around I've found the solution:

PHP Code:
route add -host 10.255.255.1 dev eth0
route add 
default gw 10.255.255.1 dev eth0 
That should get you going apparently to set it up as a permanent thing whenever you restart networking you should add the following to the bottom of /etc/network/interfaces :

PHP Code:
up route add -host 10.255.255.1 dev eth0
up route add 
default gw 10.255.255.1 dev eth0 
However I've not managed to get that to work yet, but I am messing around with virtual interfaces and bridges so you might have more luck.

Hope this helps!
 
Old 03-28-2012, 03:33 AM   #3
nikmit
Member
 
Registered: May 2011
Location: Nottingham, UK
Distribution: Debian
Posts: 178

Rep: Reputation: 34
If they have layer 2 security configured (ARP inspection, DHCP snooping etc.) it might not be possible to avoid DHCP. Another concern would be, if they do change your IP assignment to something in a different subnet and you have it staticaly configured, you might lose connectivity altogether.
I would stick to the DHCP provided IP, just make resolv.conf unwritable with 'chattr +i /etc/resolv.conf' so DHCP can't change your DNS servers. That's what I am doing anyway
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't change from dhcp to static ip address. Darrell22 Linux - Networking 7 01-17-2010 10:00 PM
Change from DHCP to Static IP? walterbyrd Red Hat 1 06-23-2008 10:43 PM
How do I change from DHCP to static IP? walterbyrd Debian 3 05-11-2006 06:58 PM
FC2 Overriding static if in favor of dhcp system set for static pkraus109 Linux - Networking 8 09-21-2004 11:13 AM
Change DHCP to Static in RH9 jimbo Linux - Networking 6 03-30-2004 07:33 PM


All times are GMT -5. The time now is 07:46 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration