Page 1 of 3 123 LastLast
Results 1 to 10 of 28

Thread: How to change to static ip address on my ubuntu server

  1. #1
    Join Date
    Dec 2010
    Beans
    94

    Exclamation How to change to static ip address on my ubuntu server

    Hi,
    Im running ubuntu server 10.10 on my wirtual mashine at home.
    For now i have few service installed and configured:apache with phpand mysql support,ftp,phpmyadmin..
    My ip address is not static, i tryed to configure by following some guide but without success.

    First i edit this in /etc/network/interfaces (changing dhcp to static
    Code:
    # The primary network interface
    auto eth0
    iface eth0 inet static
    address (adding some random ip address - lets say the address which is granted from previous dhcp configuration)
    netmask 255.255.255.0
    broadcast -.-.-.255
    network -.-.-.0
    gateway my.gateway.address.
    Then i edit /etc/resolv.conf
    Code:
    nameserver (changing to my.gateway.address.10)
    domain localdomain #
    search localdomain # those 2 not changing
    then in some guide it says to remove dhcpclient if it's installed.. so i enter this:
    Code:
    sudo apt-get remove dhcp-client
    then reboot network adapter with ( ~networking restart) or just reboot server.
    So the address and configuration is stored, but i cant for example ping www.google.com
    ...dont have internet conection and i cant connect with browser to test my ftp or apache(...dont recognize address)

    I think im something doing wrong with nameserver,domain and search (/etc/resolv.conf - in global)
    This all is a bit confusing for me...

    Can someone explain me where is my mistake and help me configure static ip for my server
    Last edited by alfamuzjak; March 7th, 2011 at 05:50 PM.

  2. #2
    Join Date
    Jan 2008
    Beans
    223

    Re: How to change to static ip address on my ubuntu server

    This is the configuration I have in my /etc/network/interfaces file on one of my desktop PCs:

    # The loopback network interface
    auto lo
    iface lo inet loopback

    # The primary network interface
    auto eth0
    iface eth0 inet static
    address 192.168.254.1
    netmask 255.255.255.0
    network 192.168.254.0
    broadcast 192.168.254.255
    gateway 192.168.254.254

    The /etc/resolv.conf file should be something like this:

    nameserver 192.168.254.254

    Ensure you use an IP address. If you don't know of any name servers to use, use the Google name server of 8.8.8.8 - but it will only work if your ISP allows you to connect out on port 53 UDP.

    After updating that, go ahead and just do a full reboot and see if it makes a difference. When you do an:

    ifconfig

    The information for eth0 should show up with the info you provided in the /etc/network/interfaces file.

    Brian S.
    BsnTech Networks
    http://www.bsntech.com

  3. #3
    Join Date
    Dec 2010
    Beans
    94

    Re: How to change to static ip address on my ubuntu server

    My interfaces configuration:
    Code:
    auto eth0
    iface eth0 inet static
    address 192.168.23.130
    netmask 255.255.255.0
    network 192.168.23.0
    broadcsst 192.168.23.255
    gateway 192.168.0.1  # i use gateway which was standing at   lo paragraf of ifconfig command...that is address of my router...
    /etc/resolve.conf contain only:
    nameserver 8.8.8.8 (i delete lines with 'domain' and 'search')

    after pinging google i got:
    Code:
    ping: unknown host www.google.com

  4. #4
    Join Date
    Mar 2011
    Location
    Bogotá DC, Colombia
    Beans
    11
    Distro
    Ubuntu

    Re: How to change to static ip address on my ubuntu server

    Code:
    ping: unknown host www.google.com
    This means that the DNS server couldn't be reached. If you have a Router most likely it will have an embeded DNS server try changing your resolv.conf and set your router's IP as DNS Server like so:

    Code:
    nameserver 192.168.0.1

  5. #5
    Join Date
    Jan 2008
    Beans
    223

    Re: How to change to static ip address on my ubuntu server

    In addition - to be sure that you actually do have Internet connectivity, see if you can ping an IP address. This way it isn't using DNS to do a lookup - but it is fully skipping this step.

    So see if you get replies if you do a "ping 8.8.8.8". This will ensure that your /etc/network/interfaces file is setup properly and that you have Internet access.

    If you can do a ping to 8.8.8.8, then your ISP may be blocking outgoing port 53 UDP.

    Brian S.
    BsnTech Networks
    http://www.bsntech.com

  6. #6
    Join Date
    Dec 2010
    Beans
    94

    Re: How to change to static ip address on my ubuntu server

    Nothing!
    I dont know what to do, its insane, i cant have static server.
    any advice?!

    P.S.Thank you for trying to help me

  7. #7
    Join Date
    Dec 2010
    Beans
    94

    Re: How to change to static ip address on my ubuntu server

    ping 8.8.8.8
    Code:
    connect: network is unreachable

  8. #8
    Join Date
    Oct 2009
    Location
    Phoenix, AZ
    Beans
    125
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: How to change to static ip address on my ubuntu server

    Ummm, if your computer is on the 192.168.23.0 network, how can your gateway be the 192.168.0.1 network? Your gateway is incorrect, point it to 192.168.23.0 or 192.168.23.254 (depending on your routers configuration). The router will handle the forwarding to the .192.168.0.0 network if it is indeed connected to that network....
    HP G-71 Notebook Intel Core2-Duo 2.2GHz 4GB
    Dual boot Win7 - Ubuntu 10.04x64
    Shared RHEL-5.4 Virtual Machines via VMware

  9. #9
    Join Date
    Dec 2010
    Beans
    94

    Re: How to change to static ip address on my ubuntu server

    Didn't quitely understand, you are saying what...to change:
    network to 192.168.0.0, or to change gateway to 192.168.23.1/0/254 in /etc/network/intefaces?

    Sorry but i tryed so many combination and have dizzyness from numbers:/

    P.S. how then virtual mashine and my comp can ping each other - if they arent on same network.. - try to ignore this if u think it is stupid
    Last edited by alfamuzjak; March 7th, 2011 at 07:26 PM. Reason: p.s.

  10. #10
    Join Date
    Oct 2009
    Location
    Phoenix, AZ
    Beans
    125
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: How to change to static ip address on my ubuntu server

    Actually, I take that back. Sounds like you have just a single router so your static ip needs to be in the 192.168.0. (1-254) range and gateway needs to be 192.168.0.0 as well as nameserver needs to be 192.168.0.0 (unless you are running a dns server)
    HP G-71 Notebook Intel Core2-Duo 2.2GHz 4GB
    Dual boot Win7 - Ubuntu 10.04x64
    Shared RHEL-5.4 Virtual Machines via VMware

Page 1 of 3 123 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
  •