Results 1 to 4 of 4

Thread: Cannot point hostname to new ip

  1. #1
    Join Date
    Aug 2013
    Beans
    2

    Cannot point hostname to new ip

    Hi!

    I bought a new VPS and I need to move a website to that VPS. I want to test it before going live. I haven't installed nothing yet, just Apache.

    Under Linux, the /etc/hosts file can be used to override dns definitions, i.e. to point an hostname to a different ip.

    I added a line in the /etc/hosts file:

    123.123.123.123 www.mywebsite.com

    - I flushed all caches and went to www.mywebsite.com , but it still shows the old site.
    - I used ping to test the ip and it shows the new ip.
    - I used wget to retrieve the index.html file, but it retrieves the file from the old server.
    - I bypassed my router to check if it's something related with it, but it isn't.
    - I restarted my PC
    - I checked using Linx text browser

    If instead I add:

    123.123.123.123 http://ubuntuforums.org

    I still see this website. So it's not related with the new VPS

    Why can't I point a hostname to a new IP?

    Is there another way to do it?

    Thanks for your help!

  2. #2
    Join Date
    May 2007
    Location
    North Carolina, USA
    Beans
    97
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Cannot point hostname to new ip

    You can have a line in your /etc/hosts file such as

    123.123.123.123 mywebsite

    and then enter either http://mywebsite or mywebsite as a url in your browser.

  3. #3
    Join Date
    Aug 2013
    Beans
    2

    Re: Cannot point hostname to new ip

    Thanks. I tried your suggestion, here is the output of wget:

    wget mywebsite
    --2013-08-22 13:18:32-- http://mywebsite/
    Resolving mywebsite (mywebsite)... 192.3.90.190
    Connecting to mywebsite (mywebsite)|192.3.90.190|:80... connected.
    HTTP request sent, awaiting response... No data received.
    Retrying.
    I tried the usual way from another removed server:
    added
    123.123.123.123 www.mywebsite.com
    in /etc/hosts
    wget www.mywebsite.com and I see the contents of the new server. So the problem is of my local connection.

  4. #4
    Join Date
    May 2008
    Location
    SoCal
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Cannot point hostname to new ip

    Quote Originally Posted by lara_c2 View Post
    ... Under Linux, the /etc/hosts file can be used to override dns definitions, i.e. to point an hostname to a different ip.
    This is not quite correct.

    By default, the local /etc/hosts file is always checked before checking with a DNS server. Either your /etc/hosts file is not correct or the /etc/nsswitch.conf file has been altered on this host.
    Last edited by bab1; August 23rd, 2013 at 08:22 AM.
    -BAB1

Tags for this Thread

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
  •