hcip 三层架构

hcip 三层架构_第1张图片

配IP

[r1]int g0/0/2
[r1-GigabitEthernet0/0/2]ip add 12.1.1.1 24
[r1-GigabitEthernet0/0/2]int g0/0/0
[r1-GigabitEthernet0/0/0]ip add 23.1.1.1 24
[r1-GigabitEthernet0/0/0]int g0/0/1
[r1-GigabitEthernet0/0/1]ip add 34.1.1.1 24
[r1]int LoopBack 0
[r1-LoopBack0]ip add 1.1.1.1 32


[r2]int g0/0/0
[r2-GigabitEthernet0/0/0]ip add 12.1.1.2 24
[r2]int LoopBack 0
[r2-LoopBack0]ip add 2.2.2.2 32

划分vlan

[SW1]interface Vlanif 1
[SW1-Vlanif1]ip add 23.1.1.2 24

[SW2]interface Vlanif 1
[SW2-Vlanif1]ip add 34.1.1.2 24

[SW1]interface Eth-Trunk 1
[SW1-Eth-Trunk1]q
[SW1]int g0/0/2
[SW1-GigabitEthernet0/0/2]eth-trunk 1
[SW1]int g0/0/3
[SW1-GigabitEthernet0/0/3]eth-trunk 1
[SW1]int g0/0/7
[SW1-GigabitEthernet0/0/3]eth-trunk 1
[SW1]interface Eth-Trunk 1    
[SW1-Eth-Trunk1]port link-type trunk 
[SW1-Eth-Trunk1]port trunk allow-pass vlan all 

[SW2]interface Eth-Trunk 1
[SW2-Eth-Trunk1]q
[SW2]int g0/0/2
[SW2-GigabitEthernet0/0/2]eth-trunk 1
[SW2-GigabitEthernet0/0/2]int g0/0/3
[SW2-GigabitEthernet0/0/3]eth-trunk 1
[SW2-GigabitEthernet0/0/3]int g0/0/7
[SW2-GigabitEthernet0/0/7]eth-trunk 1
[SW2]interface Eth-Trunk 1
[SW2-Eth-Trunk1]port link-type trunk 
[SW2-Eth-Trunk1]port trunk allow-pass vlan all 

[SW1]interface g0/0/4    
[SW1-GigabitEthernet0/0/4]port link-type access 
[SW1-GigabitEthernet0/0/4]port default vlan 2
[SW3]vlan 2
[SW3-vlan2]q
[SW3]port-group 1
[SW3-port-group-1]group-member e0/0/1 to e0/0/4
[SW3-port-group-1]port link-type access     
[SW3-port-group-1]port default vlan 2

[SW1]interface g0/0/5
[SW1-GigabitEthernet0/0/5]port link-type access 
[SW1-GigabitEthernet0/0/5]port default vlan 3
[SW4]vlan 3
[SW4-vlan3]q
[SW4]port-group 1
[SW4-port-group-1]group-member e0/0/1 to e0/0/4
[SW4-port-group-1]port link-type access     
[SW4-port-group-1]port default vlan 3

[SW1]interface g0/0/6
[SW1-GigabitEthernet0/0/6]port link-type trunk 
[SW1-GigabitEthernet0/0/6]port trunk allow-pass vlan all 
[SW5]interface e0/0/1    
[SW5-Ethernet0/0/1]port link-type access 
[SW5-Ethernet0/0/1]port link-type trunk 
[SW5-Ethernet0/0/1]port trunk allow-pass vlan all
[SW5-Ethernet0/0/1]int e0/0/2
[SW5-Ethernet0/0/2]port link-type trunk     
[SW5-Ethernet0/0/2]port trunk allow-pass vlan all
[SW5-Ethernet0/0/2]int e0/0/3
[SW5-Ethernet0/0/3]port link-type access 
[SW5-Ethernet0/0/3]port default vlan 2
[SW5-Ethernet0/0/3]int e0/0/4
[SW5-Ethernet0/0/4]port link-type access 
[SW5-Ethernet0/0/4]port default vlan 3

[SW1]stp mode mstp
[SW1]stp region-configuration 
[SW1-mst-region]region-name a
[SW1-mst-region]instance 1 vlan 2
[SW1-mst-region]instance 2 vlan 3
[SW1-mst-region]active region-configuration 
[SW1]stp instance 1 root primary 
[SW1]stp instance 2 root secondary 

