[办公软件]
【×××系列十】关于如何处理混合环境下PPTP-×××流量的思考与处置
电脑办公
发布于:2021-06-24 13:10
|
阅读数:633
|
评论:0
【×××系列十】关于如何处理混合环境下PPTP-×××流量的思考与处置
其中主要涉及两点: 1. 两端路由器如何为pptp流量和其它流量,进行nat转换,保证通信正常2. 两端路由器配置的ZFW,如何放行pptp和其它通信转换后的流量,保证通信正常 ----------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------
在配置nat之前,pptp客户端拨号时配置的远端ip地址是172.18.10.1(pptp server 真实地址),但是配置为nat之后,需要更改为center router的外网口ip地址,也就是200.0.30.2;否者,pptp拨号链接无效。
关键命令:
ip nat inside source static tcp 172.18.10.1 1723 interface s1/0 1723 如图:
如要更改为200.0.10.2(center router 外网口地址)
如图:
拨号成功: <tr>
<td style="word-wrap: break-word" bgcolor="#fdfddf"><font color="#ff0000">
<span style="color: #000000"><strong>center.router#show ip nat translations<br />
</strong>Pro Inside global Inside local Outside local Outside global<br />
tcp 200.0.10.2:1723 172.18.10.1:1723 172.18.101.3:50126 172.18.101.3:50126<br />
tcp 200.0.10.2:1723 172.18.10.1:1723 172.18.101.3:50131 172.18.101.3:50131<br />
tcp 200.0.10.2:1723 172.18.10.1:1723 --- ---<br />
gre 200.0.10.2:3399 172.18.10.1:3399 172.18.101.3:3399 172.18.101.3:3399<br />
gre 200.0.10.2:64527 172.18.10.1:64527 172.18.101.3:64527 172.18.101.3:64527<br />
udp 200.0.10.2:50824 172.18.100.102:50824 221.228.255.1:53 221.228.255.1:53<br />
</span>
</font><span style="color: #000000"><br />
</span></td>
</tr>
</tbody>
<tr>
<td style="word-wrap: break-word" bgcolor="#fdfddf"><font color="#ff0000">
<span style="color: #000000"><strong>pptp.server#show vpdn</strong></span>
<span style="color: #000000">%No active L2TP tunnels</span>
<span style="color: #000000">PPTP Tunnel and Session Information Total tunnels 1 sessions 1</span>
<span style="color: #000000">LocID Remote Name State Remote Address Port Sessions VPDN Group<br />
21945 estabd 172.18.101.3 50131 1 1</span>
<span style="color: #000000">LocID RemID TunID Intf Username State Last Chg Uniq ID<br />
3399 64527 21945 Vi2.1 xuchen estabd 00:00:16 3<br />
</span>
</font><span style="color: #000000"><br />
</span></td>
</tr>
</tbody>
<tr>
<td style="word-wrap: break-word" bgcolor="#fdfddf"><font color="#ff0000">
<span style="color: #000000"><strong>spoke.router#show ip nat translations<br />
</strong>Pro Inside global Inside local Outside local Outside global<br />
gre 200.0.30.2:21210 172.18.101.3:21210 200.0.10.2:21210 200.0.10.2:21210<br />
gre 200.0.30.2:26907 172.18.101.3:26907 200.0.10.2:26907 200.0.10.2:26907<br />
tcp 200.0.30.2:50134 172.18.101.3:50134 200.0.10.2:1723 200.0.10.2:1723<br />
udp 200.0.30.2:55197 172.18.101.3:55197 221.228.255.1:53 221.228.255.1:53<br />
</span>
</font><span style="color: #000000"><br />
</span></td>
</tr>
</tbody>
可以看到nat转换了pptp相关的TCP 1723端口与GRE 流量,所以pptp能够正常通信
那么防火墙该如何放行流量呢,其实也是类似的过程,只要放行与pptp进程相关联的流量,那么配置就是成功的。
关键也就是TCP 1723 端口与GRE 流量
<tr>
<td style="word-wrap: break-word" bgcolor="#fdfddf"><span style="color: #000000"> ip access-list extended pptp<br />
permit gre any any<br />
permit tcp any any eq 1723<br />
</span></td>
</tr>
</tbody>
<tr>
<td style="word-wrap: break-word" bgcolor="#fdfddf"><span style="color: #000000"> class-map type inspect match-any in.out.class<br />
match protocol icmp<br />
match access-group name pptp.gre<br />
match protocol tcp<br />
match protocol udp<br />
class-map type inspect match-all out.in.class<br />
match access-group name pptp<br />
</span></td>
</tr>
</tbody>
<tr>
<td style="word-wrap: break-word" bgcolor="#fdfddf"><span style="color: #000000"> policy-map type inspect in.out.po<br />
class type inspect in.out.class<br />
pass<br />
class class-default<br />
drop<br />
policy-map type inspect out.in.po<br />
class type inspect out.in.class<br />
pass<br />
class class-default<br />
drop<br />
</span></td>
</tr>
</tbody>
流量穿越防火墙之后,如下结果:
<tr>
<td style="word-wrap: break-word" bgcolor="#fdfddf">
<font color="#ff0000"> </font><span style="color: #000000">center.router#show policy-map ty inspect zone-pair se</span>
<span style="color: #000000">policy exists on zp out.in.pair<br />
Zone-pair: out.in.pair</span>
<span style="color: #000000"> Service-policy inspect : out.in.po</span>
<span style="color: #000000"> Class-map: all.traffic.class (match-any)<br />
Match: protocol icmp<br />
0 packets, 0 bytes<br />
30 second rate 0 bps<br />
Match: protocol tcp<br />
1 packets, 32 bytes<br />
30 second rate 0 bps<br />
Match: protocol udp<br />
0 packets, 0 bytes<br />
30 second rate 0 bps</span>
<span style="color: #000000"> Inspect</span>
<span style="color: #000000"> Number of Established Sessions = 1<br />
Established Sessions<br />
Session 68A43F20 (200.0.30.2:50352)=>(172.18.10.1:1723) tcp SIS_OPEN/TCP_ESTAB<br />
Created 00:02:09, Last heard 00:00:08<br />
Bytes sent (initiator:responder) [408:224]</span>
<span style="color: #000000">
<br />
Class-map: pptp.class (match-all)<br />
Match: access-group name pptp<br />
Pass<br />
176 packets, 13735 bytes
</span><font color="#ff0000">
<span style="color: #000000"> Class-map: class-default (match-any)<br />
Match: any<br />
Drop<br />
0 packets, 0 bytes</span>
<span style="color: #000000">policy exists on zp in.out.pair<br />
Zone-pair: in.out.pair</span>
<span style="color: #000000"> Service-policy inspect : in.out.po</span>
<span style="color: #000000"> Class-map: all.traffic.class (match-any)<br />
Match: protocol icmp<br />
0 packets, 0 bytes<br />
30 second rate 0 bps<br />
Match: protocol tcp<br />
3 packets, 600 bytes<br />
30 second rate 0 bps<br />
Match: protocol udp<br />
0 packets, 0 bytes<br />
30 second rate 0 bps</span>
<span style="color: #000000"> Inspect</span>
<span style="color: #000000"> Class-map: pptp.class (match-all)<br />
Match: access-group name pptp<br />
Pass<br />
37 packets, 1977 bytes</span>
<span style="color: #000000"> Class-map: class-default (match-any)<br />
Match: any<br />
Drop<br />
0 packets, 0 bytes</span>
<span style="color: #000000">policy exists on zp out.self.pair<br />
Zone-pair: out.self.pair</span>
<span style="color: #000000"> Service-policy inspect : out.self.po</span>
<span style="color: #000000"> Class-map: out.access.class (match-all)<br />
Match: access-group name out.access<br />
Pass<br />
72 packets, 1592 bytes</span>
<span style="color: #000000"> Class-map: pptp.class (match-all)<br />
Match: access-group name pptp<br />
Pass<br />
0 packets, 0 bytes</span>
</font><span style="color: #000000"> Class-map: class-default (match-any)<br />
Match: any<br />
Drop<br />
5 packets, 400 bytes<br />
</span></td>
</tr>
</tbody>
上面可以看到pptp 客户端拨号成功之后,所建立的链接信息,zfw防火墙的配置,关键在于三个方向:
1.inside 路由器入站流量
2.outside 路由器出站流量
3.self 路由器自身流量
配置类(class-map)的时候需要考虑好,对应方向应该放行哪些流量。
配置策略(policy-map)的时候需要考虑好,对应哪些流量应该执行哪些动作(inspect、pass、drop)。
结语: 上面基本上就完整实现了,pptp服务端到客户端的流量转变过程,主要是放行tcp1723与GRE流量。还有就是zfw是基于端口配置的防火墙技术,最重要的是选好zone端口,确认哪些端口属于哪个zone,多个端口可以同属于一个zone;同一个zone内的端口不需要配置策略就能相互通信;属于不同zone的端口,默认是deny相互的所有流量,所以需要配置策略放行流量;不属于zone的端口,流量不受影响。所以说zfw是基于端口的防火墙策略,所以这一步相当重要。
免责声明:
1. 本站所有资源来自网络搜集或用户上传,仅作为参考不担保其准确性!
2. 本站内容仅供学习和交流使用,版权归原作者所有!© 查看更多
3. 如有内容侵害到您,请联系我们尽快删除,邮箱:kf@codeae.com