• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
The Electric Toolbox Blog

The Electric Toolbox Blog

Linux, Apache, Nginx, MySQL, Javascript and PHP articles

  • Applications
  • FCKEditor
  • Apache
  • Windows
  • Contact Us
Home / Opening port 25 for mail servers with iptables

Opening port 25 for mail servers with iptables

If you are having problems connecting to sendmail, postfix or other mail servers remotely it may either be a sendmail configuration issue or a firewall issue. The Linux 2.4 and greater kernel comes with iptables as a build in firewall solution.

When installing Linux the installer may prompt you for which ports you want to have open for remote connections. If you are wanting to set your machine up as a mail server then you would normally select the SMTP option, or enter port 25 to allow incoming connections to sendmail. If your installer did not give you the option to do this, you forgot to or you change the purpose of the machine at a later date, the firewell will not allow incoming connections on port 25, so external mail agents will not be able to connect to sendmail on your machine.

Fixing this in the firewall is a simple job. Edit the /etc/sysconfig/iptables text file (this is the RedHat distribution file location; it may differ for other distributions) and add a line like the following one:

-A RH-Lokkit-0-50-INPUT -p tcp -m tcp --dport 25 --syn -j ACCEPT

The easiest way to ensure the correct syntax is to copy the line for another port which allows access and change the "–dport" part to port 25.

Once you are done, save the file and restart the iptables service – "service iptables restart" on RedHat ("/etc/rc.d/init.d/iptables restart" will also work).

Check Out These Related posts:

  1. Sendmail remote connection refused
  2. Changing exim4 settings with Debian 5 Lenny
  3. Directory listings slow with ftp server and CentOS
  4. Starting and Stopping Sendmail with FreeBSD

Filed Under: Email Servers

Primary Sidebar

Categories

  • Apache
  • Applications
  • Article
  • Case Studies
  • Email Servers
  • FCKEditor
  • HTML And CSS
  • Javascript
  • Linux/Unix/BSD
  • Microsoft SQL Server
  • Miscellaneous Postings
  • MySql
  • Networking
  • Nginx Web Server
  • Offsite Articles
  • OSX
  • PHP
  • Quick Tips
  • RFC – Request for Comments
  • SilverStripe
  • VMWare
  • VPN
  • Windows
  • WordPress

Recent Posts

  • Vim Show Line Numbers
  • Add User To Group Linux
  • Chmod 777 Tutorial
  • How to Copy Directory Linux
  • Linux create user

Copyright © 2021. ElectricToolBox. All Rights Reserved.

  • Contact Us
  • Copyright Info
  • Privacy Policy
  • Sitemap