[SW2]stp mode mstp
[SW2]stp region-configuration 
[SW2-mst-region]region-name a
[SW2-mst-region]instance 1 vlan 2
[SW2-mst-region]instance 2 vlan 3
[SW2-mst-region]active region-configuration 
[SW2]stp instance 1 root secondary 
[SW2]stp instance 2 root primary 

[r1]ospf 1 router-id 1.1.1.1
[r1-ospf-1]area 0
[r1-ospf-1-area-0.0.0.0]network 34.1.1.1 0.0.0.0    
[r1-ospf-1-area-0.0.0.0]network 1.1.1.1 0.0.0.0
[r1-ospf-1]default-route-advertise
[r1]ip route-static 0.0.0.0 0 12.1.1.2

[SW1]ospf 1 router-id 2.2.2.2
[SW1-ospf-1]area 0
[SW1-ospf-1-area-0.0.0.0]network 0.0.0.0 255.255.255.255

[SW2]ospf 1 router-id 3.3.3.3
[SW2-ospf-1]area 0
[SW2-ospf-1-area-0.0.0.0]network 0.0.0.0 255.255.255.255

[SW1]interface Vlanif 2
[SW1-Vlanif2]ip address 192.168.1.1 24
[SW1]interface Vlanif 3
[SW1-Vlanif2]ip address 172.16.1.1 24

[r1]ospf 1 router-id 1.1.1.1
[r1-ospf-1]area 0
[r1-ospf-1-area-0.0.0.0]network 34.1.1.1 0.0.0.0    
[r1-ospf-1-area-0.0.0.0]network 1.1.1.1 0.0.0.0
[r1-ospf-1]default-route-advertise
[r1]ip route-static 0.0.0.0 0 12.1.1.2

[SW1]interface Vlanif 2    
[SW1-Vlanif2]vrrp vrid 1 virtual-ip 192.168.1.1
[SW1-Vlanif2]ip address 192.168.1.1 24
[SW1-Vlanif2]vrrp vrid 1 priority 120    
[SW1-Vlanif2]vrrp vrid 1 preempt-mode timer delay 20
[SW1]interface Vlanif 3
[SW1-Vlanif3]vrrp vrid 2 virtual-ip 172.16.1.2

[SW2]interface Vlanif 2
[SW2-Vlanif2]vrrp vrid 1 virtual-ip 192.168.1.1
[SW2]interface Vlanif 3
[SW2-Vlanif3]vrrp vrid 2 virtual-ip 172.16.1.2
[SW2-Vlanif3]vrrp vrid 2 priority 120
[SW2-Vlanif3]vrrp vrid 2 preempt-mode timer delay 20

[SW1]ip pool 1
[SW1-ip-pool-1]network 192.168.1.0 mask 24    
[SW1-ip-pool-1]gateway-list 192.168.1.1
[SW1-ip-pool-1]dns-list 8.8.8.8
[SW1]interface Vlanif 2
[SW1-Vlanif2]dhcp select global 
[SW1]ip pool 2
[SW1-ip-pool-2]network 172.16.1.0 mask 24
[SW1-ip-pool-2]gateway-list 172.16.1.2
[SW1-ip-pool-2]dns-list 8.8.8.8    
[SW1]interface Vlanif 3    
[SW1-Vlanif3]dhcp select global 

[SW2]ip pool 1
[SW2-ip-pool-1]network 192.168.1.0 mask 24
[SW2-ip-pool-1]gateway-list 192.168.1.1
[SW2-ip-pool-1]dns-list 8.8.8.8
[SW2]interface Vlanif 2
[SW2-Vlanif2]dhcp select global 
[SW2]ip pool 3
[SW2-ip-pool-3]network 172.16.1.0 mask 24    
[SW2-ip-pool-3]gateway-list 172.16.1.2
[SW2-ip-pool-3]dns-list 8.8.8.8
[SW2]interface Vlanif 3
[SW2-Vlanif3]dhcp select global 

[r1]acl 2000    
[r1-acl-basic-2000]rule permit source any 
[r1]interface g0/0/2
[r1-GigabitEthernet0/0/2]nat outbound 2000

你可能感兴趣的:(网络,服务器,运维)