Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: setting up a static IP address for my server

  1. #1
    Join Date
    Dec 2010
    Beans
    433

    setting up a static IP address for my server

    I am trying to setup a static IP address for my Ubuntu server. I go to the admin page for my router, set the MAC address, and the IP address that I would like. I then set it to static. I then test it by turning off the server, and plugging in another device. The other device comes online, takes the server's IP address, and changes the static MAC address to the new device that just came online. Why would the IP address not be reserved if it was set to static?

  2. #2
    Join Date
    Apr 2012
    Beans
    7,256

    Re: setting up a static IP address for my server

    it's hard to tell without knowing the particular router, but possibly by setting it to 'static' on the router, it thinks you intend to set up a true static IP on the client? Normally when you reserve an IP on the router side that is not really classed as 'static', it is done via DHCP (i.e. the client still gets its IP via DHCP, but the router's DHCP server always hands out the same IP based on MAC)

  3. #3
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: setting up a static IP address for my server

    Setting a static IP through the router is called "DHCP Reservation" - it is tied to the MAC address used by the specific network card inside the server.

    The server will need to be rebooted (or at least the network static will need to be restarted) for the new IP to take effect.

    It is best to put the static IP outside the normal DHCP range of IPs. Could this be the issue?

    It is unclear to me what you mean by "plugging in another device."

    Ok, completely switching gears now ... the best way to setup a static IP for a server is NOT in the DHCP reservations on a router, rather, tell the server which IP address it should use and have it demand that address. How to do this depends on whether you have any GUI installed or not. If you only have Ubuntu Server installed - no GUI, no Network Manager, then edit the /etc/network/interfaces file, restart the networking service and you are done. I haven't a clue how to do it with a GUI involved. Sorry. man interfaces will explain the options, but normally, something like this example will be used.

    Code:
    auto eth0
    iface eth0 inet static
      address 192.168.1.xx
      gateway 192.168.1.x
      netmask 255.255.255.0
      dns-nameservers 192.168.1.x
      dns-search example.com example.lan
    Your specific settings will be different, probably. All the 'x' characters need to be changed to your network - other parts will likely need to be changed as well. I think these are the bare minimal settings needed.

    DO NOT use a static IP in the range given out by your router for DHCP addresses.

  4. #4
    Join Date
    Dec 2010
    Beans
    433

    Re: setting up a static IP address for my server

    I saved a few addresses, and saved 192.168.1.231 as my server address. I setup my interfaces file like so:
    Code:
    auto wlan0iface wlan0 inet static
      address 192.168.1.231
      gateway 192.168.1.1
      netmask 255.255.255.0
      dns-nameservers 192.168.1.1  dns-search 192.168.1.1
    When I ping it, it says that the destination host is unreachable. The server does say it has that address.
    Edit: I turned off the server, and it says that 192.168.1.231 is still active on the router admin page. Also, I could not ping 192.168.1.1 from the server.
    Last edited by sniper8752; December 22nd, 2013 at 03:10 AM.

  5. #5
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: setting up a static IP address for my server

    If you cannot ping the router, that is bad. Very bad. Time to get a working network again and post some specific cmd results.

    $ route
    $ ifconfig

    Those should be enough. Make certain that everything is working on your network BEFORE running those cmds.
    Also, please confirm that you are running Ubuntu Server - NO GUI. If you have a GUI, the steps are different.

    Bedtime here. Bye.

  6. #6
    Join Date
    Aug 2005
    Location
    South Carolina, USA
    Beans
    26,047
    Distro
    Ubuntu Development Release

    Re: setting up a static IP address for my server

    Just to humor an old Chili, please set up interfaces like this:
    Code:
    auto lo
    iface lo inet loopback
    
    auto wlan0
    iface wlan0 inet static
      address 192.168.1.231
      netmask 255.255.255.0
      gateway 192.168.1.1
      dns-nameservers 192.168.1.1
    Now get the system to re-read and use the changes:
    Code:
    sudo ifdown wlan0 && sudo ifup -v wlan0
    Any errors or warnings? How about?
    Code:
    ping -c3 192.168.1.1
    Last edited by chili555; December 22nd, 2013 at 02:48 PM.
    "Oh, Ubuntu, you are my favorite Linux-based operating system" --Dr. Sheldon Cooper, B.Sc., M.Sc., M.A., Ph.D., Sc.D.

  7. #7
    Join Date
    Dec 2010
    Beans
    433

    Re: setting up a static IP address for my server

    I set it up like that, and got no error messages. still says that it can't reach the destination.

  8. #8
    Join Date
    Jan 2006
    Location
    Not heaven... Iowa
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: setting up a static IP address for my server

    Back to the previoius request, then...
    results of:
    route -n
    ifconfig
    Linux User #415691 Ubuntu User #8629
    Iowa Team (LoCo): [Wiki] [Launchpad]
    IRC channel: #ubuntu-us-ia on irc.freenode.net

  9. #9
    Join Date
    Dec 2010
    Beans
    433

    Re: setting up a static IP address for my server

    route:
    destination/gateway/genmask
    0.0.0.0 192.168.1.1 0.0.0.0
    192.168.1.0 0.0.0.0 255.255.255.0

    ifconfig
    inet addr: 192.168.1.231
    bcast: 192.168.1.255
    mask: 255.255.255.0

  10. #10
    Join Date
    Aug 2005
    Location
    South Carolina, USA
    Beans
    26,047
    Distro
    Ubuntu Development Release

    Re: setting up a static IP address for my server

    I am off for the evening, but one of the guys will help you set it to DHCP, and see what address, gateway, route, etc. you get.
    "Oh, Ubuntu, you are my favorite Linux-based operating system" --Dr. Sheldon Cooper, B.Sc., M.Sc., M.A., Ph.D., Sc.D.

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •