All right, so I just recently set up a server at home that I will be using to host some projects. However, I can't seem to get the DNS right. I own a domain (let's just call it mydomain.com for now), but I am not sure how to get it to point to my server. I bought the domain with 1and1, and in the DNS settings it said to type in my IP address, which I did. However, when I try to connect (from the same computer, by typing in the domain), it says the server took too long to respond. However, when someone ELSE tries to (I'm not exactly sure about this one, I have changed some settings afterwards, haven't tested since), it says the server rejected their request. I am using a router. Is there something I have to do on my router to enable people to connect? Thanks in advance.

    You'll need to enable port forwarding (port 80) on your router for people from outside to get to your computer.

    Also, to be able to visit the local server via that domain you will need to add the line...

    127.0.0.1        yourdomainname.com
    

    to your hosts file. If your on Linux it is in /etc/hosts, on windows, I have no idea but it does exist. Just search for a file called hosts.

      I bought the domain with 1and1, and in the DNS settings it said to type in my IP address

      Either (A) 1and1 is doing DNS service for you (the Internic points to 1and1 as your authoritative nameserver) and 1and1 has an A record for your machine's IP address or (😎 1and1 has delegated DNS service to your machine.

      If (A) is true and you can't get to your machine by your domain name, then this would be a routing, port, or network issue, or you are not running server software (like Apache) to listen and respond to requests.
      If (😎 then you will need to be hosting DNS service on your local machine and resolving requests for lookups on that domain.

      In neither (A) nor (😎 are you required to set up 127.0.0.1 to make your domain work on your local machine. True, that would make it work, but if that's all you wanted, then you didn't need to actually buy the domain at 1and1 in the first place. For example, if I set up www.phpbuilder.com = 127.0.0.1 in my hosts file on my local machine, then whenever I type in the domain (which I clearly do not own) into my web browser, I will just go to my local machine. If I set up a web site in Apache on my local machine with a picture of my dog, then going to www.phpbuilder.com would bring me to my fake web site, not the real site.

      If you actually own your domain name (which you do), then some machine is made responsible for converting the name (something.yourdomain.com) into an IP address. So when you try to go to that domain name from your local computer, the authoritative machine will resolve "something.yourdomain.com" into the IP address of your machine. If there is no server software (like Apache) set up to respond to requests for that domain, then "getting" to that machine isn't going to do you any good - you're going to "arrive" there but the machine (your own) isn't going to respond.

        @: Thanks for the long description, but I already know how a server/DNS works. 😛 What I was asking is if I should do something on the router, because I set up the DNS and everything for the domain, but it still won't let people get on. I am using Apache if that helps...

        Also, is there an easy way to find out my IP address, without having to go to a website that tells me? Also, I'm running behind a router so I don't even think the IP address the site tells me is accurate, considering routers hide a computer's actual IP address. I think my problem might just be with me entering the wrong IP address...so...any way I can find this out? 😃

          Have you got a static IP? Most ISP's provide you with a dynamic IP and if you specifically have asked for a dynamic IP they will be able to tell you what it is.

          It is the routers IP you need, then from the router you forward port 80 to your server. I have this exact setup at home, running several servers.

            thorpe wrote:

            It is the routers IP you need, then from the router you forward port 80 to your server. I have this exact setup at home, running several servers.

            Ok, that's what I was wondering. However, there are 2 IP addresses...which one? The one that starts with 192 or 102 or whatever? Or the other one? Problem is, neither works for me. 🙁

            Also, what is a "name server"? o_0

              An ip starting with 192 is a LAN ip. Not available over the WAN (internet). Try the 102 one.

              A nameserver translates names eg google.com into adreeses eg 103.20.260.12 without them, you would need to rememeber ip addresses instead of nice names like google.com.

                Ok, thank you very much, I have pretty much everything figured out; I just need some help with configuring my account on 1and1.com.

                Ok, so I went to the DNS settings on the domain, and there were two options: 1and1 Name Server, and My Name Server. I picked the former. I entered my router's IP address (the one labelled as "Primary DNS"). However, I still cannot reach the server (using the domain) on a different computer. Any ideas what's wrong?

                EDIT: Never mind, I figured everything out. Thanks again everyone!

                  Write a Reply...