当前位置:网站首页>iptables、firewalld的使用
iptables、firewalld的使用
2022-08-02 20:54:00 【m0_59138290】
iptables
- 搭建web服务,设置任何人能够通过80端口访问。
[[email protected] ~]# iptables -I INPUT -p tcp --dport 80 -j ACCEPT
[[email protected] ~]# iptables -L --line-numbers
[[email protected] ~]# iptables -D INPUT 1
- 禁止所有人ssh远程登录该服务器
[[email protected] ~]# iptables -I INPUT -p tcp --dport 22 -j REJECT
删除设置的拒绝ssh连接:
[[email protected] Desktop]# iptables -D INPUT 1
- 禁止某个主机地址ssh远程登录该服务器,允许该主机访问服务器的web服务。服务器地址为172.24.8.128
拒绝172.24.8.129通过ssh远程连接服务器:
[[email protected] ~]# iptables -I INPUT -p tcp -s 172.24.8.129 --dport 22 -j REJECT
允许172.24.8.129访问服务器的web服务:
[[email protected] ~]# iptables -I INPUT -p tcp -s 172.24.8.129 --dport 80 -j ACCEPT
firewalld
- 禁止某个ip地址进行ssh访问
[[email protected] ~]# firewall-cmd --permanent --add-service=ssh
[[email protected] ~]# firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="192.168.1.1" service name="http,https" reject"
[[email protected] ~]# firewall-cmd --reload
配置端口转发(在172.24.8.0网段的主机访问该服务器的5423端口将被转发到80端口)此规则将本机80端口转发到192.168.1.1的8080端口上
[[email protected]1 ~]# firewall-cmd --permanent --add-rich-rule=‘rule family=“ipv4” source address=“172.24.8.0/24” forward-port port=“5423” protocol=“tcp” to-port=“80”’
边栏推荐
猜你喜欢

php 单引号 双引号 -> => return echo

2018HBCPC个人题解

Swin Transformer 论文精读,并解析其模型结构

Flink Yarn Per Job - 创建启动Dispatcher RM JobManager

ECCV 2022 | ByteTrack: 简单高效的数据关联方法

.NET performance optimization - you should set initial size for collection types

Electrical diagram of power supply system

引用类型 ,值类型 ,小坑。

callback prototype __proto__

.NET性能优化-你应该为集合类型设置初始大小
随机推荐
用了TCP协议,就一定不会丢包吗?
VisualStudio 制作Dynamic Link Library动态链接库文件
C# Monitor class
一款免费的容器安全 SaaS 平台使用记录
y85.第四章 Prometheus大厂监控体系及实战 -- prometheus告警机制进阶、pushgateway和prometheus存储(十六)
SublimeText3 安装、配置项、包管理、常用必备插件、常用快捷键以及修改
56.【全局变量和局部变量专题】
博客主页rrs代码
Zabbix 5.0 监控教程(二)
Day35 LeetCode
【实战 已完结】WPF开发自动化生产管理平台
用户之声 | 大学生的“课外学堂”
golang刷leetcode:道路的最大总重要性
源码构建LAMP环境-3
用户之声 | 我与GBase的缘分
Informatics Olympiad All-in-One (1260: [Example 9.4] Intercepting Missiles (Noip1999))
开关、电机、断路器、电热偶、电表接线图大全
数字孪生助力智慧城市可视化建设
【3D视觉】深度摄像头与3D重建
X 2 Earn必须依靠旁氏启动?GameFi的出路在哪?(下)