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在配置防火墙,开启端口是,还是偶尔会使用到的. 没去思考过这两者是啥关系,哎...,这就不够好了 ...
随机推荐
- spring boot中注册拦截器
拦截器是动态拦截Action调用的对象.它提供了一种机制可以使开发者可以定义在一个action执行的前后执行的代码,也可以在一个action执行前阻止其执行,同时也提供了一种可以提取action中可重 ...
- 『转』一千行MySQL学习笔记
/* 启动MySQL */ net start mysql /* 连接与断开服务器 */ mysql -h 地址 -P 端口 -u 用户名 -p 密码 /* 跳过权限验证登录MySQL */ mysq ...
- 定义一个JobService,开启本地服务和远程服务
@SuppressWarnings(value = ["unchecked", "deprecation"])@RequiresApi(Build.VERSIO ...
- scrapy之Request对象
我们在使用scrapy框架的时候,会经常疑惑,数据流是怎么样在各个组件中间传递的.最近经常用scrapy+selenium爬取淘宝,又因为今天周五心情好,本宝宝决定梳理一下这方面知识. scrapy中 ...
- 北风设计模式课程---状态模式State(对象行为型)
北风设计模式课程---状态模式State(对象行为型) 一.总结 一句话总结: 状态模式 具体状态的行为在具体的状态类中就解决,不用交给外部做判断.实质是将多条件判断弄成了多个类,在不同的类中做判断 ...
- p5339 [TJOI2019]唱、跳、rap和篮球
分析 代码 #include<bits/stdc++.h> using namespace std; #define int long long ; ; ],inv[],G,cc[][] ...
- HTML 浅层漫谈
讲到HTML最主要的就是如何给这个网页搭架子给他大致的把这个人物样子先慢慢画出来,然后我们后面去学习这个CSS还有JS的时候给这个雏形慢慢的去加一些东西,让你的网页变得越来越好看 1.标签的使用 a: ...
- spring4.1.8扩展实战之四:感知spring容器变化(SmartLifecycle接口)
本章是<spring4.1.8扩展实战>的第四篇,如果业务上需要在spring容器启动和关闭的时候做一些操作,可以自定义SmartLifecycle接口的实现类来扩展,本章我们通过先分析再 ...
- 编程语言-Python-GUI
PyQt5 import sys from PyQt5 import QtWidgets,QtCore app = QtWidgets.QApplication(sys.argv) widget = ...
- spring事务——try{...}catch{...}中事务不回滚的几种处理方式(转载)
转载自 spring事务——try{...}catch{...}中事务不回滚的几种处理方式 当希望在某个方法中添加事务时,我们常常在方法头上添加@Transactional注解 @Respon ...