Sending an email to from VM with exim4 to VM with posfix












0















I have two virtual machines and both running Ubuntu server. I should be able to send emails from lab2 to lab1 using mail. lab2 is running exim4and lab1 has postfix listening on port 25. I should configure exim on lab2, so that it delivers the emails that are for lab1 to lab1, and for lab2 to lab2. It works fine when I send emails with mail from lab2 to lab2, but I get an error when sending from lab2 to lab1. As I understand exim should work as a relay for lab1? The error I get is R=dnslookup_relay_to_domains defer (-1): host lookup did not complete, below more details.



From lab2 I can ping and ssh to lab1. Can anybody help me understanding what I am doing wrong? I have tried changing the configuration of exim but I am sure there is something I am not understanding here...



On lab1



The ip address of lab1:



user@lab1:~$ ifconfig
enp0s3 Link encap:Ethernet HWaddr 08:00:27:d5:ec:9a
inet addr:10.0.2.5 Bcast:10.0.2.255 Mask:255.255.255.0


Postfix is listening on port 25:



user@lab1:~$ netstat -tulpn
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN -


On lab2



The content of /etc/hosts:



user@lab2:~$ cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 lab2
10.0.2.5 lab1
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters


Part of the content of /var/lib/exim4/config.autogenerated:



# the following macro definitions were created
# dynamically by /usr/sbin/update-exim4.conf
.ifndef MAIN_LOCAL_INTERFACES
MAIN_LOCAL_INTERFACES=<; 127.0.0.1; 10.0.2.6
.endif
.ifndef MAIN_PACKAGE_VERSION
MAIN_PACKAGE_VERSION=4.86.2-2ubuntu2.3
.endif
.ifndef MAIN_LOCAL_DOMAINS
MAIN_LOCAL_DOMAINS=@:localhost:lab2: localhost
.endif
.ifndef MAIN_RELAY_TO_DOMAINS
MAIN_RELAY_TO_DOMAINS=lab1
.endif
.ifndef ETC_MAILNAME
ETC_MAILNAME=lab2
.endif
.ifndef LOCAL_DELIVERY
LOCAL_DELIVERY=maildir_home
.endif
.ifndef MAIN_RELAY_NETS
MAIN_RELAY_NETS=10.0.2.0/8 : 127.0.0.1 : ::::1
.endif
.ifndef DCreadhost
DCreadhost=empty
.endif
.ifndef DCsmarthost
DCsmarthost=mail.lab2
.endif
.ifndef DC_eximconfig_configtype
DC_eximconfig_configtype=internet
.endif
.ifndef DCconfig_internet
DCconfig_internet=1
.endif


Sending the email from lab2 to user on lab1:



user@lab2:~$ echo "test" | mail -s test user@lab1



Output of /var/log/exim4/mainlog:



2019-01-26 01:31:24 1gnBsa-0000PD-2b <= user@lab2 U=user P=local S=310
2019-01-26 01:31:24 1gnBsa-0000PD-2b == user@lab1 R=dnslookup_relay_to_domains defer (-1): host lookup did not complete









