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

Thread: Setting Up Static IP For My Server

  1. #1
    Join Date
    Aug 2013
    Beans
    15

    Setting Up Static IP For My Server

    Hello,

    I'm currently running a fresh install of Ubuntu 14.04 desktop, and trying to set up a static IP. I've been online watching videos and forums trying to setup a static IP address with no avail. I have a Belkin router with an IP of: 192.168.2.1 currently.

    My server is hard-wired (ethernet cable) to the router, and has an IP of 192.168.2.7 currently. I looked at the following document:
    http://www.fileformat.info/tip/linux/dynamic2static.htm

    but am confused what I'm doing incorrectly. Here are the values I'm trying to input:

    /etc/network/interfaces:

    address 192.168.2.200 (outside of my min/max IP range in my router)
    netmask 255.255.255.0
    network 192.168.2.1 (which is the router address)
    broadcast 192.168.2.100 (which I read is supposed to be the min IP range)
    gateway 192.168.2.1 (also the router address)

    Am I doing this incorrectly? TIA!

    --Asif

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

    Re: Setting Up Static IP For My Server

    Broadcast and network are not essential, but when presented:
    Broadcast is usually the highest address - 192.168.2.255.
    Network is the bottom of the range subnet - 92.168.2.0
    Your file should look something like:
    Code:
    # 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
    iface lo inet loopback
    
    # The primary network interface
    auto eth0
    iface eth0 inet static
    address 192.168.2.200
    netmask 255.255.255.0
    network 192.168.2.0
    broadcast 192.168.2.255
    gateway 192.168.2.1
    Wait... Is the address 192.168.2.200 or 192.168.2.7?
    Last edited by Iowan; April 27th, 2014 at 06:41 PM.
    Linux User #415691 Ubuntu User #8629
    Iowa Team (LoCo): [Wiki] [Launchpad]
    IRC channel: #ubuntu-us-ia on irc.freenode.net

  3. #3
    Join Date
    Aug 2013
    Beans
    15

    Re: Setting Up Static IP For My Server

    The current "real" IP is 192.168.2.7:
    aahmad@ubuntu-desktop:/var/www$ ifconfig
    eth0 Link encap:Ethernet HWaddr 00:21:85:93:33:bc
    inet addr:192.168.2.7 Bcast:192.168.2.255 Mask:255.255.255.0


    But I want to set it with a static IP of: 192.168.2.200 (since it needs to be outside the DHCP IP range).

    Here is the range:



    Finally, I tried your recommendations above, and it still did not work unfortunately.

    Thanks,
    Asif
    Last edited by Asif_Ahmad; April 27th, 2014 at 07:12 PM.

  4. #4
    Join Date
    Nov 2008
    Location
    Metro Boston
    Beans
    12,314
    Distro
    Kubuntu 14.04 Trusty Tahr

    Re: Setting Up Static IP For My Server

    Quote Originally Posted by Asif_Ahmad View Post
    Finally, I tried your recommendations above, and it still did not work unfortunately.
    Well, the configuration Iowan gave you is correct, so something else must be awry.

    First, let's make sure Linux sees the network card. What does "lspci | grep -i ethernet" return? Does it report your adapter like this:
    Code:
    07:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 06)
    If the adapter is recognized, restart networking with "sudo service networking restart". Now enter the command "ifconfig". What do you see for the eth0 address?

    Next see if you can ping your router with "ping 192.168.2.1"? Does that work? If so, try pinging Google's DNS server at 8.8.8.8.
    If you ask for help, please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

  5. #5
    Join Date
    Aug 2005
    Location
    South Carolina, USA
    Beans
    22,973
    Distro
    Ubuntu 16.10 Yakkety Yak

    Re: Setting Up Static IP For My Server

    You have a decision to make; since this is a desktop install, you are undoubtedly running Network Manager. You can set the details perfectly well in NM: http://www.liberiangeek.net/wp-conte...ip_7_thumb.png

    The traditional server method is without NM, obviously, since they are headless and therefor run no graphical environment. If you prefer to do that, remove NM altogether and set /etc/network/interfaces something like this:
    Code:
    # The loopback network interface
    auto lo
    iface lo inet loopback
    
    # The primary network interface
    auto eth0
    iface eth0 inet static
    address 192.168.2.200
    netmask 255.255.255.0
    gateway 192.168.2.1
    dns-nameservers 8.8.8.8 192.168.2.1
    Reboot and check:
    Code:
    ping -c3 192.168.2.1
    ping -c3 www.google.com
    "Oh, Ubuntu, you are my favorite Linux-based operating system" --Dr. Sheldon Cooper, Ph.D.

  6. #6
    Join Date
    Aug 2013
    Beans
    15

    Re: Setting Up Static IP For My Server

    Quote Originally Posted by SeijiSensei View Post
    Well, the configuration Iowan gave you is correct, so something else must be awry.

    First, let's make sure Linux sees the network card. What does "lspci | grep -i ethernet" return? Does it report your adapter like this:
    Code:
    07:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 06)
    If the adapter is recognized, restart networking with "sudo service networking restart". Now enter the command "ifconfig". What do you see for the eth0 address?

    Next see if you can ping your router with "ping 192.168.2.1"? Does that work? If so, try pinging Google's DNS server at 8.8.8.8.
    Here's the output of lspci | grep -i ethernet:

    Code:
    aahmad@ubuntu-desktop:~$ lspci | grep -i ethernet00:14.0 Bridge: NVIDIA Corporation MCP51 Ethernet Controller (rev a3)
    aahmad@ubuntu-desktop:~$

    At this point, my network is essentially down, and I'm no longer connected to anything. When I try to ping anywhere I get a "Network is unreachable" error message in terminal.

  7. #7
    Join Date
    Aug 2013
    Beans
    15

    Re: Setting Up Static IP For My Server

    Quote Originally Posted by chili555 View Post
    You have a decision to make; since this is a desktop install, you are undoubtedly running Network Manager. You can set the details perfectly well in NM: http://www.liberiangeek.net/wp-conte...ip_7_thumb.png

    The traditional server method is without NM, obviously, since they are headless and therefor run no graphical environment. If you prefer to do that, remove NM altogether and set /etc/network/interfaces something like this:
    Code:
    # The loopback network interface
    auto lo
    iface lo inet loopback
    
    # The primary network interface
    auto eth0
    iface eth0 inet static
    address 192.168.2.200
    netmask 255.255.255.0
    gateway 192.168.2.1
    dns-nameservers 8.8.8.8 192.168.2.1
    Reboot and check:
    Code:
    ping -c3 192.168.2.1
    ping -c3 www.google.com

    So I've attempted to disable NM from the instructions here:
    https://help.ubuntu.com/community/Ne...NetworkManager

    After doing so, I still do not appear to have a network unfortunately. I'm not sure if I need to force something so it reads my network settings from the interface configs?

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

    Re: Setting Up Static IP For My Server

    Did the machine get the 192.168.2.200 address?
    The rest might be the aftermath of going static.
    Please post results of route -n

    Quote Originally Posted by chili555 View Post
    ... since this is a desktop install, you are undoubtedly running Network Manager.
    I saw the "server" part, but missed the "14.04 desktop" part...
    Last edited by Iowan; April 28th, 2014 at 11:53 AM.
    Linux User #415691 Ubuntu User #8629
    Iowa Team (LoCo): [Wiki] [Launchpad]
    IRC channel: #ubuntu-us-ia on irc.freenode.net

  9. #9
    Join Date
    Aug 2013
    Beans
    15

    Re: Setting Up Static IP For My Server

    Quote Originally Posted by Iowan View Post
    Did the machine get the 192.168.2.200 address?
    The rest might be the aftermath of going static.
    Please post results of route -n
    Kernel IP Routing Table
    Destination
    Gateway
    Genmask
    Flags Metric Ref
    Use Iface

    It appears the server is no longer on the network.

  10. #10
    Join Date
    Aug 2005
    Location
    South Carolina, USA
    Beans
    22,973
    Distro
    Ubuntu 16.10 Yakkety Yak

    Re: Setting Up Static IP For My Server

    Do you have an ethernet interface, ideally eth0?
    Code:
    ifconfig
    Are there any clues here?
    Code:
    sudo ifdown eth0 && sudo ifup -v eth0
    The -v for verbose flag should produce some output showing what's going on or not behind the scenes.

    Do you get the requested address?
    Code:
    ifconfig
    Can you ping?
    Code:
    ping -c3 www.google.com
    "Oh, Ubuntu, you are my favorite Linux-based operating system" --Dr. Sheldon Cooper, Ph.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
  •