实验拓扑

实验需求

1.配置内网通、公网通 

2.配置easy IP内网访问公网

3.内外网流量引流到防火墙

实验思路

1.配置vlan,vpn 实例 ,IP地址

2.配置ospf实现公内网通

3.配nat

实验步骤

1.配vlan 

[sw1]vlan 10
[sw1-vlan10]int g0/0/1    
[sw1-GigabitEthernet0/0/1]port link-type access 
[sw1-GigabitEthernet0/0/1]port default vlan 10
[sw1-GigabitEthernet0/0/1]int g0/0/2

[sw1-GigabitEthernet0/0/2]port link-type trunk 
[sw1-GigabitEthernet0/0/2]port trunk allow-pass vlan 10

[sw2]vlan 20

[sw2-vlan20]int g0/0/1

[sw2-GigabitEthernet0/0/1]port link-type access

[sw2-GigabitEthernet0/0/1]port de    
[sw2-GigabitEthernet0/0/1]port default vlan 20
[sw2-GigabitEthernet0/0/1]int g0/0/2  
[sw2-GigabitEthernet0/0/2]port link-type trunk 

[sw2-GigabitEthernet0/0/2]port trunk al    
[sw2-GigabitEthernet0/0/2]port trunk allow-pass vlan 20

[sw3]ip vpn-instance a
[sw3-vpn-instance-a]ip    
[sw3-vpn-instance-a]ipv4-family 
[sw3-vpn-instance-a-af-ipv4]route-distinguisher 1:1

[sw3]ip vpn-instance b
[sw3-vpn-instance-b]ip    
[sw3-vpn-instance-b]ipv4-family
[sw3-vpn-instance-b-af-ipv4]route-distinguisher 1:1
[sw3]ip vpn-instance c
[sw3-vpn-instance-c]ip    
[sw3-vpn-instance-c]ipv4-family 
[sw3-vpn-instance-c-af-ipv4]route-distinguisher 1:3
[sw3]vlan batch 10 20 30 40 60 70

[sw3]int g0/0/1
[sw3-GigabitEthernet0/0/1]port link-type trunk 
[sw3-GigabitEthernet0/0/1]port trunk allow-pass vlan 10
[sw3-GigabitEthernet0/0/2]port link-type trunk 
 [sw3-GigabitEthernet0/0/2]port trunk allow-pass vlan 20
[sw3-GigabitEthernet0/0/2]int g0/0/3 
[sw3-GigabitEthernet0/0/3]port link-type access  
[sw3-GigabitEthernet0/0/3]port default vlan 30

[sw3-GigabitEthernet0/0/7]port link-type access   
[sw3-GigabitEthernet0/0/7]port default vlan 70   
[sw3-GigabitEthernet0/0/7]int g0/0/6  
[sw3-GigabitEthernet0/0/6]port link-type access  
[sw3-GigabitEthernet0/0/6]port default vlan 60
[sw3-GigabitEthernet0/0/6]int g0/0/4
[sw3-GigabitEthernet0/0/4]port link-type access 
[sw3-GigabitEthernet0/0/4]port default vlan 40

2.vpn实例.ip地址
[sw3]int Vlanif 10   
[sw3-Vlanif10]ip binding vpn-instance a
Info: All IPv4 related configurations on this interface are removed!
Info: All IPv6 related configurations on this interface are removed!
[sw3-Vlanif10]ip ad    
[sw3-Vlanif10]ip address 192.168.1.254 24

[sw3-Vlanif60]ip binding vpn-instance a
Info: All IPv4 related configurations on this interface are removed!
Info: All IPv6 related configurations on this interface are removed!
[sw3-Vlanif60]ip address 192.168.6.1 24
[sw3-Vlanif20]ip binding vpn-instance b
Info: All IPv4 related configurations on this interface are removed!
Info: All IPv6 related configurations on this interface are removed!
[sw3-Vlanif20]ip ad    
[sw3-Vlanif20]ip address 192.168.2.254 24
[sw3-Vlanif20]int vlanif 70
[sw3-Vlanif70]ip binding vpn-instance b
Info: All IPv4 related configurations on this interface are removed!
Info: All IPv6 related configurations on this interface are removed!
[sw3-Vlanif70]ip ad    
[sw3-Vlanif70]ip addres 192.168.7.1 24    
[sw3-Vlanif40]ip binding vpn-instance c
Info: All IPv4 related configurations on this interface are removed!
Info: All IPv6 related configurations on this interface are removed!

