<H3C>dis cur # version 7.1.064, Release 9345P2416 # sysname H3C # context Admin id 1 # irf mac-address persistent timer irf auto-update enable undo irf link-delay irf member 1 priority 1 # nat address-group 1 address 192.168.168.0 192.168.168.255 # dhcp enable dhcp server forbidden-ip 192.168.168.1 # password-recovery enable # vlan 1 # object-group ip address 外网访问内网 0 network host address 192.168.168.217 # dhcp server ip-pool 1 gateway-list 192.168.168.1 network 192.168.168.0 mask 255.255.255.0 dns-list 114.114.114.114 # controller Cellular1/0/0 # interface NULL0 # interface GigabitEthernet1/0/0 port link-mode route # interface GigabitEthernet1/0/1 port link-mode route # interface GigabitEthernet1/0/2 port link-mode route # interface GigabitEthernet1/0/3 port link-mode route # interface GigabitEthernet1/0/4 port link-mode route # interface GigabitEthernet1/0/5 port link-mode route # interface GigabitEthernet1/0/6 port link-mode route # interface GigabitEthernet1/0/7 port link-mode route # interface GigabitEthernet1/0/8 port link-mode route # interface GigabitEthernet1/0/9 port link-mode route # interface GigabitEthernet1/0/10 port link-mode route # interface GigabitEthernet1/0/11 port link-mode route # interface GigabitEthernet1/0/12 port link-mode route # interface GigabitEthernet1/0/13 port link-mode route # interface GigabitEthernet1/0/14 port link-mode route ip address 192.168.168.1 255.255.255.0 # interface GigabitEthernet1/0/15 port link-mode route # interface GigabitEthernet1/0/16 port link-mode route # interface GigabitEthernet1/0/17 port link-mode route ip address 58.42.229.49 255.255.255.0 nat outbound 3000 nat server protocol tcp global 58.42.229.49 8081 inside 192.168.168.251 80 rule ServerRule_1 nat server protocol tcp global current-interface 8080 inside 192.168.168.217 1433 rule ServerRule_2 # interface GigabitEthernet1/0/18 port link-mode route # interface GigabitEthernet1/0/19 port link-mode route # interface GigabitEthernet1/0/20 port link-mode route # interface GigabitEthernet1/0/21 port link-mode route # interface GigabitEthernet1/0/22 port link-mode route # interface GigabitEthernet1/0/23 port link-mode route # security-zone name Local # security-zone name Trust import interface GigabitEthernet1/0/14 # security-zone name DMZ # security-zone name Untrust import interface GigabitEthernet1/0/17 # security-zone name Management # zone-pair security source Local destination Any packet-filter 3000 # zone-pair security source Trust destination Local packet-filter 3000 # zone-pair security source Trust destination Untrust packet-filter 3000 # zone-pair security source Untrust destination Local packet-filter 3000 # scheduler logfile size 16 # line class aux user-role network-operator # line class console user-role network-admin # line class vty user-role network-operator # line aux 0 user-role network-operator # line con 0 user-role network-admin # line vty 0 4 authentication-mode scheme user-role network-operator # line vty 5 63 user-role network-operator # ip route-static 0.0.0.0 0 58.42.229.1 # acl basic 2000 rule 0 permit source 192.168.168.0 0.0.0.255 # acl advanced 3000 rule 0 permit ip # acl advanced 3001 rule 0 permit ip destination 192.168.168.217 0 # acl advanced name "acl 3000" # domain system # domain default enable system # role name level-0 description Predefined level-0 role # role name level-1 description Predefined level-1 role # role name level-2 description Predefined level-2 role # role name level-3 description Predefined level-3 role # role name level-4 description Predefined level-4 role # role name level-5 description Predefined level-5 role # role name level-6 description Predefined level-6 role # role name level-7 description Predefined level-7 role # role name level-8 description Predefined level-8 role # role name level-9 description Predefined level-9 role # role name level-10 description Predefined level-10 role # role name level-11 description Predefined level-11 role # role name level-12 description Predefined level-12 role # role name level-13 description Predefined level-13 role # role name level-14 description Predefined level-14 role # user-group system # local-user admin class manage password hash $h$6$mWaPmXtX3V/IgcJb$5PbvV8hI3ORBaXCu6mogLivJx5o7i1U2CF8MyxvDBHLSimTCCkb4owCbCwIRbNsoisvvDmhX3EWiFpmAA8W6ag== service-type telnet terminal http https authorization-attribute user-role level-15 authorization-attribute user-role network-operator # ip http enable ip https enable # return
,在内网主机上是可以正常访问服务器的端口的,在外网上是无法访问服务器端口,在防火墙上直接telnet 服务器的端口也是不通的
(0)
最佳答案
1.更换外部端口号9000或者一万以上的,小端口号可能被运营商禁掉
2.安全策略是否调用ipv4地址对象组和服务对象组
参考配置案例
#在外网口填写运营商提供的公网地址,掩码,配置映射,映射端口8081,服务器地址192.168.1.88
<H3C> system-view
[H3C] interface GigabitEthernet1/0/1
[H3C-GigabitEthernet1/0/1]ip add 202.1.1.100 255.255.255.248
[H3C-GigabitEthernet1/0/1]nat server protocol tcp global 202.1.1.100 8081 inside 192.168.1.88 8081
[H3C-GigabitEthernet1/0/1]quit
#在内网口配置映射,填写内网网关地址以及配置Nat Hairpin
[H3C]interface GigabitEthernet1/0/4
[H3C-GigabitEthernet1/0/4]ip add 172.16.100.1 255.255.255.0
[H3C-GigabitEthernet1/0/4]nat hairpin enable
[H3C-GigabitEthernet1/0/4]quit
Nat Hairpin功能简介:通过在内网侧接口上使能NAT hairpin功能,可以实现内网用户使用NAT地址访问内网服务器或内网其它用户。NAT hairpin功能需要与内部服务器(nat server)、出方向动态地址转换(nat outbound)或出方向静态地址转换(nat static outbound)配合工作,且这些配置所在的接口必须在同一个接口板,否则NAT hairpin功能无法正常工作。
防火墙目前版本存在两套安全策略,请在放通安全策略前确认设备运行那种类型的安全策略?以下配置任选其一。
[H3C]display cu | in security-policy
security-policy disable
#创建地址对象组,地址对象组名称为OA服务器
[H3C]object-group ip address OA服务器
[H3C-obj-grp-ip-OA服务器]network host address 192.168.1.88
[H3C-obj-grp-ip-OA服务器]quit
#创建服务对象组,服务对象组名称为8081端口,目的端口8081
[H3C]object-group service 8081端口
[H3C-obj-grp-service-8081端口]service tcp destination eq 8081
[H3C-obj-grp-service-8081端口]quit
#创建IPv4对象策略,策略名称为OA服务器,放通目的地址为192.168.1.88的8081端口
[H3C]object-policy ip OA服务器
[H3C-object-policy-ip-OA服务器]rule 0 pass destination-ip OA服务器 service
8081端口
#创建安全策略,源安全域为Untrust目的安全域为Trust,应用创建的IPv4对象策略
[H3C]zone-pair security source Untrust destination Trust
[H3C-zone-pair-security-Untrust-Trust]object-policy apply ip OA服务器
[H3C-zone-pair-security-Untrust-Trust]quit
#创建IPv4对象策略,策略名称为互通,规则为允许
[H3C]object-policy ip 互通
[H3C-zone-pair-security-互通]rule pass
[H3C-zone-pair-security-互通]quit
#创建安全策略,源安全域为Trust目的安全域为Trust,放通内网到内部服务器的访问数据
[H3C]zone-pair security source Trust destination Trust
[H3C-zone-pair-security-Trust-Trust]object-policy apply ip 互通
[H3C-zone-pair-security-Trust-Trust]quit
[H3C]display cu | in security-policy
security-policy ip
创建安全策略并放通源安全域为Untrust目的安全域为Trust,放通外网访问OA服务器的8081端口策略;
#创建地址对象组,地址对象组名称为OA服务器
[H3C]object-group ip address OA服务器
[H3C-obj-grp-ip-OA服务器]network host address 192.168.1.88
[H3C-obj-grp-ip-OA服务器]quit
#创建服务对象组,服务对象组名称为8081端口,目的端口8081
[H3C]object-group service 8081端口
[H3C-obj-grp-service-8081端口]service tcp destination eq 8081
[H3C-obj-grp-service-8081端口]quit
创建安全策略并放通trust到trust和Untrust到trust的目的地址为OA服务器、目的端口为8081端口的安全策略。
[H3C]security-policy ip
[H3C-security-policy-ip]rule 10 name test
[H3C-security-policy-ip-10-test]action pass
[H3C-security-policy-ip-10-test]source-zone Untrust
[H3C-security-policy-ip-10-test]destination-zone Trust
[H3C-security-policy-ip-10-test]destination-ip OA服务器
[H3C-security-policy-ip-10-test]service 8081端口
[H3C-security-policy-ip-10-test]quit
[H3C-security-policy-ip]rule 20 name test
[H3C-security-policy-ip-20-test]action pass
[H3C-security-policy-ip-10-test]source-zone Trust
[H3C-security-policy-ip-10-test]destination-zone Trust
[H3C-security-policy-ip-10-test]quit
[H3C-security-policy-ip]quit
[H3C]save force
(0)
亲~登录后才可以操作哦!
确定你的邮箱还未认证,请认证邮箱或绑定手机后进行当前操作
举报
×
侵犯我的权益
×
侵犯了我企业的权益
×
抄袭了我的内容
×
原文链接或出处
诽谤我
×
对根叔社区有害的内容
×
不规范转载
×
举报说明
感谢,这个版本怎么和以前的配置不一样了,反而感觉很麻烦
安全策略有两套,选择其中一种就可以