当前位置:网站首页>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”’
边栏推荐
- 汉源高科千兆4光4电工业级网管型智能环网冗余以太网交换机防浪涌防雷导轨式安装
- Li Mu hands-on deep learning V2-BERT pre-training and code implementation
- 《分布式微服务电商》专题(一)-项目简介
- 如何理解 swing 是非线程安全 (原创)
- MSTP与STP
- Use the TCP protocol, we won't lost package?
- How to use windbg check c # a thread stack size?
- 总结嵌入式C语言难点(2部分)
- golang 刷leetcode:Morris 遍历
- Informatics Olympiad All-in-One (1257: Knight Moves)
猜你喜欢
随机推荐
Li Mu hands-on deep learning V2-BERT pre-training and code implementation
框架设计:PC 端单页多页框架如何设计与落地
Swin Transformer 论文精读,并解析其模型结构
性能测试 - 理论
js: 实现一个cached缓存函数计算结果
Nervegrowold hands-on learning deep learning V2 - Bert pre training data set and code implementation
JMeter的基本使用
golang 刷leetcode:统计打字方案数
SSM整合步骤(重点)
回文自动机+CodeTON Round 2 C,D
[C题目]力扣141. 环形链表
golang刷leetcode: 卖木头块
js如何获取浏览器缩放比例
apache calcite中关于model文件配置
【3D视觉】深度摄像头与3D重建
callback prototype __proto__
14、学习MySQL 连接的使用
golang 刷leetcode:从栈中取出 K 个硬币的最大面值和
Day35 LeetCode
go——内存分配机制