[sw3-Vlanif40]ip address 192.168.4.1 24
[sw3-Vlanif30]ip binding vpn-instance c
Info: All IPv4 related configurations on this interface are removed!
Info: All IPv6 related configurations on this interface are removed!
[sw3-Vlanif30]ip address 192.168.3.1 24

[r3-GigabitEthernet0/0/0]ip address 192.168.4.2 24
[r3-GigabitEthernet0/0/0]int g0/0/1
[r3-GigabitEthernet0/0/1]ip ad    
[r3-GigabitEthernet0/0/1]ip address 100.1.1.1 24

[r2-GigabitEthernet0/0/0]ip address 100.1.1.2 24
[r2-LoopBack0]ip ad    
[r2-LoopBack0]ip address 2.2.2.2 32

[fw1-GigabitEthernet1/0/0]ip address 192.168.3.2 24
[fw1-GigabitEthernet1/0/0]int g1/0/2
[fw1-GigabitEthernet1/0/2]ip ad    
[fw1-GigabitEthernet1/0/2]ip address 192.168.7.2 24
[fw1-GigabitEthernet1/0/2]int g1/0/1
[fw1-GigabitEthernet1/0/1]ip ad    
[fw1-GigabitEthernet1/0/1]ip address 192.168.6.2 24
[fw1]firewall zone trust 
[fw1-zone-trust]ad    
[fw1-zone-trust]add int g1/0/0
[fw1-zone-trust]add int g1/0/2
[fw1-zone-trust]add int g1/0/1

3.配置ospf实现公内网通

[r3]ip route-static 0.0.0.0 0 100.1.1.2

[sw3]ospf 1 router-id 1.1.1.1 vpn-instance a    
[sw3-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255
[sw3-ospf-1-area-0.0.0.0]ne    
[sw3-ospf-1-area-0.0.0.0]network 192.168.6.0 0.0.0.255

[sw3]ospf 2 router-id 2.2.2.2 vpn-instance b

[sw3-ospf-2]a 0   
[sw3-ospf-2-area-0.0.0.0]network 192.168.2.0 0.0.0.255
[sw3-ospf-2-area-0.0.0.0]ne    
[sw3-ospf-2-area-0.0.0.0]network 192.168.7.0 0.0.0.255    
[sw3]ospf 3 router-id 3.3.3.3 v    
[sw3]ospf 3 router-id 3.3.3.3 vpn-instance c
[sw3-ospf-3]a 0
[sw3-ospf-3-area-0.0.0.0]ne    
[sw3-ospf-3-area-0.0.0.0]network 192.168.3.0 0.0.0.255
[sw3-ospf-3-area-0.0.0.0]ne    
[sw3-ospf-3-area-0.0.0.0]network 192.168.4.0 0.0.0.255

[r3]ospf 1 router-id 4.4.4.4
[r3-ospf-1]a 0
[r3-ospf-1-area-0.0.0.0]ne    
[r3-ospf-1-area-0.0.0.0]network 192.168.4.0 0.0.0.255

[fw1]ospf 1 router-id 5.5.5.5
[fw1-ospf-1]a 0
[fw1-ospf-1-area-0.0.0.0]ne    
[fw1-ospf-1-area-0.0.0.0]network 192.168.3.0 0.0.0.255

[fw1-ospf-1-area-0.0.0.0]network 192.168.7.0 0.0.0.255

[fw1-ospf-1-area-0.0.0.0]network 192.168.6.0 0.0.0.255

4.下发缺省,配nat

[r3-ospf-1]default-route-advertise always 

[r3]acl 2000
[r3-acl-basic-2000]ru    
[r3-acl-basic-2000]rule p    
[r3-acl-basic-2000]rule permit so    
[r3-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255
[r3-acl-basic-2000]ru    
[r3-acl-basic-2000]rule p    
[r3-acl-basic-2000]rule permit so    
[r3-acl-basic-2000]rule permit source 192.168.2.0 0.0.0.255
[r3-acl-basic-2000]q
[r3]int g0/0/1
[r3-GigabitEthernet0/0/1]na    
[r3-GigabitEthernet0/0/1]nat o    
[r3-GigabitEthernet0/0/1]nat outbound 2000

Logo

DAMO开发者矩阵,由阿里巴巴达摩院和中国互联网协会联合发起,致力于探讨最前沿的技术趋势与应用成果,搭建高质量的交流与分享平台,推动技术创新与产业应用链接,围绕“人工智能与新型计算”构建开放共享的开发者生态。

更多推荐