Page 3 of 5 FirstFirst 12345 LastLast
Results 21 to 30 of 41

Thread: Set up an internal mail server

  1. #21
    Join Date
    Jul 2006
    Location
    Gujranwala, Pakistan
    Beans
    139
    Distro
    Ubuntu

    Re: Set up an internal mail server

    I understand your point...but SeijiSensei and KennethConn seem to think there is a way to do this w/o setting up a DNS server...
    Last edited by sbjaved; November 18th, 2012 at 10:07 PM.

  2. #22
    Join Date
    Jul 2006
    Location
    Gujranwala, Pakistan
    Beans
    139
    Distro
    Ubuntu

    Re: Set up an internal mail server

    Experimenting with BIND/DNS on the debian VM. I've run into some errors. I've posted the config files and error below.

    /etc/bind/named.conf

    Code:
    // 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";
    /etc/bind/named.conf.local

    Code:
    //
    // Do any local configuration here
    //
    
    zone "javed.local" {
        type master;
    	file "/etc/bind/db.javed.local";
    };
    
    zone "0.168.192.in-addr.arpa" {
        type master;
    	file "/etc/bind/db.0.168.192";
    };
    
    // Consider adding the 1918 zones here, if they are not used in your
    // organization
    include "/etc/bind/zones.rfc1918";
    /etc/bind/named.conf.options

    Code:
    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 {
    		192.168.15.1;
    	};
    
    	auth-nxdomain no;    # conform to RFC1035
    	listen-on-v6 { any; };
    };
    /etc/bind/db.javed.local (forward-lookup)

    Code:
    $TTL 86400
    javed.local.            IN     SOA    debian.javed.local. (
                       2004011522     ; Serial no., based on date
                            21600     ; Refresh after 6 hours
                             3600     ; Retry after 1 hour
                           604800     ; Expire after 7 days
                             3600     ; Minimum TTL of 1 hour
                          )
    beast                 IN     A       192.168.0.104
    home-server           IN     A       192.168.0.105
    debian                IN     A       192.168.0.106
    @                     IN     NS      debian
    @                     IN     MX      10 debian
    debian                IN     CNAME   @
    /etc/bind/db.0.168.192 (reverse lookup)

    Code:
    $TTL 86400
    @                     IN     SOA    debian.javed.local. (
                       2004011522     ; Serial no., based on date
                            21600     ; Refresh after 6 hours
                             3600     ; Retry after 1 hour
                           604800     ; Expire after 7 days
                             3600     ; Minimum TTL of 1 hour
                          )
    104                    IN     PTR     beast
    105                    IN     PTR     home-server
    106                    IN     PTR     debian
    @                      IN     NS      debian
    Error:

    Code:
    saad@debian:~$ sudo named-checkconf -z
    dns_rdata_fromtext: /etc/bind/db.javed.local:7: near eol: unexpected end of input
    dns_master_load: /etc/bind/db.javed.local:14: debian.javed.local: CNAME and other data
    zone javed.local/IN: loading from master file /etc/bind/db.javed.local failed: unexpected end of input
    zone javed.local/IN: not loaded due to errors.
    _default/javed.local/IN: unexpected end of input
    dns_rdata_fromtext: /etc/bind/db.0.168.192:7: near eol: unexpected end of input
    zone 0.168.192.in-addr.arpa/IN: loading from master file /etc/bind/db.0.168.192 failed: unexpected end of input
    zone 0.168.192.in-addr.arpa/IN: not loaded due to errors.
    _default/0.168.192.in-addr.arpa/IN: unexpected end of input
    zone 10.in-addr.arpa/IN: loaded serial 1
    zone 16.172.in-addr.arpa/IN: loaded serial 1
    zone 17.172.in-addr.arpa/IN: loaded serial 1
    zone 18.172.in-addr.arpa/IN: loaded serial 1
    zone 19.172.in-addr.arpa/IN: loaded serial 1
    zone 20.172.in-addr.arpa/IN: loaded serial 1
    zone 21.172.in-addr.arpa/IN: loaded serial 1
    zone 22.172.in-addr.arpa/IN: loaded serial 1
    zone 23.172.in-addr.arpa/IN: loaded serial 1
    zone 24.172.in-addr.arpa/IN: loaded serial 1
    zone 25.172.in-addr.arpa/IN: loaded serial 1
    zone 26.172.in-addr.arpa/IN: loaded serial 1
    zone 27.172.in-addr.arpa/IN: loaded serial 1
    zone 28.172.in-addr.arpa/IN: loaded serial 1
    zone 29.172.in-addr.arpa/IN: loaded serial 1
    zone 30.172.in-addr.arpa/IN: loaded serial 1
    zone 31.172.in-addr.arpa/IN: loaded serial 1
    zone 168.192.in-addr.arpa/IN: loaded serial 1
    zone localhost/IN: loaded serial 2
    zone 127.in-addr.arpa/IN: loaded serial 1
    zone 0.in-addr.arpa/IN: loaded serial 1
    zone 255.in-addr.arpa/IN: loaded serial 1
    I've mainly followed instructions from here:
    http://www.aboutdebian.com/dns.htm

  3. #23
    Join Date
    Nov 2009
    Location
    Segur De Calafell, Spain
    Beans
    11,660
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Set up an internal mail server

    I think you should take a look at the link I posted earlier, about settings up DNS in ubuntu the easy way. It has exact and precise insructions.
    Here is the link again:
    http://www.pressbyte.com/4581/setup-...ntu-vps-quick/

    Alternatively, you can use a very simple DNS with dnsmasq because that's all you need. If you want to try that, stop the bind daemon (service), and install dnsmasq in the VM:
    sudo apt-get install dnsmasq

    After that, edit /etc/hosts and add your server there, which seems to have hostname 'debian', so make it something like:
    192.168.0.100 debian.javed.local

    Use the correct IP for the server if it's not 192.168.0.100. dnsmasq will use the hosts in /etc/hosts so adding the server host there will make it use it in DNS queries.

    Finally, open the /etc/dnsmasq.conf file and look for mx-host (it's towards the middle of the file, there are many rows to scroll, the file is big). If you use nano to edit, you can search inside the file with Ctrl+W and look for mx-host.
    When you find the line, remove the # at front and edit the line to something like:
    mx-host=javed.local,debian.javed.local,10

    If I'm not mistaken that should return debian.javed.local (the server host) for the MX queries on the javed.local domain.

    After saving and closing the file, restart the dnsmasq service.

    That should be it. Don't forget that the primary DNS for the local machines should be your server, either by setting it up manually or adding the option in the router dhcp settings.

    If everything worked fine, if you now try:
    ping debian.javed.local

    from any machine it should return a reply.

    And the MX query should work fine too.
    Darko.
    -----------------------------------------------------------------------
    Ubuntu 12.04 LTS 64bit & Windows 7 Ultimate 64bit

  4. #24
    Join Date
    Jul 2006
    Location
    Gujranwala, Pakistan
    Beans
    139
    Distro
    Ubuntu

    Re: Set up an internal mail server

    I set it up like you explained. Changed nameserver 192.168.0.106 in /etc/resolv.conf on a client machine (beast), and pinged debian.

    Code:
    saad@beast:~$ ping debian.javed.local
    ping: unknown host debian.javed.local
    
    saad@beast:~$ ping debian
    PING debian.javed.local (192.168.0.106) 56(84) bytes of data.
    64 bytes from debian.javed.local (192.168.0.106): icmp_req=1 ttl=64 time=0.289 ms
    64 bytes from debian.javed.local (192.168.0.106): icmp_req=2 ttl=64 time=0.390 ms
    64 bytes from debian.javed.local (192.168.0.106): icmp_req=3 ttl=64 time=0.387 ms
    64 bytes from debian.javed.local (192.168.0.106): icmp_req=4 ttl=64 time=0.424 ms
    64 bytes from debian.javed.local (192.168.0.106): icmp_req=5 ttl=64 time=0.161 ms
    ^C
    --- debian.javed.local ping statistics ---
    5 packets transmitted, 5 received, 0% packet loss, time 4005ms
    rtt min/avg/max/mdev = 0.161/0.330/0.424/0.096 ms
    
    saad@beast:~$ dig debian.javed.local
    
    ; <<>> DiG 9.8.1-P1 <<>> debian.javed.local
    ;; global options: +cmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 45297
    ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0
    
    ;; QUESTION SECTION:
    ;debian.javed.local.		IN	A
    
    ;; ANSWER SECTION:
    debian.javed.local.	0	IN	A	192.168.0.106
    debian.javed.local.	0	IN	A	127.0.1.1
    
    ;; Query time: 1 msec
    ;; SERVER: 192.168.0.106#53(192.168.0.106)
    ;; WHEN: Mon Nov 19 15:44:54 2012
    ;; MSG SIZE  rcvd: 68
    Does the client (beast) have to be a part of the javed.local domain for ping to work? it is pinging debian but not debian.javed.local ...
    Last edited by sbjaved; November 19th, 2012 at 12:15 PM.

  5. #25
    Join Date
    Nov 2009
    Location
    Segur De Calafell, Spain
    Beans
    11,660
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Set up an internal mail server

    No, it doesn't.

    What is the IP of the server, 100 or 106?
    Darko.
    -----------------------------------------------------------------------
    Ubuntu 12.04 LTS 64bit & Windows 7 Ultimate 64bit

  6. #26
    Join Date
    Jul 2006
    Location
    Gujranwala, Pakistan
    Beans
    139
    Distro
    Ubuntu

    Re: Set up an internal mail server

    Code:
    saad@beast:~$ dig mx javed.local
    
    ; <<>> DiG 9.8.1-P1 <<>> mx javed.local
    ;; global options: +cmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 37927
    ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 2
    
    ;; QUESTION SECTION:
    ;javed.local.			IN	MX
    
    ;; ANSWER SECTION:
    javed.local.		0	IN	MX	10 debian.javed.local.
    
    ;; ADDITIONAL SECTION:
    debian.javed.local.	0	IN	A	127.0.1.1
    debian.javed.local.	0	IN	A	192.168.0.106
    
    ;; Query time: 1 msec
    ;; SERVER: 192.168.0.106#53(192.168.0.106)
    ;; WHEN: Mon Nov 19 16:11:22 2012
    ;; MSG SIZE  rcvd: 95

  7. #27
    Join Date
    Jul 2006
    Location
    Gujranwala, Pakistan
    Beans
    139
    Distro
    Ubuntu

    Re: Set up an internal mail server

    Quote Originally Posted by darkod View Post
    No, it doesn't.

    What is the IP of the server, 100 or 106?
    debian is at 192.168.0.106

  8. #28
    Join Date
    Nov 2009
    Location
    Segur De Calafell, Spain
    Beans
    11,660
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Set up an internal mail server

    I didn't notice in your earlier reply that it work with ping debian. I wasn't sure whether you need to add the domain in the ping command since the clients are not in the domain.

    Looks to me like it's working.

    You are getting a correct DNS reply with dig, including the MX reply. And the ping is working.

    Try sending email now.
    Darko.
    -----------------------------------------------------------------------
    Ubuntu 12.04 LTS 64bit & Windows 7 Ultimate 64bit

  9. #29
    Join Date
    Jul 2006
    Location
    Gujranwala, Pakistan
    Beans
    139
    Distro
    Ubuntu

    Re: Set up an internal mail server

    How should I do that?...before I followed wiki instructions for postfix.

    saad@debian:~$ telnet localhost 25
    Trying 127.0.0.1...
    Connected to localhost.
    Escape character is '^]'.
    220 debian.javed.local ESMTP Postfix (Debian/GNU)
    mail from: saad@debian
    250 2.1.0 Ok
    rcpt to: saad@beast
    550 5.1.1 <saad@beast>: Recipient address rejected: beast

  10. #30
    Join Date
    Nov 2009
    Location
    Segur De Calafell, Spain
    Beans
    11,660
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Set up an internal mail server

    Instead of localhost, when doing it from another machine use the server host, debian.javed.local (or only debian, I'm not sure). Like:
    telnet debian.javed.local 25

    But you won't be able to send email to saad@beast. The email system is not used to send from the mailserver to any machine, it's used to send from any machine (email client) to the mailserver.

    So, on the beast machine try something like:
    telnet debian.javed.local 25

    And then try sending from user saad@javed.local to another user that is created on the mailserver and has a mailbox.

    If you add dovecot to postfix, you can use email clients to do this, not the command line.

    In any case, all users have to be created on the server and have their own mailboxes in order to receive mail. You can't try sending email to some mailbox that doesn't exist, right?
    Darko.
    -----------------------------------------------------------------------
    Ubuntu 12.04 LTS 64bit & Windows 7 Ultimate 64bit

Page 3 of 5 FirstFirst 12345 LastLast

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
  •