1 / 8

红旗 Linux

红旗 Linux. 网络安全 ——iptables/NAT. iptables 的使用. 三种功能 包过滤 NAT mangle. iptables—— 包过滤. NAT 表的三条规则链 PREROUTING POSTROUTING OUTPUT. Iptables 命令语法. 语法 iptables [-t table] -[ADC] chain rule-specification [options] 常见参数 -A :在所选择的链末添加一条或更多规则; -L :显示所选链的所有规则。 -F :清空所选链。这等于把所有规则一个个删除;

kemp
Download Presentation

红旗 Linux

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 红旗Linux 网络安全 ——iptables/NAT

  2. iptables的使用 • 三种功能 • 包过滤 • NAT • mangle

  3. iptables——包过滤 • NAT表的三条规则链 • PREROUTING • POSTROUTING • OUTPUT

  4. Iptables命令语法 • 语法 • iptables [-t table] -[ADC] chain rule-specification [options] • 常见参数 • -A:在所选择的链末添加一条或更多规则; • -L:显示所选链的所有规则。 • -F:清空所选链。这等于把所有规则一个个删除; • -P:设置链的目标规则;

  5. 案例1——实现SNAT 172.16.80.254/24 192.168.2.254 网络-2 NAT 校园网 172.16.80.1/24 XP 192.168.2.180/24 10.10.25.12

  6. 案例1——实现SNAT • 启动防火墙 • service iptables start • 设置规则 • 清空所有规则 • iptables –F -t nat • 设置SNAT策略 • iptables -t nat -A POSTROUTING -s 172.16.80.0/24 -j SNAT --to 192.168.2.180 • 启动数据包转发功能 • echo 1 > /proc/sys/net/ipv4/ip_forward

  7. 案例2——实现DNAT 172.16.80.254/24 192.168.2.80 网络-2 NAT 172.16.80.1/24 Web Server 192.168.2.180/24

  8. 案例2——实现DNAT • 启动防火墙 • service iptables start • 设置规则 • 清空所有规则 • iptables –F -t nat • 设置DNAT策略 • iptables -t nat -A PREROUTING -p tcp -d 192.168.2.180 --dprot 80 -j DNAT --to 172.16.80.1:80 • 启动数据包转发功能 • echo 1 > /proc/sys/net/ipv4/ip_forward

More Related