Postfix local network lan configuration help

Discussion in 'Server Operation' started by cpage13, Oct 6, 2010.

  1. cpage13

    cpage13 New Member

    Hi

    I have been working for what seems like forever trying to setup postfix on my home wireless network. It seems like some of the tutorials are either to simplistic or to overkill for what I am trying to accomplish. What I am currently trying to accomplish is setup a postfix server at home and have different machines on my local wireless have the ability so send emails back and forth. No blocking or authentication for now, just trying to keep it simple. I would like to create a tutorial once I have successfully accomplished this (If I ever do)

    However when trying to send mail in either of my two configurations (one using dnsmasq, the other a transport file, I always get error from server relaying not allowed)
    I will post the exact results later

    Currently I have two ubuntu machines running postfix on local network 10.0.1.0

    machine A the main server, username = cmd, local ip is 10.0.1.13
    important main.cf as follows

    myhostname = mail.me.com
    mydomainname = me.com
    alias_maps = hash:/etc/aliases
    alias_database = hash:/etc/aliases
    myorigin = $mydomain
    # /etc/mailname
    mydestination = $myhostname $mydomain localhost.$myhostname localhost.localdomain localhost
    relayhost =
    mynetworks = 10.0.1.0/24 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
    mailbox_size_limit = 0
    recipient_delimiter = +
    inet_interfaces = all
    #disable_dns_lookups = yes # this is commented when I run dnsmasq
    #transport_maps = hash:/etc/postfix/transport #this is commented when I run dns masq

    /etc/hosts file consists of
    127.0.0.1 localhost
    127.0.1.1 cmd-mac
    10.0.1.13 mail.me.com
    10.0.1.13 smtp.me.com
    10.0.1.22 work.me.com

    /etc/resolve.conf contains
    nameserver 10.0.1.13

    /etc/postfix/transport.db consists of (when NOT using dnsmasq)
    me.com smtp:[10.0.1.13]
    .me.com smtp:[10.0.1.13]
    smtp.me.com local:[10.0.1.13]
    localhost.me.com local:[127.0.0.1]


    machine B is a client. username = cmd-compac, local ip = 10.0.1.22, note it relays mail when not local
    to machine A

    main.cf consits of

    myhostname = work.me.com
    mydomainname = me.com
    alias_maps = hash:/etc/aliases
    alias_database = hash:/etc/aliases
    myorigin = $mydomain
    mydestination = $myhostname $mydomain localhost.$myhostname localhost.localdomain localhost
    relayhost = smtp.me.com
    mynetworks = 10.0.1.0/24 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
    mailbox_size_limit = 0
    recipient_delimiter = +
    inet_interfaces = all

    when I am not running the dnsmasq i put in the /etc/hosts file
    10.0.1.13 smtp.me.com

    dig mail.me.com results from either machine A or B when using dnsmasq

    mail.me.com. 3590 IN A 17.148.16.42
    mail.me.com. 3590 IN A 17.148.16.43
    mail.me.com. 3590 IN A 17.148.16.44
    mail.me.com. 3590 IN A 17.148.16.45
    mail.me.com. 3590 IN A 17.148.16.46
    mail.me.com. 3590 IN A 17.148.17.81
    mail.me.com. 3590 IN A 17.148.17.82
    mail.me.com. 3590 IN A 17.148.17.83
    mail.me.com. 3590 IN A 17.148.17.84
    mail.me.com. 3590 IN A 17.148.17.85


    ok so here where everything goes wrong in either case when using the transport map or dnsmasq

    from machine B i enter
    echo "this is a message" | mail -s 'hope this works' [email protected]

    The result of tail /var/log/mail.log will be posted shortly (currently do not have other computer)

    ISP bouncing email with 530 5.7.1 Relaying not allowed message

    I would just like to be able to cat /var/mail/cmd and see the message from machine A.
    or type mail and see it there (somehow i have broken that in the sense that i can see mail sent to myself (locally from the same machine) typing cat /var/mail/cmd however not typing mail, will save that issue for another time)
    Please note there is no blocking (completely local) I have matching domain names on either machine. Any errors you can find in my configurations will be greatly appreciated. As mentioned once I get this working I would like to create a nice little tutorial for people to setup in their own homes so any additional information would be great.



    here is exact output of sending a mail via command above from mail.log

    Oct 6 21:34:19 cmd-compaclaptop postfix/smtp[1633]: 09D8A3A0742: to=<[email protected]>, relay=smtp.me.com[17.148.16.31]:25, delay=1.2, delays=0.3/0.06/0.34/0.51, dsn=5.7.1, status=bounced (host smtp.me.com[17.148.16.31] said: 530 5.7.1 Relaying not allowed: [email protected] (in reply to RCPT TO command))
    Oct 6 21:34:19 cmd-compaclaptop postfix/cleanup[1631]: 44E5A3A0743: message-id=<[email protected]>
    Oct 6 21:34:19 cmd-compaclaptop postfix/qmgr[1542]: 44E5A3A0743: from=<>, size=2159, nrcpt=1 (queue active)
    Oct 6 21:34:19 cmd-compaclaptop postfix/bounce[1634]: 09D8A3A0742: sender non-delivery notification: 44E5A3A0743
    Oct 6 21:34:19 cmd-compaclaptop postfix/qmgr[1542]: 09D8A3A0742: removed
    Oct 6 21:34:19 cmd-compaclaptop postfix/smtp[1633]: 44E5A3A0743: to=<[email protected]>, relay=smtp.me.com[17.148.16.31]:25, delay=0.57, delays=0.08/0/0.3/0.19, dsn=5.1.1, status=bounced (host smtp.me.com[17.148.16.31] said: 550 5.1.1 unknown or illegal alias: [email protected] (in reply to RCPT TO command))
     
    Last edited: Oct 7, 2010
  2. falko

    falko Super Moderator Howtoforge Staff

    These are public IP addresses, so somehow your machines try to send to the outside world instead of inside your LAN.
     
  3. cpage13

    cpage13 New Member

    Thanks falko,

    I was curious why the addresses didn't seem to match what I had specified. I thought it may have been normal, but clearly not.

    even after specifying the addresses in the /etc/hosts files and using dnsmasq I am surprised that the machines are finding the addresses elsewhere. I will recheck my dnsmasq configuration aswell as my ubuntu configuration.

    If anybody has an idea to ensure my machines use my specified addresses please let me know. I will post the results if i figure it out.
     
  4. falko

    falko Super Moderator Howtoforge Staff

  5. cpage13

    cpage13 New Member

    thanks again falko

    will give it a try today and post the results. :)

    _____________________________________________________________

    As Falko said adding the smdtp_host_lookup = native worked like a charm. I had forgot to also add virtual user maps. I will post my complete configuration
    once i get the emails working and tested from server to client.
     
    Last edited: Oct 9, 2010

Share This Page