linux中内核级加强型火墙管理

1.火墙介绍

1.1 netfilter
netfilter 组件也称为内核空间(kernelspace),是内核的一部分,由一些 信息包过滤表组成,这些表包含内核用来控制信息包过滤处理的规则集。
netfilter是由Rusty Russell提出的Linux 2.4内核防火墙框架,该框架既简洁又灵活,可实现安全策略应用中的许多功能,如数据包过滤、数据包处理、地址伪装、透明代理、动态网络地址转换(Network Address Translation,NAT),以及基于用户及媒体访问控制(Media Access Control,MAC)地址的过滤和基于状态的过滤、包速率限制等。

1.2 iptables
iptables 组件是一种工具,也称为用户空间(userspace),它使插入、修改和除去信息包过滤表中的规则变得容易。
Iptables 是用来设置、维护和检查Linux内核的IP包过滤规则的,是用来填写netfilter的工具。
可以定义不同的表,每个表都包含几个内部的链,也能包含用户定义的链。每个链都是一个规则列表,对对应的包进行匹配:每条规则指定应当如何处理与之相匹配的包。这被称作’target’(目标),也可以跳向同一个表内的用户定义的链。
netfilter/iptables 的最大优点是它可以配置有状态的防火墙。

1.3 iptables|firewalld(火墙管理的两种工具)
iptables的防火墙策略是交由内核层面的netfilter网络过滤器来处理的,而firewalld则是交由内核层面的nftables包过滤框架来处理。
相较于iptables防火墙而言,firewalld支持动态更新技术并加入了区域(zone)的概念,即不同的防火墙策略集合,用户可以根据生产场景的不同而选择合适的策略集合,从而实现防火墙策略之间的快速切换。

2、火墙实验环境设定

建立两台虚拟机node1,node2
node1为双网卡主机 ip分别为172.25.254.100 ;1.1.1.100
node2为单网卡主机 1.1.1.200

3、firewall命令的基本使用方式

[root@localhost network-scripts]# firewall-cmd --state 常洵火墙运行状态
running
[root@localhost yum.repos.d]# dnf install firewall-config-0.8.0-4.el8.noarch -y 安装火墙图形软件包
[root@localhost yum.repos.d]# firewall-config 图形开启命令
在这里插入图片描述
在这里插入图片描述
在node1上实验:

[root@localhost services]# ls /usr/lib/firewalld/  数据模块存放位置
helpers  icmptypes  ipsets  services  zones
[root@localhost services]# ls /etc/firewalld/  火墙配置文件
firewalld.conf  icmptypes  lockdown-whitelist.xml  zones
helpers         ipsets     services
[root@localhost zones]# cd /etc/firewalld/zones/
[root@localhost zones]# ls
public.xml (新策略) public.xml.old(老策略)
[root@localhost zones]# cat public.xml  查看策略
<?xml version="1.0" encoding="utf-8"?>
<zone>
  <short>Public</short>
  <description>For use in public areas. You do not trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.</description>
  <service name="ssh"/>
  <service name="dhcpv6-client"/>
  <service name="cockpit"/>
</zone>
[root@localhost zones]# firewall-cmd --permanent --add-service=http  允许http服务,实质是改变了策略文件
success
[root@localhost zones]# cat public.xml 查看策略文件
<?xml version="1.0" encoding="utf-8"?>
<zone>
  <short>Public</short>
  <description>For use in public areas. You do not trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.</description>
  <service name="ssh"/>
  <service name="dhcpv6-client"/>
  <service name="cockpit"/>
  <service name="http"/>    改变了文件内容
</zone>
[root@localhost zones]# firewall-cmd --reload   目的是让改变的文件内容重新加载到火墙信息当中
success
[root@localhost zones]# firewall-cmd --get-default-zone  查看当前火墙默认使用的域,如果自己设定了,就走自己指定的策略
public  表示数据走的是public的所有策略
[root@localhost zones]# firewall-cmd --get-active-zones  表示查看火墙活跃的域
libvirt
  interfaces: virbr0
public
  interfaces: enp7s0 enp1s0
[root@localhost zones]# firewall-cmd --set-default-zone=trusted  把默认域设置为trusted,接受所有的网络连接
success
[root@localhost zones]# firewall-cmd --get-active-zones   查看火墙活跃的域也变成trusted
libvirt
  interfaces: virbr0
trusted
  interfaces: enp7s0 enp1s0
