質問

So I've delved into the world of running a server without a control panel for the first time, doing everything through the terminal and occasionally logging into the desktop gui if I need to.

I've got nearly everything working as far as I can tell, the firewall was a hassle but I think i've got it now.

The last thing I can't quite work out is how to get the domain name I purchased pointing correctly to my server (I've always done this through a control panel before which automated most of it).

These are the steps I've taken so far (These may be wrong, I've been googling the thing like mad but everywhere tells me to do something different, so please let me know if something is wrong).

  • Purchased name name, for sake of example "mydomain.com"
  • Have server running Ubuntu 64 bit. IP address for sake of example "1.2.3.4"
  • The host has provided me with 3 "DNS Resolvers", for sake of example: "1.1.1.1", "1.1.1.2", "1.1.1.3"

  • I've set the hostname on my server

  • Running "hostname" in the terminal outputs: mydomain
  • Checking /etc/hostname outputs: mydomain.com

  • I've added those 3 DNS resolvers to my /etc/resolv.conf file like so:

    domain mydomain.com
    search mydomain.com
    nameserver 1.1.1.1
    nameserver 1.1.1.2
    nameserver 1.1.1.3
    
  • I've set the virtual host up in my httpd.conf file:

    <VirtualHost 1.2.3.4:80>
    ServerName mydomain.com
    ServerAlias mydomain
    DocumentRoot /var/www/mysite
    </VirtualHost>
    

Now from here on I've just been palying around with different things. At the moment I've gone into my domain registrar panel and set three nameservers as "ns1.mydomain.com", "ns2.mydomain.com", "ns3.mydomain.com".

I've installed webmin to try and set the DNS zone records and this is what I've got at the moment on the output of various commands:

(where 1.1.1.1, 1.1.1.2, 1.1.1.3 are those DNS resolvers)

[b]nslookup -sil localhost[/b]

conn@duckfusion:~$ nslookup -sil localhost
;; Got SERVFAIL reply from 1.1.1.2, trying next server
;; Got SERVFAIL reply from 1.1.1.3, trying next server
;; connection timed out; no servers could be reached

[b]nslookup -sil mydomain.com[/b]

conn@duckfusion:~$ nslookup -sil mydomain.com
;; Got SERVFAIL reply from 1.1.1.2, trying next server
;; Got SERVFAIL reply from 1.1.1.3, trying next server
;; connection timed out; no servers could be reached

Here is my "named.conf" file:

// This is the primary configuration file for the BIND DNS server named.
//
// Please read /usr/share/doc/bind9/README.Debian.gz for information on the
// structure of BIND configuration files in Debian, *BEFORE* you customize
// this configuration file.
//
// If you are just adding zones, please do that in /etc/bind/named.conf.local

include "/etc/bind/named.conf.options";
include "/etc/bind/named.conf.local";
include "/etc/bind/named.conf.default-zones";

[u]named.conf.options[/u]

options {
        directory "/var/cache/bind";

        // If there is a firewall between you and nameservers you want
        // to talk to, you may need to fix the firewall to allow multiple
        // ports to talk.  See http://www.kb.cert.org/vuls/id/800113

        // If your ISP provided one or more IP addresses for stable
        // nameservers, you probably want to use them as forwarders.
        // Uncomment the following block, and insert the addresses replacing
        // the all-0's placeholder.

         forwarders {
                1.1.1.1; 1.1.1.2; 1.1.1.3; 208.67.222.222; 208.67.220.220;
         };

        //========================================================================
        // If BIND logs error messages about the root key being expired,
        // you will need to update your keys.  See https://www.isc.org/bind-keys
        //========================================================================
        dnssec-validation auto;

        auth-nxdomain no;    # conform to RFC1035
        listen-on-v6 { any; };
        allow-query {
                any;
                };
        listen-on port 53 {
                any;
                };
};

[u]named.conf.local[/u]

//
// Do any local configuration here
//

// Consider adding the 1918 zones here, if they are not used in your
// organization
//include "/etc/bind/zones.rfc1918";

zone "mydomain.com" {
        type master;
        file "/var/lib/bind/mydomain.com.hosts";
        };

[u]/var/lib/bind/mydomain.com.hosts[/u] (Where 1.2.3.4 is my server's IP)

$ttl 38400
mydomain.com. IN      SOA     mydomain.com. me.myemail.com. (
                        1366054515
                        10800
                        3600
                        604800
                        38400 )
mydomain.com. IN      NS      mydomain.com.
mydomain.com. IN      A       1.2.3.4
www.mydomain.com.     IN      A       1.2.3.4
mail.mydomain.com.    IN      A       1.2.3.4
ftp.mydomain.com.     IN      A       1.2.3.4
ns1.mydomain.com.     IN      A       1.2.3.4
ns2.mydomain.com.     IN      A       1.2.3.4
ns3.mydomain.com.     IN      A       1.2.3.4
mydomain.com. IN      NS      ns1.mydomain.com.
mydomain.com. IN      NS      ns2.mydomain.com.
mydomain.com. IN      NS      ns3.mydomain.com.
mydomain.com. IN      MX      10 mail.mydomain.com.

That's as far as I've got.

I can obviously get to the server via IP address as URL, but as of yet not by domain name.

Could anyone let me know:

A) Where I've gone wrong B) What I need to do to achieve this?

Thank you very much.

役に立ちましたか?

解決

Running your own named is overkill and not needed. Here's what a valid setup looks like:

  1. Your web server hosting provider (where your website lives) gave you some DNS resolvers. These are intended to provide DNS resolution to your web server, so it can find OTHER hosts on the Internet. These resolvers have nothing to do with hosting YOUR domain, and you cannot make changes to their domain definitions.
  2. Your DNS Hosting Provider has their own DNS servers, which are used by default to host your DNS "A" record. If you truly reconfigured your DNS hosting account to use the web provider's DNS servers, this is an error. You cannot add your DNS record to those servers.
  3. On your DNS Hosting Provider's control panel, first set it back to using their DNS servers; then create an "A" record for your domain, pointing to the IP of your web server host.

In summary:

DNS Hosting Provider
    DNS Server(s) contain:
        www.yourserver.com      A     1.2.3.4
        alias.yourserver.com    CNAME www.yourserver.com (maybe)
        yourserver.com          MX    where.you.receive.mail (maybe)

Web Hosting Provider
    Your web server at 1.2.3.4
        /etc/resolv.conf
            nameserver 1.1.1.1
            nameserver 1.1.1.2
            nameserver 1.1.1.3

That's all you need to do for other people to be able to find your server.

The only reason to run your own DNS would be to host an entire network consisting of multiple machines, behind a firewall, or hosting an entire Class C or greater set of IP addresses. To do this you'd need peering and routing agreements with other providers, which I don't think you have.

EDIT

$ dig duckfusion.com

; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6_4.4 <<>> duckfusion.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 32080
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 5, ADDITIONAL: 17

;; QUESTION SECTION:
;duckfusion.com.                        IN      A

;; ANSWER SECTION:
duckfusion.com.         1800    IN      A       87.117.219.53
duckfusion.com.         1800    IN      A       192.31.186.140

;; AUTHORITY SECTION:
duckfusion.com.         172800  IN      NS      dns4.registrar-servers.com.
duckfusion.com.         172800  IN      NS      dns5.registrar-servers.com.
duckfusion.com.         172800  IN      NS      dns3.registrar-servers.com.
duckfusion.com.         172800  IN      NS      dns1.registrar-servers.com.
duckfusion.com.         172800  IN      NS      dns2.registrar-servers.com.
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top