share|improve this question



























    0















    I have two virtual machines and both running Ubuntu server. I should be able to send emails from lab2 to lab1 using mail. lab2 is running exim4and lab1 has postfix listening on port 25. I should configure exim on lab2, so that it delivers the emails that are for lab1 to lab1, and for lab2 to lab2. It works fine when I send emails with mail from lab2 to lab2, but I get an error when sending from lab2 to lab1. As I understand exim should work as a relay for lab1? The error I get is R=dnslookup_relay_to_domains defer (-1): host lookup did not complete, below more details.



    From lab2 I can ping and ssh to lab1. Can anybody help me understanding what I am doing wrong? I have tried changing the configuration of exim but I am sure there is something I am not understanding here...



    On lab1



    The ip address of lab1:



    user@lab1:~$ ifconfig
    enp0s3 Link encap:Ethernet HWaddr 08:00:27:d5:ec:9a
    inet addr:10.0.2.5 Bcast:10.0.2.255 Mask:255.255.255.0


    Postfix is listening on port 25:



    user@lab1:~$ netstat -tulpn
    (Not all processes could be identified, non-owned process info
    will not be shown, you would have to be root to see it all.)
    Active Internet connections (only servers)
    Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
    tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -
    tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN -


    On lab2



    The content of /etc/hosts:



    user@lab2:~$ cat /etc/hosts
    127.0.0.1 localhost
    127.0.1.1 lab2
    10.0.2.5 lab1
    # The following lines are desirable for IPv6 capable hosts
    ::1 localhost ip6-localhost ip6-loopback
    ff02::1 ip6-allnodes
    ff02::2 ip6-allrouters


    Part of the content of /var/lib/exim4/config.autogenerated:



    # the following macro definitions were created
    # dynamically by /usr/sbin/update-exim4.conf
    .ifndef MAIN_LOCAL_INTERFACES
    MAIN_LOCAL_INTERFACES=<; 127.0.0.1; 10.0.2.6
    .endif
    .ifndef MAIN_PACKAGE_VERSION
    MAIN_PACKAGE_VERSION=4.86.2-2ubuntu2.3
    .endif
    .ifndef MAIN_LOCAL_DOMAINS
    MAIN_LOCAL_DOMAINS=@:localhost:lab2: localhost
    .endif
    .ifndef MAIN_RELAY_TO_DOMAINS
    MAIN_RELAY_TO_DOMAINS=lab1
    .endif
    .ifndef ETC_MAILNAME
    ETC_MAILNAME=lab2
    .endif
    .ifndef LOCAL_DELIVERY
    LOCAL_DELIVERY=maildir_home
    .endif
    .ifndef MAIN_RELAY_NETS
    MAIN_RELAY_NETS=10.0.2.0/8 : 127.0.0.1 : ::::1
    .endif
    .ifndef DCreadhost
    DCreadhost=empty
    .endif
    .ifndef DCsmarthost
    DCsmarthost=mail.lab2
    .endif
    .ifndef DC_eximconfig_configtype
    DC_eximconfig_configtype=internet
    .endif
    .ifndef DCconfig_internet
    DCconfig_internet=1
    .endif


    Sending the email from lab2 to user on lab1:



    user@lab2:~$ echo "test" | mail -s test user@lab1



    Output of /var/log/exim4/mainlog:



    2019-01-26 01:31:24 1gnBsa-0000PD-2b <= user@lab2 U=user P=local S=310
    2019-01-26 01:31:24 1gnBsa-0000PD-2b == user@lab1 R=dnslookup_relay_to_domains defer (-1): host lookup did not complete









    share|improve this question

























      0












      0








      0








      I have two virtual machines and both running Ubuntu server. I should be able to send emails from lab2 to lab1 using mail. lab2 is running exim4and lab1 has postfix listening on port 25. I should configure exim on lab2, so that it delivers the emails that are for lab1 to lab1, and for lab2 to lab2. It works fine when I send emails with mail from lab2 to lab2, but I get an error when sending from lab2 to lab1. As I understand exim should work as a relay for lab1? The error I get is R=dnslookup_relay_to_domains defer (-1): host lookup did not complete, below more details.



      From lab2 I can ping and ssh to lab1. Can anybody help me understanding what I am doing wrong? I have tried changing the configuration of exim but I am sure there is something I am not understanding here...



      On lab1



      The ip address of lab1:



      user@lab1:~$ ifconfig
      enp0s3 Link encap:Ethernet HWaddr 08:00:27:d5:ec:9a
      inet addr:10.0.2.5 Bcast:10.0.2.255 Mask:255.255.255.0


      Postfix is listening on port 25:



      user@lab1:~$ netstat -tulpn
      (Not all processes could be identified, non-owned process info
      will not be shown, you would have to be root to see it all.)
      Active Internet connections (only servers)
      Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
      tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -
      tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN -


      On lab2



      The content of /etc/hosts:



      user@lab2:~$ cat /etc/hosts
      127.0.0.1 localhost
      127.0.1.1 lab2
      10.0.2.5 lab1
      # The following lines are desirable for IPv6 capable hosts
      ::1 localhost ip6-localhost ip6-loopback
      ff02::1 ip6-allnodes
      ff02::2 ip6-allrouters


      Part of the content of /var/lib/exim4/config.autogenerated:



      # the following macro definitions were created
      # dynamically by /usr/sbin/update-exim4.conf
      .ifndef MAIN_LOCAL_INTERFACES
      MAIN_LOCAL_INTERFACES=<; 127.0.0.1; 10.0.2.6
      .endif
      .ifndef MAIN_PACKAGE_VERSION
      MAIN_PACKAGE_VERSION=4.86.2-2ubuntu2.3
      .endif
      .ifndef MAIN_LOCAL_DOMAINS
      MAIN_LOCAL_DOMAINS=@:localhost:lab2: localhost
      .endif
      .ifndef MAIN_RELAY_TO_DOMAINS
      MAIN_RELAY_TO_DOMAINS=lab1
      .endif
      .ifndef ETC_MAILNAME
      ETC_MAILNAME=lab2
      .endif
      .ifndef LOCAL_DELIVERY
      LOCAL_DELIVERY=maildir_home
      .endif
      .ifndef MAIN_RELAY_NETS
      MAIN_RELAY_NETS=10.0.2.0/8 : 127.0.0.1 : ::::1
      .endif
      .ifndef DCreadhost
      DCreadhost=empty
      .endif
      .ifndef DCsmarthost
      DCsmarthost=mail.lab2
      .endif
      .ifndef DC_eximconfig_configtype
      DC_eximconfig_configtype=internet
      .endif
      .ifndef DCconfig_internet
      DCconfig_internet=1
      .endif


      Sending the email from lab2 to user on lab1:



      user@lab2:~$ echo "test" | mail -s test user@lab1



      Output of /var/log/exim4/mainlog:



      2019-01-26 01:31:24 1gnBsa-0000PD-2b <= user@lab2 U=user P=local S=310
      2019-01-26 01:31:24 1gnBsa-0000PD-2b == user@lab1 R=dnslookup_relay_to_domains defer (-1): host lookup did not complete









      share|improve this question














      I have two virtual machines and both running Ubuntu server. I should be able to send emails from lab2 to lab1 using mail. lab2 is running exim4and lab1 has postfix listening on port 25. I should configure exim on lab2, so that it delivers the emails that are for lab1 to lab1, and for lab2 to lab2. It works fine when I send emails with mail from lab2 to lab2, but I get an error when sending from lab2 to lab1. As I understand exim should work as a relay for lab1? The error I get is R=dnslookup_relay_to_domains defer (-1): host lookup did not complete, below more details.



      From lab2 I can ping and ssh to lab1. Can anybody help me understanding what I am doing wrong? I have tried changing the configuration of exim but I am sure there is something I am not understanding here...



      On lab1



      The ip address of lab1:



      user@lab1:~$ ifconfig
      enp0s3 Link encap:Ethernet HWaddr 08:00:27:d5:ec:9a
      inet addr:10.0.2.5 Bcast:10.0.2.255 Mask:255.255.255.0


      Postfix is listening on port 25:



      user@lab1:~$ netstat -tulpn
      (Not all processes could be identified, non-owned process info
      will not be shown, you would have to be root to see it all.)
      Active Internet connections (only servers)
      Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
      tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -
      tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN -


      On lab2



      The content of /etc/hosts:



      user@lab2:~$ cat /etc/hosts
      127.0.0.1 localhost
      127.0.1.1 lab2
      10.0.2.5 lab1
      # The following lines are desirable for IPv6 capable hosts
      ::1 localhost ip6-localhost ip6-loopback
      ff02::1 ip6-allnodes
      ff02::2 ip6-allrouters


      Part of the content of /var/lib/exim4/config.autogenerated:



      # the following macro definitions were created
      # dynamically by /usr/sbin/update-exim4.conf
      .ifndef MAIN_LOCAL_INTERFACES
      MAIN_LOCAL_INTERFACES=<; 127.0.0.1; 10.0.2.6
      .endif
      .ifndef MAIN_PACKAGE_VERSION
      MAIN_PACKAGE_VERSION=4.86.2-2ubuntu2.3
      .endif
      .ifndef MAIN_LOCAL_DOMAINS
      MAIN_LOCAL_DOMAINS=@:localhost:lab2: localhost
      .endif
      .ifndef MAIN_RELAY_TO_DOMAINS
      MAIN_RELAY_TO_DOMAINS=lab1
      .endif
      .ifndef ETC_MAILNAME
      ETC_MAILNAME=lab2
      .endif
      .ifndef LOCAL_DELIVERY
      LOCAL_DELIVERY=maildir_home
      .endif
      .ifndef MAIN_RELAY_NETS
      MAIN_RELAY_NETS=10.0.2.0/8 : 127.0.0.1 : ::::1
      .endif
      .ifndef DCreadhost
      DCreadhost=empty
      .endif
      .ifndef DCsmarthost
      DCsmarthost=mail.lab2
      .endif
      .ifndef DC_eximconfig_configtype
      DC_eximconfig_configtype=internet
      .endif
      .ifndef DCconfig_internet
      DCconfig_internet=1
      .endif


      Sending the email from lab2 to user on lab1:



      user@lab2:~$ echo "test" | mail -s test user@lab1



      Output of /var/log/exim4/mainlog:



      2019-01-26 01:31:24 1gnBsa-0000PD-2b <= user@lab2 U=user P=local S=310
      2019-01-26 01:31:24 1gnBsa-0000PD-2b == user@lab1 R=dnslookup_relay_to_domains defer (-1): host lookup did not complete






      linux networking email exim






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 26 at 0:53









      mangitsimangitsi

      15




      15






















          1 Answer
          1






          active

          oldest

          votes


















          0














          I had been trying many things and got a bit messed up with the configuration. Finally sorted it out and here is the correct configuration from /etc/exim4/update-exim4.conf.conf



          dc_eximconfig_configtype='smarthost'
          dc_other_hostnames='lab2; localhost'
          dc_local_interfaces='127.0.0.1'
          dc_readhost=''
          dc_relay_domains=''
          dc_minimaldns='false'
          dc_relay_nets=''
          dc_smarthost='lab1'
          CFILEMODE='644'
          dc_use_split_config='false'
          dc_hide_mailname='false'
          dc_mailname_in_oh='true'
          dc_localdelivery='maildir_home'


          Basically using sudo dpkg-reconfigure exim4-config I had to choose the mail sent by smarthost option and then set lab1 as smarthost.






          share|improve this answer

























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "3"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1398617%2fsending-an-email-to-from-vm-with-exim4-to-vm-with-posfix%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            I had been trying many things and got a bit messed up with the configuration. Finally sorted it out and here is the correct configuration from /etc/exim4/update-exim4.conf.conf



            dc_eximconfig_configtype='smarthost'
            dc_other_hostnames='lab2; localhost'
            dc_local_interfaces='127.0.0.1'
            dc_readhost=''
            dc_relay_domains=''
            dc_minimaldns='false'
            dc_relay_nets=''
            dc_smarthost='lab1'
            CFILEMODE='644'
            dc_use_split_config='false'
            dc_hide_mailname='false'
            dc_mailname_in_oh='true'
            dc_localdelivery='maildir_home'


            Basically using sudo dpkg-reconfigure exim4-config I had to choose the mail sent by smarthost option and then set lab1 as smarthost.






            share|improve this answer






























              0














              I had been trying many things and got a bit messed up with the configuration. Finally sorted it out and here is the correct configuration from /etc/exim4/update-exim4.conf.conf



              dc_eximconfig_configtype='smarthost'
              dc_other_hostnames='lab2; localhost'
              dc_local_interfaces='127.0.0.1'
              dc_readhost=''
              dc_relay_domains=''
              dc_minimaldns='false'
              dc_relay_nets=''
              dc_smarthost='lab1'
              CFILEMODE='644'
              dc_use_split_config='false'
              dc_hide_mailname='false'
              dc_mailname_in_oh='true'
              dc_localdelivery='maildir_home'


              Basically using sudo dpkg-reconfigure exim4-config I had to choose the mail sent by smarthost option and then set lab1 as smarthost.






              share|improve this answer




























                0












                0








                0







                I had been trying many things and got a bit messed up with the configuration. Finally sorted it out and here is the correct configuration from /etc/exim4/update-exim4.conf.conf



                dc_eximconfig_configtype='smarthost'
                dc_other_hostnames='lab2; localhost'
                dc_local_interfaces='127.0.0.1'
                dc_readhost=''
                dc_relay_domains=''
                dc_minimaldns='false'
                dc_relay_nets=''
                dc_smarthost='lab1'
                CFILEMODE='644'
                dc_use_split_config='false'
                dc_hide_mailname='false'
                dc_mailname_in_oh='true'
                dc_localdelivery='maildir_home'


                Basically using sudo dpkg-reconfigure exim4-config I had to choose the mail sent by smarthost option and then set lab1 as smarthost.






                share|improve this answer















                I had been trying many things and got a bit messed up with the configuration. Finally sorted it out and here is the correct configuration from /etc/exim4/update-exim4.conf.conf



                dc_eximconfig_configtype='smarthost'
                dc_other_hostnames='lab2; localhost'
                dc_local_interfaces='127.0.0.1'
                dc_readhost=''
                dc_relay_domains=''
                dc_minimaldns='false'
                dc_relay_nets=''
                dc_smarthost='lab1'
                CFILEMODE='644'
                dc_use_split_config='false'
                dc_hide_mailname='false'
                dc_mailname_in_oh='true'
                dc_localdelivery='maildir_home'


                Basically using sudo dpkg-reconfigure exim4-config I had to choose the mail sent by smarthost option and then set lab1 as smarthost.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Jan 26 at 18:21

























                answered Jan 26 at 17:59









                mangitsimangitsi

                15




                15






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Super User!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1398617%2fsending-an-email-to-from-vm-with-exim4-to-vm-with-posfix%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Plaza Victoria

                    Puebla de Zaragoza

                    Musa