测试
[root@localhost zones]# dnf install httpd -y   安装httpd
[root@localhost zones]# firewall-cmd --set-default-zone=public  把域设置为public
[root@localhost zones]# firewall-cmd --remove-service=http  将之前的http服务去掉
[root@localhost zones]# firewall-cmd --reload 
success
[root@foundation50 images]# ssh root@172.25.254.100  允许访问
root@172.25.254.100's password: 
Activate the web console with: systemctl enable --now cockpit.socket

This system is not registered to Red Hat Insights. See https://cloud.redhat.com/
To register this system, run: insights-client --register

Last login: Thu Nov 11 11:23:27 2021

在真机上访问172.25.254.100无法访问
在这里插入图片描述

[root@localhost zones]# firewall-cmd --set-default-zone=trusted   把火墙域设置为接收所有网络
success
[root@localhost zones]# firewall-cmd --reload 
success

在真机上访问172.25.254.100就可以访问
在这里插入图片描述

[root@localhost zones]# firewall-cmd --set-default-zone=block  把域指定为全黑
success
[root@localhost zones]# firewall-cmd --reload 
success
[root@foundation50 images]# ssh root@172.25.254.100 访问被拒绝,有信息提示
ssh: connect to host 172.25.254.100 port 22: No route to host

在真机访问172.25.254.100拒绝
在这里插入图片描述

[root@localhost zones]# firewall-cmd --set-default-zone=drop
success
[root@localhost zones]# firewall-cmd --reload 
success
[root@foundation50 images]# ssh root@172.25.254.100  远程,没有任何信息,无响应。
[root@localhost zones]# firewall-cmd --list-all 查看默认域中的所有火墙策略
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: enp1s0 enp7s0
  sources: 
  services: cockpit dhcpv6-client http ssh
  ports: 
  protocols: 
  masquerade: no
  forward-ports: 
  source-ports: 
  icmp-blocks: 
  rich rules: 
 [root@localhost zones]# firewall-cmd --list-all --zone=trusted   查看truste域中的火墙策略
trusted
  target: ACCEPT
  icmp-block-inversion: no
  interfaces: 
  sources: 
  services: 
  ports: 
  protocols: 
  masquerade: no
  forward-ports: 
  source-ports: 
  icmp-blocks: 
  rich rules: 
[root@localhost zones]# firewall-cmd --list-services  列出当前域的可用服务名称
cockpit dhcpv6-client http ssh  
[root@localhost zones]# firewall-cmd  --get-services  列出所有可用的服务名称
RH-Satellite-6 amanda-client amanda-k5-client amqp amqps apcupsd audit bacula bacula-client bb bgp bitcoin bitcoin-rpc bitcoin-testnet bitcoin-testnet-rpc bittorrent-lsd ceph ceph-mon cfengine cockpit condor-collector ctdb dhcp dhcpv6 dhcpv6-client distcc dns dns-over-tls docker-registry docker-swarm dropbox-lansync elasticsearch etcd-client etcd-server finger freeipa-4 freeipa-ldap freeipa-ldaps 
[root@localhost zones]# firewall-cmd --permanent --add-source=172.25.254.50 --zone=trusted  指定数据来源访问指定域,50过来的的设定为信任
success
[root@localhost zones]# firewall-cmd --reload 
success

真机上访问172.25.254.100 可以访问,其他人不可以访问
在这里插入图片描述

[root@localhost zones]# firewall-cmd --permanent --remove-source=172.25.254.50 --zone=trusted  删除指定域中的数据来源
success
[root@localhost zones]# firewall-cmd --reload 
success

真机上不能访问
在这里插入图片描述

[root@localhost zones]# firewall-cmd --get-active-zones  
libvirt
  interfaces: virbr0
public
  interfaces: enp7s0 enp1s0
[root@localhost zones]# firewall-cmd --remove-interface=enp1s0 --zone=public   将网卡enp1s0从public域中剥离出来
success
[root@localhost zones]# firewall-cmd --get-active-zones 
libvirt
  interfaces: virbr0
public
interfaces: enp7s0
[root@localhost zones]# firewall-cmd --add-interface=enp1s0 --zone=trusted  
success
[root@localhost zones]# firewall-cmd --reload 
success
[root@localhost zones]# firewall-cmd --get-active-zones  
libvirt
  interfaces: virbr0
public
  interfaces: enp7s0    
trusted
  interfaces: enp1s0   
如何换回来??
[root@localhost zones]# firewall-cmd --change-interface=enp1s0 --zone=public 
success
[root@localhost zones]# firewall-cmd --get-active-zones 
libvirt
  interfaces: virbr0
public
  interfaces: enp7s0 enp1s0

