网络安全d
4.1.4网络安全
业务需求:SOHO办公和出差员工需要方便、快捷、安全地访问总公司内网服务器群。
技术选型:采用 L2TP over IPsec 远程接入VPN。
L2TP:提供隧道封装,支持多协议传输
优势:Windows/macOS 自带客户端,无需安装额外软件
核心:VPN技术选择L2TP over IPsec
远程接入VPN
1.VPN 在 ISP 路由器上的基础配置
ISP> enable
ISP# configure terminal
1. 创建本地用户(去掉 service-type ppp)
ISP(config)# username vpnuser password 0 Cics0123
2. 配置 ISAKMP 策略
ISP(config)# crypto isakmp policy 10
ISP(config-isakmp)# encr 3des
ISP(config-isakmp)# hash md5
ISP(config-isakmp)# authentication pre-share
ISP(config-isakmp)# group 2
ISP(config-isakmp)# exit
s
3. 配置预共享密钥
ISP(config)# crypto isakmp key vpnkey address 0.0.0.0 0.0.0.0
4. 配置 IPsec 转换集
ISP(config)# crypto ipsec transform-set VPN-SET esp-des esp-md5-hmac
5. 配置动态加密映射
ISP(config)# crypto dynamic-map DYNMAP 10
ISP(config-crypto-map)# set transform-set VPN-SET
ISP(config-crypto-map)# exit
6. 配置静态加密映射
ISP(config)# crypto map VPNMAP 10 ipsec-isakmp dynamic DYNMAP
-
- 配置 VPDN
ISP(config)# vpdn enable
ISP(config)# vpdn-group L2TP
ISP(config-vpdn)# accept-dialin
ISP(config-vpdn-acc-in)# protocol l2tp
ISP(config-vpdn-acc-in)# virtual-template 1
ISP(config-vpdn-acc-in)# terminate-from hostname any
ISP(config-vpdn-acc-in)# exit
ISP(config-vpdn)# local name ISP
ISP(config-vpdn)# exit
8. 配置虚拟模板接口
ISP(config)# vpdn enable
ISP(config)# vpdn-group PPTP
ISP(config-vpdn)# accept-dialin
ISP(config-vpdn-acc-in)# protocol pptp
ISP(config-vpdn-acc-in)# virtual-template 1 ! 这个还是需要,但有的版本可以不用
ISP(config-vpdn-acc-in)# exit
ISP(config-vpdn)# local name ISP
ISP(config-vpdn)# exit
9. 配置 IP 地址池
ISP(config)# ip local pool VPNPOOL 192.168.100.1 192.168.100.254
10. 应用到公网接口(假设是 Serial4/0)
ISP(config)# interface Serial4/0
ISP(config-if)# crypto map VPNMAP
ISP(config-if)# end
11. 保存配置
ISP# write memory
- 配置 Loopback0 接口(Virtual-Template 引用了它)
ISP(config)# interface Loopback0
ISP(config-if)# ip address 10.0.0.1 255.255.255.255
ISP(config-if)# exit
- 配置 NAT豁免(让 VPN 流量不被 NAT 转换)
创建 ACL 标识 VPN 流量(定义 VPN 地址池)
ISP(config)# access-list 101 deny ip 192.168.100.0 0.0.0.255 any
ISP(config)# access-list 101 permit ip any any
! 应用到 NAT 配置
ISP(config)# interface Serial4/0
ISP(config-if)# ip nat outside
ISP(config-if)# exit
ISP(config)# interface Virtual-Template1
ISP(config-if)# ip nat inside
ISP(config-if)# exit
- 配置路由(让 VPN 客户端能访问内网)
先在SC1上配置回程路由:
SC1> enable
SC1# configure terminal
SC1(config)# ip route 192.168.100.0 255.255.255.0 10.0.1.2
SC1(config)# exit
SC1# write memory
然后在ISP路由器上检查并补充配置:
ISP> enable
ISP# configure terminal
! 配置 Loopback0(Virtual-Template 需要)
ISP(config)# interface Loopback0
ISP(config-if)# ip address 10.0.0.1 255.255.255.255
ISP(config-if)# exit
! 确保路由指向内网
ISP(config)# ip route 192.168.0.0 255.255.0.0 10.0.1.1
ISP(config)# end
ISP# write memory
- 验证 VPN 是否可连接(模拟测试)
在ISP路由器上查看VPN连接状态
ISP# show vpdn session
ISP# show vpdn tunnel
ISP# show crypto session
检查VPN地址池分配情况
ISP# show ip local pool
Debug调试
ISP# debug crypto isakmp
ISP# debug crypto ipsec
ISP# undebug all ! 测试完成后关闭调试
- 配置内网回程路由
在SC1上配置回程路由
SC1> enable
SC1# configure terminal
SC1(config)# ip route 192.168.100.0 255.255.255.0 10.0.1.2
SC1(config)# end
SC1# write memory
检验SC1# show ip route | include 192.168.100.0,
成功返回S 192.168.100.0/24 [1/0] via 10.0.1.2
在ISP路由器上配置指向内网的路由
ISP> enable
ISP# configure terminal
ISP(config)# ip route 192.168.0.0 255.255.0.0 10.0.1.1
ISP(config)# end
ISP# write memory
检验ISP# show ip route | include 192.168
成功返回S 192.168.0.0/16 [1/0] via 10.0.1.1

DHCP Snooping 配置
全局启用 DHCP Snooping
SA1> enable
SA1# configure terminal
1. 全局启用 DHCP Snooping
SA1(config)# ip dhcp snooping
2. 为 VLAN 10,20,30,40 启用(用逗号分隔)
SA1(config)# ip dhcp snooping vlan 10,20,30,40
3. 配置上行接口(连接 SC1)为信任端口
SA1(config)# interface GigabitEthernet0/1
SA1(config-if)# ip dhcp snooping trust
SA1(config-if)# exit
4. (可选)对终端接口启用速率限制
SA1(config)# interface range GigabitEthernet0/2 - 24
SA1(config-if-range)# ip dhcp snooping limit rate 10
SA1(config-if-range)# exit
5. 保存配置
SA1(config)# end
SA1# write memory
检验DHCP Snooping(SA1# show ip dhcp snooping)
成功返回

然后交换机配置
SAS> enable
SAS# configure terminal
SAS(config)# ip dhcp snooping
SAS(config)# ip dhcp snooping vlan 10,20,30,40
SAS(config)# interface GigabitEthernet0/1
SAS(config-if)# ip dhcp snooping trust
SAS(config-if)# end
SAS# write memory
DAMO开发者矩阵,由阿里巴巴达摩院和中国互联网协会联合发起,致力于探讨最前沿的技术趋势与应用成果,搭建高质量的交流与分享平台,推动技术创新与产业应用链接,围绕“人工智能与新型计算”构建开放共享的开发者生态。
更多推荐


所有评论(0)