?
Solved

How to block port 25 for all machine except the mailserver

Posted on 2009-03-31
2
Medium Priority
?
876 Views
Last Modified: 2013-12-06
I like to block the port 25 on our firewall so no other than the real email server can send emails

Considering that the mail server address is 10.0.0.1, the gateway is 10.0.0.254 and the gateway that connects to the internet through the router has the IP of 192.168.0.100
So the machine that is running IPTables is on 10.0.0.254 and the external nic is 192.168.0.100
What should my rule look like?

TIA,

Tom
0
Comment
Question by:tom_szabo
1 Comment
 
LVL 16

Accepted Solution

by:
Blaz earned 2000 total points
ID: 24036457
iptables -I FORWARD -p tcp --dport 25 -j DROP
iptables -I FORWARD -s 10.0.0.1 -p tcp --dport 25 -j ACCEPT

This rules will drop every connection to port 25 if not comming from your email server. Note that I wrote "-I" which means insert at the beginning - the rules will be reversed in the FORWARD chain.
0

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to show how we can create Linux Mint virtual machine using Oracle Virtual Box. To install Linux Mint we have to download the ISO file from its website i.e. http://www.linuxmint.com. Once you open the link you will see …
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question