4、火墙规则中的3张表和5条链

默认策略中的5条链

input输入
output输出
forward转发
postrouting路由之后
prerouting路由之前

默认的3张表

filter经过本机内核的数据 (input、output 、forward)
nat不经过内核的数据 (postrouting、prerouting、input、output)
mangle当filter和nat表不够用时使用 (input 、output 、forward 、postrouting、 prerouting)

5条链示意图:
在这里插入图片描述
3张表
filter:都经过内核的链路表
在这里插入图片描述
nat:不经过内核的链路表
在这里插入图片描述
mangle:五条链路补充说明表
在这里插入图片描述

5、firewall中的高级规则

问题:如何让172.25.254.50主机可以访问172.25.254.100别人都不可以访问172.25.254.100??
这就需要用到firewall中的高级规则

[root@westosa Desktop]# firewall-cmd --direct --get-all-rules  获取火墙中默认没有的规则
[root@westosa Desktop]# firewall-cmd --direct --add-rule ipv4   如果不知道表名称输入ipv4用tab补齐
filter  mangle  nat
[root@westosa Desktop]# firewall-cmd --direct --add-rule ipv4 filter INPUT 1  ! -s 172.25.254.50 -p tcp --dport 80 -j REJECT   
当你访问我,除了172.25.254.50,tcp端口为80可以访问,其他都被拒绝( 限制input链 ,1 表示第一条链   !-s172.25.254.50 表示除了172.25.254.100以外 ,dport表示目的地端口)
[root@westosa Desktop]# firewall-cmd --direct --get-all-rules  获取火墙中默认没有的规则
ipv4 filter INPUT 1 '!' -s 172.25.254.50 -p tcp --dport 80 -j REJECT  规则已经有了
[root@westosb Desktop]# curl http://1.1.1.100  其他主机被拒绝访问
curl: (7) Failed to connect to 1.1.1.100 port 80: Connection refused
[root@westosa Desktop]# firewall-cmd --direct --remove-rule ipv4 filter INPUT 1  ! -s 172.25.254.50 -p tcp --dport 80 -j REJECT    删除规则
success
[root@westosb Desktop]# curl http://1.1.1.100  删除后,访问已经被允许

6、firewalld中的nat动作

实验环境:
[root@westosb Desktop]# ping 172.25.254.100   1.1.1.100网段ping不通
connect: Network is unreachable
[root@westosb Desktop]# vim /etc/sysconfig/network   添加网关 
GATEWAY=1.1.1.100     添加网关
[root@westosb Desktop]# nmcli connection reload 
[root@westosb Desktop]# nmcli connection up enp1s0 
[root@westosb Desktop]# ping 172.25.254.100  可以ping通
PING 1.1.1.100 (172.25.254.100) 56(84) bytes of data.
64 bytes from 172.25.254.100: icmp_seq=1 ttl=64 time=1.87 ms
[root@westosb Desktop]# ping 172.25.254.50  真机ping不通,双网卡主机没有打开地址伪装功能
[root@westosa Desktop]# firewall-cmd --add-masquerade    双网卡主机打开地址伪装功能
success
[root@westosb Desktop]# ping 172.25.254.50  可以ping通
PING 172.25.254.50 (172.25.254.50) 56(84) bytes of data.
64 bytes from 172.25.254.50: icmp_seq=1 ttl=63 time=0.412 ms

如何让172.25.254.10主机访问 172.25.254.100时转到1.1.1.200上   目的地地址转换
[root@westosa Desktop]# firewall-cmd --permanent --add-forward-port=port=22:proto=tcp:toport=22:toaddr=1.1.1.200 
 当你访问我的22端口时,我把你转到1,1,1,200 的22端口上去(   tcp:toport=22 表示转换过后的端口为22,转换的地址为1.1.1.200)
success
[root@westosa Desktop]# firewall-cmd --reload  重启服务
success
[root@westosa Desktop]# firewall-cmd --list-all 
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: enp1s0 enp7s0
  sources: 
  services: cockpit dhcpv6-client http ssh
  ports: 
  protocols: 
  masquerade: no
  forward-ports: port=22:proto=tcp:toport=22:toaddr=1.1.1.200    已经添加成功
  source-ports:   
  icmp-blocks: 
  rich rules: 

7、iptables的常用参数及用法

在双网卡主机里

