firewall&iptables

一、firewall
查看firewall状态
firewall-cmd --state
如果firewall为关闭状态,先启动firewall
systemctl start firewalld
添加firewall指令
firewall-cmd --permanent --add-rich-rule='rule family=ipv4 forward-port port=162 protocol=udp to-port=20162'
firewall-cmd --permanent --add-rich-rule='rule family=ipv4 forward-port port=161 protocol=udp to-port=20161'
firewall-cmd --permanent --add-rich-rule='rule family=ipv4 forward-port port=514 protocol=udp to-port=20514'
firewall-cmd --permanent --zone=public --add-port=8885/tcp
firewall-cmd --permanent --zone=public --add-port=9092/tcp
firewall-cmd --permanent --zone=public --add-port=161/tcp
firewall-cmd --permanent --zone=public --add-port=162/tcp
firewall-cmd --permanent --zone=public --add-port=514/udp
firewall-cmd --permanent --zone=public --add-port=20161/tcp
firewall-cmd --permanent --zone=public --add-port=20162/tcp
firewall-cmd --permanent --zone=public --add-port=20514/udp
firewall-cmd --permanent --zone=public --add-port=9996/udp
firewall-cmd --permanent --zone=public --add-port=8082/tcp删除指令
firewall-cmd --permanent --remove-rich-rule 'rule family="ipv4" forward-port="514" protocol="udp" tp-port="20514" '
重新加载firewall策略
firewall-cmd --reload
查看新策略是否生效
firewall-cmd --list-all
二、Iptables
- 安装iptables
yum install iptables-services - 启动iptables
service iptables restart - 查看iptables状态
systemctl status firewalld.service - 添加iptables端口转发策略
iptables -t nat -A PREROUTING -p udp -m udp --dport 162 -j REDIRECT --to-ports 20162
iptables -t nat -A PREROUTING -p udp -m udp --dport 161 -j REDIRECT --to-ports 20161
iptables -t nat -A PREROUTING -p udp -m udp --dport 514 -j REDIRECT --to-ports 20514
- 查看新策略是否生效
iptables -t nat -L -n --line-numbers
- 删除规则
iptables -L -n --line-numbers

firewall&iptables的更多相关文章
- firewall&iptables小记
一.firewall 查看firewall状态 firewall-cmd --state 防火墙开启: 防火墙关闭: 如果firewall为关闭状态,先启动firewall systemctl sta ...
- 防火墙 firewall iptables
firewalld FirewallD 使用服务service 和区域zone来代替 iptables 的规则rule和链chain,默认情况下,有以下的区域zone可用: drop – 丢弃所有传入 ...
- [Firewall] iptables Configuration
iptables usage: Add Rules: iptables -I INPUT -p tcp --dport -j ACCEPT iptables -I INPUT -p tcp --dpo ...
- Neutron 理解 (9): OpenStack 是如何实现 Neutron 网络 和 Nova虚机 防火墙的 [How Nova Implements Security Group and How Neutron Implements Virtual Firewall]
学习 Neutron 系列文章: (1)Neutron 所实现的虚拟化网络 (2)Neutron OpenvSwitch + VLAN 虚拟网络 (3)Neutron OpenvSwitch + GR ...
- iptables rule
和H3C中的acl很像,或者就是一会事,这就是不知道底层的缺陷,形式一变,所有的积累都浮云了 参考准确的说copy from http://www.ibm.com/developerworks/cn/ ...
- Linux: 20 Iptables Examples For New SysAdmins
Linux comes with a host based firewall called Netfilter. According to the official project site: net ...
- [转] XEN, KVM, Libvirt and IPTables
http://cooker.techsnail.com/index.php/XEN,_KVM,_Libvirt_and_IPTables XEN, KVM, Libvirt and IPTables ...
- Iptables 指南 1.1.19
Iptables 指南 1.1.19 Oskar Andreasson oan@frozentux.net Copyright © 2001-2003 by Oskar Andreasson 本文在符 ...
- ubuntu 中 iptables 和 ufw 的关系
我突然发现,自己平常使用的 iptables 和 ufw 到底是啥关系?平常其实iptables和ufw在配置防火墙,开启端口是,还是偶尔会使用到的. 没去思考过这两者是啥关系,哎...,这就不够好了 ...
随机推荐
- php str_replace与substr_replace的区别
函数定义: str_replace() :函数替换字符串中的一些字符(区分大小写). substr_replace() :函数把字符串的一部分替换为另一个字符串. 区别: str_replace()和 ...
- LLDB动态调试
- day10—jQuery初步实践,关于菜单
转行学开发,代码100天——2018-03-26 今天是本人写开发记录方面博客的第10天了,不知不觉已经涉及到jQuery框架的学习了. 第一次熬夜写前端代码还是两年前,不过中途放弃了,学的东西也日渐 ...
- Vagrant 入门 - 清理(teardown)
原文地址 我们现在有一个功能齐全的虚拟机,可以用于基本 Web 开发.但如果现在需要更换设备,或者在另一个项目上工作,如何清理我们的开发环境? 借助 Vagrant,可以暂停(suspend),停止( ...
- 【FICO系列】SAP FICO模块-固定资产月结的注意点
公众号:SAP Technical 本文作者:matinal 原文出处:http://www.cnblogs.com/SAPmatinal/ 原文链接:[FICO系列]SAP FICO模块-固定资产月 ...
- (转载)如何在 Github 上发现优秀的开源项目?
转载自:传送门 之前发过一系列有关 GitHub 的文章,有同学问了,GitHub 我大概了解了,Git 也差不多会使用了,但是还是搞不清 GitHub 如何帮助我的工作,怎么提升我的工作效率? 问到 ...
- python 实现加法
https://ac.nowcoder.com/acm/contest/338/G 链接:https://ac.nowcoder.com/acm/contest/338/G来源:牛客网 题目描述 Th ...
- bzoj2176 Strange string(字符串最小表示法)
Time Limit: 10 Sec Memory Limit: 259 MB 给定一个字符串S = {S1, S2, S3 … Sn}, 如果在串SS中, 子串T(|T| = n)为所有长度为n的 ...
- spring中bean的构造函数,Autowired(Value)注入与@PostConstruct调用顺序
版权声明:本文为博主原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明. 本文链接:https://blog.csdn.net/yyysylvia/article/deta ...
- php开启xdebug扩展及xdebug通信原理
xdebug调试原理 IDE(如PHPStorm)已经集成了一个遵循BGDP的XDebug插件,当开启它的时候, 会在本地开一个XDebug调试服务,监听在调试器中所设置的端口上,默认是9000,这个 ...