Set Linux VPS to disable SMTP 25 port to prevent spam

Source: Internet
Author: User
Tags vps iptables

The old left received an email from a previous VPS merchant today and mentioned that the SPAM message sent by VPS was suspended. This small VPS was also activated during the test. I forgot to use it later. It is estimated that the password was too simple or other factors were used to send emails. Many people may have encountered this problem.
First of all, if you encounter such a problem, reinstall the system, set a complicated password, modify the port, set the key to log on, and so on. Then, check the relevant information to shield the SMTP mail port 25, therefore, in this article, the old Left will simply organize how to disable port 25 to prevent spam.
1. Common settings
1. Shield all port 25 connections
Iptables-I FORWARD-p tcp -- dport 25-j DROP
2. Allow specific IP addresses to connect to port 25.
Iptables-I FORWARD-s xx. xx-p tcp -- dport 25-j ACCEPT
3. Disable specific IP addresses from connecting to port 25.
Iptables-I FORWARD-s xx. xx-p tcp -- dport 25-j DROP
2. Save and take effect
/Etc/rc. d/init. d/iptables save
/Etc/init. d/iptables restart
After setting iptables rules, you must save the rules and restart iptables to make the rules take effect. Otherwise, the system becomes invalid after the server is restarted.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.