[root@westosa Desktop]# yum install iptables-services -y  安装iptables
[root@westosa Desktop]# systemctl disable --now firewalld.service   停掉firewall,不开机启动
Removed /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
root@westosa Desktop]# systemctl mask firewalld 冻结firewall使不被其他程序打开
[root@westosa Desktop]# systemctl unmask iptables.service 
[root@westosa Desktop]# systemctl enable --now iptables.service   启动iptables并设定开机启动
Created symlink /etc/systemd/system/basic.target.wants/iptables.service → /usr/lib/systemd/system/iptables.service.

iptables命令

iptables的命令用途
t指定表名称
-n不做解析(显示主机IP)
-L查看
-A添加策略
-D删除策略
-p协议
  • -dport| 目的地端口
    -s| 来源
    -j |动作
    -j |  ACCEPT 允许
    -j  |  DROP 丢弃(无回应)
    -j  |  REJECT 拒绝(有回应)
    -j  | SNAT 源地址转换
    -j  | DNAT 目的地地址转换
    -N| 新建链
    -E |更改链名称
    -X| 删除链
    -D| 删除规则
    -I |插入规则
    -R |更改规则
    -P |更改默认规
[root@westosa Desktop]# iptables -L   查看
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         做了地址解析
ACCEPT     all  --  anywhere             anywhere             state RELATED,ESTABLISHED
ACCEPT     icmp --  anywhere             anywhere            
ACCEPT     all  --  anywhere             anywhere            
ACCEPT     tcp  --  anywhere             anywhere             state NEW tcp dpt:ssh
REJECT     all  --  anywhere             anywhere             reject-with icmp-host-prohibited

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         
REJECT     all  --  anywhere             anywhere             reject-with icmp-host-prohibited

