sendmail bind to ip address

Red hat Rhel/platform services
March 12, 2011 at 09:03:12
Specs: Linux
I saw a comment on http://www.computing.net/answers/li... To bind sendmail to a specific ip address you need to edit the /etc/mail/sendmail.mc file. (editing sendmail.cf file is bad, unless you really know what you are doing).

In the sendmail.mc file, you are looking for the line containing:
DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')
Just change "127.0.0.1" to the IP Address you are looking to bind the sendmail daemon to. If you want to bind to all IP Addresses on the local system, change it to "0.0.0.0" as such:
DAEMON_OPTIONS(`Port=smtp,Addr=0.0.0.0, Name=MTA')

To test to see if it is binding properly, check out 'netstat' and the tcp ports. We are looking for port 25 (smtp).

netstat -ntlp

This will bring up all open listening(-l) tcp(-t) ports, and PID (-p) (process id) along with the name of the process. You should see a line as such:

tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 5239/sendmail: acce


This shows that we are listening on all IP (v4) addresses, on port 25 (column 3), and will accept connections from all (column 4). The last column is the PID, and the program the PID is associated with. (PID and program will only show if you are running command netstat as root/sudo).

Hope this helps all.

-Captain Mikey


See More: sendmail bind to ip address

Report •

#1
March 12, 2011 at 09:07:33
One last thing. After you edit the sendmail.mc file, you need to run:
m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
This will update the sendmail.cf file. You should always backup your sendmail.mc and sendmail.cf before editing them. (Always CYA).
Once the sendmail.cf file is updated, restart sendmail to pick up the changes
/etc/init.d/sendmail restart
or if you are running Redhat or something derived from it, use:
service sendmail restart

-Captain Mikey


Report •
Related Solutions


Ask Question