多平台统一管理软件接口,如何实现多平台统一管理软件接口
1416
2022-09-16
零基础学网络:命令行(CLI)调试防火墙实战(防火墙cli控制台命令)
现在主流防火墙都支持web界面调试,但是有些情况下需要采用命令行(CLI)的方式进行防火墙配置。此文中以华为防火墙为例,采用命令行方式进行实战配置演示,并记录相关命令行。
1、客户需求:客户采购一台防火墙,一台核心交换机,多台接入交换机,现在客户从运营商哪里租用了一条带宽,运营商分配地址为176.17.223.2/30,网关为176.17.223.2,客户局域网地址规划了三个网段分别为172.16.1.0/24,172.16.2.0/24.172.16.3.0/24,网关为172.16.X.254,现在需要让客户所有的网段可以正常访问internet,并且需要将几台服务器映射到公网。
需求分析:a、局域网的所有地址要通过运营商的一个地址进行公网访问,需要设置源地址转换;
b、有几台服务器需要映射到公网,需要做目的地址转换;
c、客户采购了核心交换机,需要将网关设置到核心交换机;
d、核心交换机需要与防火墙通过路由口进行互联。
2、分析组网图如下:防火墙g0/0/2口连接运营商线路,地址配置为176.17.223.2/30,防火墙g0/0/1口与核心交换机互联,接口地址规划为172.172.172.2/30,核心交换机g0/0/1与防火墙g0/0/1互联,接口地址配置为172.172.172.1/30。
图-1
3、防火墙配置
3.1、通过console口登录防火墙/交换机可以参考零基础学网络之交换机设备登录方法,登录到CLI界面如下并将端口加入到相应域:
[firewall] sysname xiaozc --对防火墙重命名为xiaozc
[xiaozc] firewall zone trust
[xiaozc-zone-trust] set priority 85
[xiaozc-zone-trust] add interface GigabitEthernet0/0/1 --将1口加入到trust域
[xiaozc-zone-trust] quit
[xiaozc] firewall zone untrust
[xiaozc-zone-untrust] set priority 5
[xiaozc-zone-untrust] add interface GigabitEthernet0/0/2 --将2口加入到untrust域
[xiaozc-zone-untrust] quit
3.2、设置地址对象组
[xiaozc]ip address-set xiaozc type object
[xiaozc-object-address-set-xiaozc]address 0 172.16.1.0 mask 24
[xiaozc-object-address-set-xiaozc]address 1 172.16.2.0 mask 24
[xiaozc-object-address-set-xiaozc]address 2 172.16.3.0 mask 24
[xiaozc-object-address-set-xiaozc]quit
3.3、设置防火墙端口地址
[xiaozc]interface g0/0/1 --进入0/0/1接口
[xiaozc-GigabitEthernet0/0/1] undo shutdown --开启端口
[xiaozc-GigabitEthernet0/0/1] ip address 172.172.172.2 255.255.255.252 --设置端口IPV4地址
[xiaozc-GigabitEthernet0/0/1] service-manage permit --允许通过端口进行ssh permit --允许通过端口进行ssh管理
[xiaozc-GigabitEthernet0/0/1] bandwidth ingress 100000 --配置入方向带宽
[xiaozc-GigabitEthernet0/0/1] bandwidth egress 100000 --配置出方向带宽
[xiaozc]interface g0/0/2
[xiaozc-GigabitEthernet0/0/2] undo shutdown
[xiaozc-GigabitEthernet0/0/2] ip address 176.17.223.2 255.255.255.252
[xiaozc-GigabitEthernet0/0/2] service-manage permit
[xiaozc-GigabitEthernet0/0/2] bandwidth ingress 100000
[xiaozc-GigabitEthernet0/0/2] bandwidth egress 100000
3.4、防火墙设置路由
[xiaozc] ip route-static 0.0.0.0 0.0.0.0 GigabitEthernet0/0/2 176.17.223.2
[xiaozc] ip route-static 172.16.1.0 255.255.255.0 GigabitEthernet0/0/1 172.172.172.1
[xiaozc] ip route-static 172.16.2.0 255.255.255.0 GigabitEthernet0/0/1 172.172.172.1
[xiaozc] ip route-static 172.16.3.0 255.255.255.0 GigabitEthernet0/0/1 172.172.172.1
3.5、设置域安全策略,默认防火墙是禁止所有
[xiaozc] security-policy
--设置untrust到trust的安全策略
[xiaozc-policy-security] rule name Untrust-Trust
[xiaozc-policy-security-rule-Untrust-Trust] description 非信任区to信任区
[xiaozc-policy-security-rule-Untrust-Trust] source-zone untrust --源区域非信任区
[xiaozc-policy-security-rule-Untrust-Trust] destination-zone trust --目标区域信任区
[xiaozc-policy-security-rule-Untrust-Trust] profile av default --启用av库
[xiaozc-policy-security-rule-Untrust-Trust] profile ips default --启用IPS规则
[xiaozc-policy-security-rule-Untrust-Trust] action permit --动作设置为允许
--设置trust到untrust的安全策略
[xiaozc-policy-security] rule name trust-Untrust
[xiaozc-policy-security-rule-trust-Untrust] description 信任区tof非信任区
[xiaozc-policy-security-rule-trust-Untrust] source-zone trust
[xiaozc-policy-security-rule-trust-Untrust] destination-zone untrust
[xiaozc-policy-security-rule-trust-Untrust] action permit
3.6、设置nat策略
设置nat地址组
[xiaozc]nat address-group xiao
[xiaozc-address-group-xiao] mode pat
[xiaozc-address-group-xiao] section 0 176.17.223.2 176.17.223.2
设置nat策略
[xiaozc] nat-policy
[xiaozc-policy-nat] rule name internet
[xiaozc-policy-nat-rule-internet] source-zone trust
[xiaozc-policy-nat-rule-internet] destination-zone untrust
[xiaozc-policy-nat-rule-internet] source-address address-set xiaozc --xiaozc为3.2章节的地址组对象
[xiaozc-policy-nat-rule-internet] action source-nat address-group xiao
3.7、设置目的nat(服务器映射)
[xiaozc] nat server newserver protocol tcp global 176.17.223.2 8078 inside 172.16.1.20 8081 no-reverse unr-route --将内网172.16.1.20的8081端口通过8087映射到公网176.17.223.2
4、配置核心交换机
4.1、配置互联口地址
[hexin]interface g0/0/1
[hexin-GigabitEthernet0/0/1] undo portswitch
[hexin-GigabitEthernet0/0/1] description Link_to_Firewall --为端口添加描述
[hexin-GigabitEthernet0/0/1] ip address 172.172.172.1 255.255.255.252
4.2、配置vlan网关
[hexin] vlan batch 10 20 30
[hexin] interface vlan 10
[hexin-Vlanif10] description subnet10
[hexin-Vlanif10] ip address 172.16.1.254 255.255.255.0
[hexin-Vlanif10]quit
[hexin] interface vlan 20
[hexin-Vlanif10] description subnet20
[hexin-Vlanif10] ip address 172.16.2.254 255.255.255.0
[hexin-Vlanif10]quit
[hexin] interface vlan 30
[hexin-Vlanif10] description subnet30
[hexin-Vlanif10] ip address 172.16.3.254 255.255.255.0
[hexin-Vlanif10] quit
4.3、添加路由
[hexin] ip route-static 0.0.0.0 0.0.0.0 172.172.172.2
5、测试
用笔记本连接至交换机,设置相应IP地址以及运营商DNS,看是否可以ping通DNS以及常用网址,若通证明源地址转换成功,在其他公网区域访问映射的服务器地址,若可以访问证明目的地址nat成功。
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~