Chain OUTPUT (policy ACCEPT)
target (动作)    prot(协议) opt source (来源)     destination (目的地)   
[root@westosa Desktop]# iptables -nL  表示不做地址解析,把ip地址裸露出来
Chain(链) INPUT (policy ACCEPT)
target     prot opt source       destination         
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0            state RELATED(表示之前来了,现在又来了),ESTABLISHED(正在)
ACCEPT     icmp --  0.0.0.0/0            0.0.0.0/0           
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            state NEW(新来的) tcp dpt:22
REJECT     all  --  0.0.0.0/0            0.0.0.0/0            reject-with icmp-host-prohibited

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         
REJECT     all  --  0.0.0.0/0            0.0.0.0/0            reject-with icmp-host-prohibited

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         
[root@westosa Desktop]# iptables -F  清掉数据
[root@westosa Desktop]# iptables -nl
iptables v1.8.4 (nf_tables): unknown option "-nl"
Try `iptables -h' or 'iptables --help' for more information.
[root@westosa Desktop]# iptables -nL  查看,数据没了
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination 
[root@westosa Desktop]# systemctl restart iptables.service  但重启服务后
[root@westosa Desktop]# iptables -nL   数据有回来了
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0            state RELATED,ESTABLISHED
ACCEPT     icmp --  0.0.0.0/0            0.0.0.0/0           
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            state NEW tcp dpt:22
REJECT     all  --  0.0.0.0/0            0.0.0.0/0            reject-with icmp-host-prohibited

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         
REJECT     all  --  0.0.0.0/0            0.0.0.0/0            reject-with icmp-host-prohibited

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination  

如何永久保存
两种方法:
1、root@westosa Desktop]# service iptables save  
iptables: Saving firewall rules to /etc/sysconfig/iptables:[  OK  ]   将当前的火墙规则保存到/etc/sysconfig/iptables:
2、[root@westosa Desktop]# iptables-save > /etc/sysconfig/iptables  也可以将生成的规则数据保存到/etc/sysconfig/iptables  文件里
[root@westosa Desktop]# iptables -t filter  -A INPUT -j  ACCEPT  表示所有都可以访问( -t表示指定表明称  -A 添加策略  ACCEPT 允许)
[root@westosa Desktop]# iptables -t filter -A INPUT -s 172.25.254.50 -j REJECT   表示172.25.254.50拒绝访问

但是用50主机访问172.25.254.100 还是可以访问
在这里插入图片描述

第一条策略中50是all中的一员,所以后面策略50被拒绝就不读了,所以策略的先后顺序是有很大影响的,是按照先后顺寻依次读取
[root@westosa Desktop]# iptables -D INPUT 2  删除第2条链
root@westosa Desktop]# iptables -t filter -I INPUT -s 172.25.254.50 -j REJECT  -I 表示插入 ,链路后面不跟数字默认在最前面插入
root@westosa Desktop]# iptables -nL  查看
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
REJECT     all  --  172.25.254.50        0.0.0.0/0            reject-with icmp-port-unreachable     已经插入在最前面
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination 

再次通过172.25.254.50访问172.25.254.100就无法访问了
在这里插入图片描述

root@westosa Desktop]# iptables -R INPUT 1 -j REJECT  -R 表示修改 ,修改第一条链为拒绝
[root@westosa Desktop]# iptables -N westos  -N 表示新建链路
[root@westosa Desktop]# iptables -nL  
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         

Chain westos (0 references)    westos已经添加成功
target     prot opt source               destination    
[root@westosa Desktop]# iptables -E westos WESTOS  将小写链名称改成大写链名称
[root@westosa Desktop]# iptables -nL
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         

Chain WESTOS (0 references)
target     prot opt source               destination  
ot@westosa Desktop]# iptables -X WESTOS  -X表示删除 ,删除链
[root@westosa Desktop]# iptables -nL
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination 
root@westosa Desktop]# iptables -P INPUT DROP    -P 修改链路默认规则
[root@westosa Desktop]# iptables -nL
Chain INPUT (policy DROP)   此链路规则就从ACCEPT变成DROP
target     prot opt source               destination         
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination  

8 、iptables对于读取规则的优化策略

问题:火墙策略是从上到下依次读取,自己所读去的策略在最下面,如果策略太多要依次读取,就会有很大的延迟,所以我们需要验证火墙的状态,只去验证新来的人

[root@westosa Desktop]# iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT  -m 指定状态 ,表示之前已经连过的,和正在连的都通过
[root@westosa Desktop]# iptables -A INPUT  -m state --state NEW -i lo -j ACCEPT   (lo表示回环接口,-I表示进入的)表示自己连接自己的都通过
t@westosa Desktop]# iptables -A INPUT -m  state  --state NEW -p tcp --dport 80 -j ACCEPT  表示新连入的是80端口可以通过
[root@westosa Desktop]# iptables -A INPUT -m  state  --state NEW -p tcp --dport 22 -j ACCEPT  表示新连入的是22端口可以通过
 [root@westosa Desktop]# iptables -A INPUT -m state --state NEW -j REJECT  其他的都拒绝
 [root@westosa Desktop]# iptables-save > /etc/sysconfig/iptables  火墙策略永久保存

9、iptables的nat模式

[root@westosa Desktop]# iptables -t nat -nL  查看nat 表
Chain PREROUTING (policy ACCEPT)
target     prot opt source               destination         

Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain POSTROUTING (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
[root@westosa Desktop]#  iptables -t nat -A POSTROUTING  -o enp1s0  -j SNAT --to-source 172.25.254.100 
表示通过enp1s0出去的全部做地址转换
[root@westosa Desktop]# sysctl -a | grep ip_forward  查看内核陆游是否打开
net.ipv4.ip_forward = 1
net.ipv4.ip_forward_update_priority = 1
net.ipv4.ip_forward_use_pmtu = 0
[root@westosa Desktop]# vim /etc/sysctl.conf   如果没开需要编辑这个文件,添加
net.ipv4.ip_forward = 1
[root@westosa Desktop]# sysctl -p  生效
[root@westosb Desktop]# ping 172.25.254.50     1.1.1.200主机就可以ping通172.25.254.50
PING 172.25.254.50 (172.25.254.50) 56(84) bytes of data.
64 bytes from 172.25.254.50: icmp_seq=1 ttl=63 time=1.03 ms
64 bytes from 172.25.254.50: icmp_seq=2 ttl=63 time=0.410 ms

如何让172.25.254.10主机访问 172.25.254.100时转到1.1.1.200上
root@westosb Desktop]# iptables -t nat -A PREROUTING  -i enp1s0 -j DNAT --to-dest 1.1.1.200  PREROUTING表示路由之前
[root@westosb Desktop]# iptables -t nat -nL  查看策略已经有了
Chain PREROUTING (policy ACCEPT)
target     prot opt source               destination         
DNAT       all  --  0.0.0.0/0            0.0.0.0/0            to:1.1.1.200  策略存在了

Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain POSTROUTING (policy ACCEPT)
target     prot opt source               destination         
RETURN     all  --  192.168.122.0/24     224.0.0.0/24        
RETURN     all  --  192.168.122.0/24     255.255.255.255     
MASQUERADE  tcp  --  192.168.122.0/24    !192.168.122.0/24     masq ports: 1024-65535
MASQUERADE  udp  --  192.168.122.0/24    !192.168.122.0/24     masq ports: 1024-65535
MASQUERADE  all  --  192.168.122.0/24    !192.168.122.0/24    

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination  
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

小莫细说linux

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值