总公司和分公司之间使用MPLS建立VPN连接,互相访问。出于敏感数据安全性考虑,需要使用IPSEC技术加密隧道。
IP地址及vlan规划如下:
分公司运行协议如下:
L2:S1/S2设备建立eth-trunk 接口 使用LACP协议自动协商,端口类型为trunk,允许所有vlan通过
交换机配置vlan 10 20 100 101
Vlan10 是PC1所在办公区1的VLAN
VLAN20是client所在办公区2的vlan
各交换机之间使用trunk连接,允许所有vlan通过
L3:S1是vlan10的网关,S2是vlan20的网关
分公司内部网络使用OSPF协议,在区域0中宣告路由,互通
S1/S2使用access与路由器连接
ISP内部地址规划已经列出,主机地址为各设备编号。如pe1—p :
10.0.23.2/24----10.0.23.4/24
CE侧地址规划如:
pe1—ce1: 192.168.1.2/24----192.168.1.1/24
pe2—ce2: 172.16.1.1/24----172.16.1.2/24
ISP内部ISIS协议,区域ID为:49.0001 只建立L2邻居
总公司路由规划:
Ce2----服务器:172.16.2.254/24----172.16.2.1/24
一, MPLS VPN部分
ISP路由器运行MPLS/LDP协议,使用lo0接口建立MP-BGP peer。
PE1/CE1之间使用OSPF协议,PE2/CE2之间使用isis协议:49.0002
在PE上配置VPN实例a。由于两个站点同属一家公司,所有RD规划相同,都为100:1
RT出入都为100:1
分配相应接口进VPN实例
二, ipsec分
出于加密需要,在两台CE上配置ipsec协议,加密敏感数据
Ike使用pre-share 预共享密钥:huawei@123
Remote-address 使用物理接口地址。
安全提议中用的加密/认证算法均为列表中第二个(?回车查看),务必要求两台设备配置一致
使用esp协议,加密client1 使用FTP协议访问服务器,加密认证(21)和数据(20)端口。
使用ACL3000 引流进ipsec隧道
三, 验证
配置完成后务必在用户模式下输入save 命令保存配置,交换机输入后按两次回车键,以确保保存成功。
分公司网络验证:PC1 ping 通 client1
MPLS-VPN验证:PC1/CLIENT1 正常访问服务器
Ipsec验证: client1使用FTP访问服务器,抓包查看加密数据,
分公司的基础配置
分公司的基础配置,vlan创建、划分trunk和access,链路聚合,三层IP地址
SW3上
[Huawei]sysname SW3
[SW3]vlan batch 10 20
[SW3]int e0/0/1
[SW3-Ethernet0/0/1]port link-type access
[SW3-Ethernet0/0/1]port default vlan 10
[SW3-Ethernet0/0/1]q
[SW3]port-group group-member g0/0/1 to g0/0/2
[SW3-GigabitEthernet0/0/2]port link-type trunk
[SW3-port-group]port trunk allow-pass vlan all
SW4上
[Huawei]sysname SW4
[SW4]int e0/0/1
[SW4]vlan 10 20
[SW4-Ethernet0/0/1]port link-type access
[SW4-Ethernet0/0/1]port default vlan 20
[SW4]port-group group-member g0/0/1 to g0/0/2
[SW4-port-group]port link-type trunk
[SW4-port-group]port trunk allow-pass vlan all
SW1上
[SW1]vlan batch 10 20 100
[SW1]int vlan 10
[SW1-Vlanif10]ip add 192.168.10.254 24
[SW1-Vlanif10]int vlan 100
[SW1-Vlanif100]ip add 10.0.100.2 24
[SW1-Vlanif100]q
[SW1]port-group group-member g0/0/5 to g0/0/6
[SW1-port-group]port link-type trunk
[SW1-port-group]port trunk allow-pass vlan all
[SW1]int g0/0/7
[SW1-GigabitEthernet0/0/7]port link-type access
[SW1-GigabitEthernet0/0/7]port default vlan 100
[SW1-GigabitEthernet0/0/7]q
[SW1]int Eth-Trunk 1
[SW1-Eth-Trunk1]mode lacp-static
[SW1-Eth-Trunk1]trunkport GigabitEthernet 0/0/1 to 0/0/4
[SW1-Eth-Trunk1]port link-type trunk
[SW1-Eth-Trunk1]port trunk allow-pass vlan all
SW2上
<Huawei>sys
[Huawei]sysname SW2
[SW2]int vlan 20
[SW2-Vlanif20]ip add 192.168.20.254 24
[SW2-Vlanif20]int vlan 101
[SW2-Vlanif101]ip add 10.0.101.2 24
[SW2-Vlanif101]q
[SW2]port-group group-member g0/0/5 to g0/0/6
[SW2-port-group]port link-type trunk
[SW2-port-group]port trunk allow-pass vlan all
[SW2]int g0/0/7
[SW2-GigabitEthernet0/0/7]port link-type access
[SW2-GigabitEthernet0/0/7]port default vlan 101
[SW2-GigabitEthernet0/0/7]q
[SW1]int Eth-Trunk 1
[SW1-Eth-Trunk1]mode lacp-static
[SW1-Eth-Trunk1]trunkport GigabitEthernet 0/0/1 to 0/0/4
[SW1-Eth-Trunk1]port link-type trunk
[SW1-Eth-Trunk1]port trunk allow-pass vlan all
分公司的路由配置,OSPF等
SW1上配置OSPF
[SW1]ospf 1
[SW1-ospf-1]area 0
[SW1-ospf-1-area-0.0.0.0]network 192.168.10.0 0.0.0.255
[SW1-ospf-1-area-0.0.0.0]network 10.0.100.0 0.0.0.255
[SW1-ospf-1-area-0.0.0.0]q
[SW1-ospf-1]q
SW2上配置OSPF
[SW2]ospf 1
[SW2-ospf-1]area 0
[SW2-ospf-1-area-0.0.0.0]network 192.168.20.0 0.0.0.255
[SW2-ospf-1-area-0.0.0.0]network 10.0.101.0 0.0.0.255
ce1上配置IP地址以及OSPF
[ce1]int g0/0/1
[ce1-GigabitEthernet0/0/1]ip add 10.0.100.1 24
[ce1-GigabitEthernet0/0/1]
[ce1-GigabitEthernet0/0/1]int g0/0/2
[ce1-GigabitEthernet0/0/2]ip add 10.0.101.1 24
[ce1-GigabitEthernet0/0/2]int g0/0/0
[ce1-GigabitEthernet0/0/0]ip add 192.168.1.1 24
[ce1-GigabitEthernet0/0/0]q
[ce1]ospf 1
[ce1-ospf-1]area 0
[ce1-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255
[ce1-ospf-1-area-0.0.0.0]network 10.0.100.0 0.0.0.255
[ce1-ospf-1-area-0.0.0.0]network 10.0.101.0 0.0.0.255
分公司网络验证:PC1 ping 通 client1
总部的基础配置
ce2上配置IP地址,IS-IS的配置
<Huawei>sys
[Huawei]sysname ce2
[ce2]int g0/0/0
[ce2-GigabitEthernet0/0/0]ip add 172.16.1.2 24
[ce2-GigabitEthernet0/0/0]q
[ce2]isis 2
[ce2-isis-1]is-level level-2
[ce2-isis-1]network-entity 49.0002.0000.0000.0001.00
[ce2-isis-1]q
[ce2]int g0/0/0
[ce2-GigabitEthernet0/0/0]isis enable 2
[ce2-GigabitEthernet0/0/0]q
[ce2-GigabitEthernet0/0/1]isis enable 2
ISP内的配置
基础IP地址配置
pe1上
<Huawei>sys
[Huawei]sysname pe1
[pe1]int lo0
[pe1-LoopBack0]ip add 10.0.1.1 32
[pe1-LoopBack0]int g0/0/0
[pe1-GigabitEthernet0/0/0]ip add 10.0.23.1 24
[pe1-GigabitEthernet0/0/0]q
p上
<Huawei>sys
[Huawei]sysname p
[p]int lo0
[p-LoopBack0]ip add 10.0.2.2 32
[p-LoopBack0]int g0/0/0
[p-GigabitEthernet0/0/0]ip add 10.0.23.2 24
[p-GigabitEthernet0/0/0]int g0/0/1
[p-GigabitEthernet0/0/1]ip add 10.0.34.2 24
pe2上
<Huawei>sys
[Huawei]sysname pe2
[pe2]int lo0
[pe2-LoopBack0]ip add 10.0.3.3 32
[pe2]int g0/0/0
[pe2-GigabitEthernet0/0/0]ip add 10.0.34.3 24
ISP内配置IS-IS
pe1上
[pe1]isis 1
[pe1-isis-1]is-level level-2
[pe1-isis-1]network-entity 49.0001.0000.0000.0001.00
[pe1]int lo0
[pe1-LoopBack0]isis enable
[pe1-LoopBack0]int g0/0/0
p上
[p]isis 1
[p-isis-1]is-level level-2
[p-isis-1]network-entity 49.0001.0000.0000.0002.00
[p-isis-1]q
[p]int lo0
[p-LoopBack0]isis enable
[p-LoopBack0]int g0/0/0
[p-GigabitEthernet0/0/0]isis enable
[p-GigabitEthernet0/0/0]int g0/0/1
[p-GigabitEthernet0/0/1]isis en
[p-GigabitEthernet0/0/1]isis enable
[p-GigabitEthernet0/0/1]q
pe2上
[pe2]isis 1
[pe2-isis-1]is-level level-2
[pe2-isis-1]network-entity 49.0001.0000.0000.0003.00
[pe2-isis-1]q
[pe2]int lo0
[pe2-LoopBack0]isis en
[pe2-LoopBack0]isis enable
[pe2-LoopBack0]int g0/0/0
[pe2-GigabitEthernet0/0/0]isis enable
MPLS VPN的配置
mpls ldp的配置
pe1上
[pe1]mpls lsr-id 10.0.1.1
[pe1]mpls
[pe1-mpls]q
[pe1]mpls ldp
[pe1-mpls-ldp]q
[pe1]int g0/0/0
[pe1-GigabitEthernet0/0/0]mpls
[pe1-GigabitEthernet0/0/0]mpls ldp
[pe1-GigabitEthernet0/0/0]q
p上
[p]mpls lsr-id 10.0.2.2
[p]mpls
[p-mpls]q
[p]mpls ldp
[p-mpls-ldp]q
[p]int g0/0/0
[p-GigabitEthernet0/0/0]mpls
[p-GigabitEthernet0/0/0]mpls ldp
[p-GigabitEthernet0/0/0]int g0/0/1
[p-GigabitEthernet0/0/1]mpls
[p-GigabitEthernet0/0/1]mpls ldp
[p-GigabitEthernet0/0/1]q
pe2上
[pe2]mpls lsr-id 10.0.3.3
[pe2]mpls
[pe2-mpls]q
[pe2]mpls ldp
[pe2-mpls-ldp]q
[pe2]int g0/0/0
[pe2-GigabitEthernet0/0/0]mpls
[pe2-GigabitEthernet0/0/0]mpls ldp
[pe2-GigabitEthernet0/0/0]q
配置VRF
创建VRF,并分配 RD
pe1上
[pe1]ip vpn-instance a
[pe1-vpn-instance-a]rou
[pe1-vpn-instance-a]route-distinguisher 100:1
[pe1-vpn-instance-a-af-ipv4]vpn-target 100:1 both
pe2上
[pe2]ip vpn-instance a
[pe2-vpn-instance-a]route-distinguisher 100:1
[pe2-vpn-instance-a-af-ipv4]vpn-target 100:1 both
将接口绑定到VRF
pe1上
[pe1]int g0/0/1
[pe1-GigabitEthernet0/0/1]ip binding vpn-instance a
[pe1-GigabitEthernet0/0/1]ip add 192.168.1.2 24
pe2上
[pe2]int g0/0/1
[pe2-GigabitEthernet0/0/1]ip binding vpn-instance a
[pe2-GigabitEthernet0/0/1]ip add 172.16.1.1 24
配置pe-ce的专有网络
pe1上
[pe1]ospf 1 vpn-instance a
[pe1-ospf-1]area 0
[pe1-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255
[pe1-ospf-1-area-0.0.0.0]q
[pe1-ospf-1]q
pe2上
[pe2]isis 2 vpn-instance a
[pe2-isis-2]is-level level-2
[pe2-isis-2]network-entity 49.0002.0000.0000.0002.00
[pe2-isis-2]q
[pe2]int g0/0/1
[pe2-GigabitEthernet0/0/1]isis enable 2
配置BGP
pe1上
[pe1]bgp 100
[pe1-bgp]peer 10.0.3.3 as-number 100
[pe1-bgp]peer 10.0.3.3 connect-interface lo0
pe2上
[pe2]bgp 100
[pe2-bgp]peer 10.0.1.1 as-number 100
[pe2-bgp]peer 10.0.1.1 connect-interface lo0
配置VPNV4的BGP
将bgp的邻居加入到vpnv_bgp的邻居
pe1上
[pe1-bgp]ipv4-family vpnv4
[pe1-bgp-af-vpnv4]peer 10.0.3.3 enable
pe2上
[pe2-bgp]ipv4-family vpnv4
[pe2-bgp-af-vpnv4]peer 10.0.1.1 enable
IGP与BGP的双向路由引入
pe1上
[pe1]bgp 100
[pe1-bgp]ipv4-family vpn-instance a
[pe1-bgp-a]import-route ospf 1
[pe1-bgp-a]q
[pe1-bgp]q
[pe1]ospf 1
[pe1-ospf-1]import-route bgp
pe2上
[pe2]bgp 100
[pe2-bgp]ipv4-family vpn-instance a
[pe2-bgp-a]import-route isis 2
[pe2-bgp-a]q
[pe2-bgp]q
[pe2]isis 2
[pe2-isis-2]import-route bgp
MPLS-VPN验证:PC1/CLIENT1 正常访问服务器
IPSec VPN的配置
创建IPSec的ACL感兴趣流
ce1上
[ce1]acl 3000
[ce1-acl-adv-3000]rule permit tcp source 192.168.20.0 0.0.0.255 destination 172.16.2.0 0.0.0.255 destination-port eq 20
[ce1-acl-adv-3000]rule permit tcp source 192.168.20.0 0.0.0.255 destination 172.16.2.0 0.0.0.255 destination-port eq 21
ce2上
[ce2]acl 3000
[ce2-acl-adv-3000]rule permit tcp source 172.16.2.0 0.0.0.255 destination 192.168.20.0 0.0.0.255
配置IPSec的第一阶段
配置IKE提案/IKE SA
ce1上
[ce1]ike proposal 1
[ce1-ike-proposal-1]authentication-algorithm md5
[ce1-ike-proposal-1]authentication-method pre-share
[ce1-ike-proposal-1]encryption-algorithm aes-cbc-128
ce2上
[ce2]ike proposal 1
[ce2-ike-proposal-1]authentication-algorithm md5
[ce2-ike-proposal-1]authentication-method pre-share
[ce2-ike-proposal-1]encryption-algorithm aes-cbc-128
配置IKE邻居
ce1上
[ce1]ike peer 1 v2
[ce1-ike-peer-1]ike-proposal 1
[ce1-ike-peer-1]pre-shared-key simple huawei@123
[ce1-ike-peer-1]remote-address 172.16.1.2
ce2上
[ce2]ike peer 1 v2
[ce2-ike-peer-1]ike-proposal 1
[ce2-ike-peer-1]pre-shared-key simple huawei@123
[ce2-ike-peer-1]remote-address 192.168.1.1
配置IPSec提案/IPSec SA
ce1上
[ce1]ipsec proposal 1
[ce1-ipsec-proposal-1]esp authentication-algorithm sha1
[ce1-ipsec-proposal-1]esp encryption-algorithm aes-128
ce2上
[ce2]ipsec proposal 1
[ce2-ipsec-proposal-1]esp encryption-algorithm aes-128
[ce2-ipsec-proposal-1]esp authentication-algorithm sha1
配置IPSec策略
ce1上
[ce1]ipsec policy 1 1 isakmp
[ce1-ipsec-policy-isakmp-1-1]proposal 1
[ce1-ipsec-policy-isakmp-1-1]ike-peer 1
[ce1-ipsec-policy-isakmp-1-1]security acl 3000
ce2上
[ce2]ipsec policy 1 1 isakmp
[ce2-ipsec-policy-isakmp-1-1]proposal 1
[ce2-ipsec-policy-isakmp-1-1]ike-peer 1
[ce2-ipsec-policy-isakmp-1-1]security acl 3000
将IPSec策略应用到接口上
ce1上
[ce1]int g0/0/0
[ce1-GigabitEthernet0/0/0]ipsec policy 1
ce2上
[ce2]int g0/0/0
[ce2-GigabitEthernet0/0/0]ipsec policy 1
Ipsec验证: client1使用FTP访问服务器,抓包查看加密数据