? Can't determine specific details for static IP setup

Discussion in 'HOWTO-Related Questions' started by tdurham, Sep 5, 2011.

  1. tdurham

    tdurham New Member

    Please read this carefully before assuming that I have not researched this for days on end. I have a dedicated "cloud" server from 1and1 and I have loaded Debian lenny 64 on it. I have bricked it almost 10 times trying to set the static IP info for the server. I can't figure out what I am doing wrong. This is "pre-imaged" server. There are 100's of samples on how to fill out the /etc/network/interfaces file but they are ALWAYS for local 192.168.1.1 (or similar IP's. They NEVER tell a non programmer how to determine what the values should be. So here is what I do each time after the re-image.

    I install all my updates and I am installing Nginx instead of Apache. I have 6 ips assigned to this server. (I changed my IP's for this example).

    Main Server IP: 211.240.117.1
    Additional IP's : 211.240.117.3 thru 211.240.117.7

    Step 1: vim /etc/hosts

    127.0.0.1 localhost.localdomain localhost
    211.240.117.1 u15761234.onlinehome-server.com u15761234
    211.240.117.1 default-domain.com

    (I do not add anything to this file. I am not setting up the Virtual Servers right now. I just want to change it from DHCP to static.

    Step 2: vim /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 eth0
    iface lo inet loopback

    # The primary network interface
    #allow-hotplug eth0
    iface eth0 inet dhcp

    ------------------------------------------------

    Then I run # netstat -nr

    u15761234:~# netstat -nr
    Kernel IP routing table
    Destination Gateway Genmask Flags MSS Window irtt Iface
    10.255.255.1 0.0.0.0 255.255.255.255 UH 0 0 0 eth0
    0.0.0.0 10.255.255.1 0.0.0.0 UG 0 0 0 eth0
    u15761234:~#

    -------------------------------------------------

    I then edit my Primary Network Interface to be this:

    # The primary network interface
    auto eth0
    iface eth0 inet static
    address 211.240.117.1
    gateway 10.255.255.1 (I am just using value from above)
    netmask 255.255.255.255
    network 192.168.1.0 (this is what I have no idea what it should be???
    broadcast 211.240.117.1 (I know this is optional).

    Should I specify a DNS server here?

    --------------------------------------------------

    Then I run # /etc/init.d/networking restart

    I loose my SSH connection and server is non reachable and can't be restarted from the 1and1 control panel. I have to re-image and start all over again.

    Any help will be greatly appreciated.
    1. What files have to be updated to change it to a static IP setup and not run DHCP (only /etc/hosts and /etc/network/interfaces ??? )

    2. How do I determine the proper value to put in NETWORK entry?

    3. Do I used the Gateway value from where I ran netstat -nr

    4. Is there a way to do this so that IF a person screws something up (like I have done 10 times trying), that it will have a "fall back network config" to roll over to and still boot up.

    Thanks for all of your help!!!

    Tim D
     
  2. mentes

    mentes Member

    This is the whole /etc/network/interfaces that you need in your server.

    Code:
    # The loopback network interface
    auto lo
    iface lo inet loopback
    
    # The primary network interface
    auto eth0
    iface eth0 inet static
    	address 211.240.117.1
    	netmask 255.255.255.0
    	network 211.240.117.0
    	broadcast 211.240.117.255
    	gateway 10.255.255.1[COLOR="Red"] --> This is the output of your netstat -nr[/COLOR] 
    	# dns-* options are implemented by the resolvconf package, if installed
    	dns-nameservers 8.8.8.8 8.8.4.4 [COLOR="red"]--> These are google nameservers, you can use others[/COLOR]
    	dns-search yourdomain.com
    auto eth0:1
    iface eth0:1 inet static
    	address 211.240.117.3
    	netmask 255.255.255.255
    	broadcast 211.240.117.3
    auto eth0:2
    iface eth0:2 inet static
    	address 211.240.117.4
    	netmask 255.255.255.255
    	broadcast 211.240.117.4
    auto eth0:3
    iface eth0:3 inet static
    	address 211.240.117.5
    	netmask 255.255.255.255
    	broadcast 211.240.117.5
    auto eth0:4
    iface eth0:4 inet static
    	address 211.240.117.6
    	netmask 255.255.255.255
    	broadcast 211.240.117.6
    auto eth0:5
    iface eth0:5 inet static
    	address 211.240.117.7
    	netmask 255.255.255.255
    	broadcast 211.240.117.7
    
     

Share This Page