一、firewall

  1. 查看firewall状态

    firewall-cmd --state

  2. 如果firewall为关闭状态,先启动firewall

    systemctl start firewalld

  3. 添加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

  4. 删除指令

    firewall-cmd --permanent --remove-rich-rule 'rule family="ipv4" forward-port="514" protocol="udp" tp-port="20514" '

  1. 重新加载firewall策略

    firewall-cmd --reload

  2. 查看新策略是否生效

    firewall-cmd --list-all

二、Iptables

  1. 安装iptables
    yum install iptables-services
  2. 启动iptables
    service iptables restart
  3. 查看iptables状态
    systemctl status firewalld.service
  4. 添加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

  5. 查看新策略是否生效
    iptables -t nat -L -n --line-numbers

  6. 删除规则
    iptables -L -n --line-numbers

firewall&iptables的更多相关文章

  1. firewall&iptables小记

    一.firewall 查看firewall状态 firewall-cmd --state 防火墙开启: 防火墙关闭: 如果firewall为关闭状态,先启动firewall systemctl sta ...

  2. 防火墙 firewall iptables

    firewalld FirewallD 使用服务service 和区域zone来代替 iptables 的规则rule和链chain,默认情况下,有以下的区域zone可用: drop – 丢弃所有传入 ...

  3. [Firewall] iptables Configuration

    iptables usage: Add Rules: iptables -I INPUT -p tcp --dport -j ACCEPT iptables -I INPUT -p tcp --dpo ...

  4. 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 ...

  5. iptables rule

    和H3C中的acl很像,或者就是一会事,这就是不知道底层的缺陷,形式一变,所有的积累都浮云了 参考准确的说copy from http://www.ibm.com/developerworks/cn/ ...

  6. Linux: 20 Iptables Examples For New SysAdmins

    Linux comes with a host based firewall called Netfilter. According to the official project site: net ...

  7. [转] XEN, KVM, Libvirt and IPTables

    http://cooker.techsnail.com/index.php/XEN,_KVM,_Libvirt_and_IPTables XEN, KVM, Libvirt and IPTables ...

  8. Iptables 指南 1.1.19

    Iptables 指南 1.1.19 Oskar Andreasson oan@frozentux.net Copyright © 2001-2003 by Oskar Andreasson 本文在符 ...

  9. ubuntu 中 iptables 和 ufw 的关系

    我突然发现,自己平常使用的 iptables 和 ufw 到底是啥关系?平常其实iptables和ufw在配置防火墙,开启端口是,还是偶尔会使用到的. 没去思考过这两者是啥关系,哎...,这就不够好了 ...

随机推荐

  1. linux用setup命令来更改ip配置

    在有安装系统桌面情况下,可以使用图形化形式来配置ip地址, 在命令行下,输入“setup”调出网卡.防火墙等配置界面: 2 选择“network configuration“,回车: 选择“devic ...

  2. web服务器、WSGI跟Flask(等框架)之间的关系

    之前对 Nginx,WSGI(或者 uWSGI,uwsgi),Flask(或者 Django),这几者的关系一存存在疑惑.通过查阅了些资料,总算把它们的关系理清了. 总括来说,客户端从发送一个 HTT ...

  3. Linux shell - scp命令用法

    例子: 远程复制一个文件从服务器A (172.0.0.0) /home/test/file1.txt 到 服务器B (172.0.0.1) /home/test 服务器A和服务器B的用户是 test ...

  4. POI 单元格类型CellType

    1.单元格类型 单元格的内容决定了单元格的类型,POI中定义的7种单元格类型: 2.示例 cell_0.setCellType(CellType.STRING);//字符串 日期数据对应的单元格类型是 ...

  5. ORA-01578: ORACLE 数据块损坏 (文件号 10, 块号 57896)ORA-01110: 数据文件 10: '/data/oradata/prod35.dbf'

    https://community.oracle.com/thread/3540795 概述 ------------- 数据库坏块(corruption) 的类型可以按照坏块所属对象的不同,分为用户 ...

  6. Linux(RHEL7)下安装vsftp服务

    1.安装vsftp(没有配置yum源的先配置yum源) yum install -y vsftpd 2.启动ftp服务 systemctl start vsftpd.service 3.打开防火墙 f ...

  7. 五一清北学堂培训之数据结构(Day 1&Day 2)

    Day 1 前置知识: 二进制 2.基本语法 3.时间复杂度 正片       1.枚举 洛谷P1046陶陶摘苹果  入门题没什么好说的 判断素数:从2枚举到sqrt(n),若出现n的因子,则n是合数 ...

  8. Altium Designer chapter5总结

    PCB设计环境中需要注意的如下: (1)PCB设计步骤:绘制原理图和生成网表—规划电路板—载入网表—元件布局—制定设计规则—布线—后期处理—DRC检查—信号完整性分析—gerbera文件输出 (2)P ...

  9. sql server 2008查询时报错,消息:8155,没有为'a'的列2指向任何列

    解决方法1: 关掉Sql Server再打开, 重新查询 解决方法2: select T.* from(   select row_number() over(order by age desc) a ...

  10. Learning OSG programing---osgAnimation(2)

    osg::Node* createBase(const osg::Vec3& center,float radius) { ; ; *radius; *radius; osg::Vec3 v0 ...