Restricting MySQL 3306 port with IPTABLES(使用 IPTABLES 限制 MySQL 3306 端口)
问题描述
如何阻止每个人的 mysql 端口 3306,但允许它用于特定 IP?这是我目前所做的:
How to block mysql port 3306 for everybody, but allow it for a specific IP? This is what I currently do:
iptables -I INPUT 1 -p tcp --dport 3306 -j ACCEPT
推荐答案
你需要多个规则来做到这一点.在大多数情况下,连接会发生什么取决于它匹配的第一条规则.所以,首先我们接受我们的朋友连接,其次,我们放弃任何其他人.瞧!
You need multiple rules to do that. In most cases, what will happen with a connection depends on the first rule, which it matches. So, first we accept our friends connection, second, we drop anybody other. Voila!
iptables -I INPUT 1 -p tcp -s 1.2.3.4 --dport 3306 -j ACCEPT
iptables -I INPUT 2 -p tcp --dport 3306 -j DROP
这篇关于使用 IPTABLES 限制 MySQL 3306 端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:使用 IPTABLES 限制 MySQL 3306 端口


基础教程推荐
- 如何在 SQL Server 的嵌套过程中处理事务? 2021-01-01
- Sql Server 字符串到日期的转换 2021-01-01
- 将数据从 MS SQL 迁移到 PostgreSQL? 2022-01-01
- SQL Server 中单行 MERGE/upsert 的语法 2021-01-01
- SQL Server 2016更改对象所有者 2022-01-01
- ERROR 2006 (HY000): MySQL 服务器已经消失 2021-01-01
- 无法在 ubuntu 中启动 mysql 服务器 2021-01-01
- SQL Server:只有 GROUP BY 中的最后一个条目 2021-01-01
- 在 VB.NET 中更新 SQL Server DateTime 列 2021-01-01
- 使用pyodbc“不安全"的Python多处理和数据库访问? 2022-01-01