当前位置:网站首页>阿里云防火墙配置,多种设置方式(iptables和fireward)
阿里云防火墙配置,多种设置方式(iptables和fireward)
2022-06-29 09:14:00 【清风~】
阿里云centos7.6自带防火墙就是fireward,我自己又配置了iptables,我刚开始没有弄懂,以为两个是不一样的,导致总是两个都打不开,要是单纯的开fireward也是可以的,但是我更喜欢iptables配置文件来查看相关配置
ftp服务器网页打不开的问题探究,通过反复运行,找到自己问题所在
vim /etc/sysconfig/iptables
都要开
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
#ssh port
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
#vsftpd
-A INPUT -p TCP --dport 61001:62000 -j ACCEPT
-A OUTPUT -p TCP --sport 61001:62000 -j ACCEPT
-A INPUT -p TCP --dport 20 -j ACCEPT
-A OUTPUT -p TCP --sport 20 -j ACCEPT
-A INPUT -p TCP --dport 21 -j ACCEPT
-A OUTPUT -p TCP --sport 21 -j ACCEPT
#mysql port
-A INPUT -p tcp -m tcp --dport 3306 -j ACCEPT
#tomcat remote debug port
-A INPUT -p tcp -m tcp --dport 5005 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 8080 -j ACCEPT
#nginx
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT

systemctl restart iptables.service
systemctl enable iptables.service
注意下面为错误示范,当时没有理解!
防火墙设置
这里iptables设置就是防火墙参数,没有必要再添加firewall参数了,反而打不开
同时我也添加一些参数,确实打不开,终于搞清不能两个同时配置
下面参数不用加
systemctl restart firewalld.service
firewall-cmd --permanent --list-port
firewall-cmd --zone=public --add-port=22/tcp--permanent
firewall-cmd --zone=public--add-port=21/tcp --permanent
systemctl restart firewalld
firewall-cmd --permanent --list-port
下面是以前打开的端口,我测试了下,果然不能同时测试,打不开的网页就不发了
那么下面就直接运行已有的iptables配置就行
简称,鱼和熊掌不可兼得
systemctl restart iptables.service
systemctl enable iptables.service
systemctl restart vsftpd.service
打开网页输入你账户,密码登录即可

边栏推荐
- 滑块验证代码
- zabbix4.4配置监控服务器指标,以及图形页乱码解决
- UE4 compile a single file (VS and editor start respectively)
- es报错NoNodeAvailableException[None of the configured nodes are available:[.127.0.0.1}{127.0.0.1:9300]
- 2020-09-18 referer认证 url转义
- Automatic Multi-Organ SegmVentation on Abdominal CT With Dense V-Networks
- 2020-09-21 Visual Studio头文件和库目录配置
- 力扣85题最大矩形
- leetcode MYSQL数据库题目181
- The 23 most useful elasticsearch search techniques you must know
猜你喜欢

Visual assist plug-in settings for UE4 vs

力扣85题最大矩形

Student增删gaih

Automatic 3D Detection and Segmentation of Head and Neck Cancer from MRI Data.

IPC(进程间通信)之管道详解

Introduction to Chang'an chain data storage and construction of MySQL storage environment

CROSSFORMER: A VERSATILE VISION TRANSFORMER BASED ON CROSS-SCALE ATTENTION

阿里云服务器安装配置redis,无法远程访问

Five heart charity matchmaker team

Do you know what BFD is? This article explains the principle and usage scenarios of BFD protocol in detail
随机推荐
Data warehouse: layered architecture of Finance / banking
Cisco ASA、FTD和HyperFlex HX的漏洞分析复现
Making of simple addition calculator based on pyqt5 and QT Designer
2020-09-21 Visual Studio头文件和库目录配置
User level threads and kernel level threads
装饰器模式的应用,包装ServletRequest,增加addParameter方法
Five heart charity matchmaker team
1424. diagonal traversal II
2020-09-21 referer字符串切分 boost gateway代码组织层次
UE4 material UV texture does not stretch with model scale
CROSSFORMER: A VERSATILE VISION TRANSFORMER BASED ON CROSS-SCALE ATTENTION
General part: cognition, design and best practice of prototype design
LeetCode刷题——泰波那契数列
容器
力扣85题最大矩形
Application of decorator mode, packaging ServletRequest and adding addparameter method
【华为认证】HCIA-DATACOM史上最全精选题库(附答案解析)
数据治理:数据标准管理(第三篇)
Could not open JDBC connection for transaction
Slider validation code