我有两个 Centos 虚拟机。VM_1 上的 IP 地址是10.99.0.10,而 VM_2 是10.99.0.12。Apache 和 PHP 在 VM_1 中,而 MySQL 在 VM_2 中。两者都有 IPTables 规则。VM_2 可以正常使用规则。现在我正在从 VM_1 进行测试。
首先,我禁用了 VM_1 IPTables 并连接到 VM_2 MySQL(连接成功)。
[root@foster ~]# service IPTables stop
IPTables : Applying firewall rules: [ OK ]
[root@foster ~]# mysql -h 10.99.0.12 -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 16
Server version: 5.6.21 MySQL Community Server (GPL)
接下来,我启用了 VM_1 IPTables 并连接到 VM_2 MySQL(它也不会在几个小时内响应)。
[root@foster ~]# service IPTables start
IPTables : Applying firewall rules: [ OK ]
[root@foster ~]# mysql -h 10.99.0.12 -u root -p
Enter password:
我的 IPTables 规则有什么问题?我的规则在Pastebin中。