三层架构实验

三层架构实验_第1张图片
三层架构实验_第2张图片建立eth-trunk

[sw1]int Eth-Trunk 0
[sw1-Eth-Trunk0]int g0/0/2
[sw1-GigabitEthernet0/0/2]eth-trunk  0
[sw1-GigabitEthernet0/0/2]int g0/0/3
[sw1-GigabitEthernet0/0/3]eth-trunk 0


[sw2]int Eth-Trunk 0
[sw2-Eth-Trunk0]int g0/0/2
[sw2-GigabitEthernet0/0/2]eth-trunk 0
[sw2-GigabitEthernet0/0/2]int g0/0/3
[sw2-GigabitEthernet0/0/3]eth-trunk 0

建立vlan

[sw1]vlan 2

[sw2]vlan 2

[sw3]vlan 2

[sw4]vlan 2

划入vlan并创立trunk干道

[sw3]int g0/0/4
[sw3-GigabitEthernet0/0/4]port link-type access 
[sw3-GigabitEthernet0/0/4]port default vlan 2

[sw4]int g0/0/4
[sw4-GigabitEthernet0/0/4]port link-type access 
[sw4-GigabitEthernet0/0/4]port default vlan 2

[sw1]port-group group-member  Eth-Trunk 0 g0/0/4 to g0/0/5
[sw1-port-group]port link-type trunk 
[sw1-Eth-Trunk0]port link-type trunk 
[sw1-GigabitEthernet0/0/4]port link-type trunk 
[sw1-GigabitEthernet0/0/5]port link-type trunk 
[sw1-Eth-Trunk0]port trunk allow-pass vlan 2
[sw1-GigabitEthernet0/0/4]port trunk allow-pass vlan 2
[sw1-GigabitEthernet0/0/5]port trunk allow-pass vlan 2

[sw2]port-group group-member Eth-Trunk 0 g0/0/4 to g0/0/5
[sw2-Eth-Trunk0]port link-type trunk 
[sw2-GigabitEthernet0/0/4]port link-type trunk 
[sw2-GigabitEthernet0/0/5]port link-type trunk 
[sw2-Eth-Trunk0]port trunk allow-pass vlan 2
[sw2-GigabitEthernet0/0/4]port trunk allow-pass vlan 2
[sw2-GigabitEthernet0/0/5]port trunk allow-pass vlan 2

[sw3]port-group group-member g0/0/1 to g0/0/2
[sw3-port-group]port link-type trunk 
[sw3-GigabitEthernet0/0/1]port link-type trunk 
[sw3-GigabitEthernet0/0/2]port link-type trunk 
[sw3-port-group]port trunk allow-pass vlan 2
[sw3-GigabitEthernet0/0/1]port trunk allow-pass vlan 2
[sw3-GigabitEthernet0/0/2]port trunk allow-pass vlan 2

[sw4]port-group group-member g0/0/1 to g0/0/2
[sw4-port-group]port link-type trunk 
[sw4-GigabitEthernet0/0/1]port link-type trunk 
[sw4-GigabitEthernet0/0/2]port link-type trunk 
[sw4-port-group]port trunk allow-pass vlan 2
[sw4-GigabitEthernet0/0/1]port trunk allow-pass vlan 2
[sw4-GigabitEthernet0/0/2]port trunk allow-pass vlan 2

stp

[sw1]stp mode mstp 
[sw1]stp enable
[sw1]stp region-configuration 
[sw1-mst-region]region-name a
[sw1-mst-region]instance 1 vlan 1
[sw1-mst-region]instance 2 vlan 2
[sw1-mst-region]active region-configuration 

[sw2]stp mode mstp 
[sw2]stp enable
[sw2]stp region-configuration 
[sw2-mst-region]region-name a
[sw2-mst-region]instance 1 vlan 1
[sw2-mst-region]instance 2 vlan 2
[sw2-mst-region]active region-configuration 

[sw3]stp mode mstp 
[sw3]stp enable 
[sw3]stp region-configuration 
[sw3-mst-region]region-name a 
[sw3-mst-region]instance 1 vlan 1
[sw3-mst-region]instance 2 vlan 2
[sw3-mst-region]active region-configuration 

[sw4]stp mode mstp 
[sw4]stp enable 
[sw4]stp region-configuration 
[sw4-mst-region]region-name a
[sw4-mst-region]instance 1 vlan 1
[sw4-mst-region]instance 2 vlan 2
[sw4-mst-region]active region-configuration 

调边缘接口
[sw3]int g0/0/3
[sw3-GigabitEthernet0/0/3]stp edged-port  enable 
[sw3-GigabitEthernet0/0/3]int g0/0/4
[sw3-GigabitEthernet0/0/4]stp edged-port enable 

[sw4]port-group group-member g0/0/3 to g0/0/4
[sw4-port-group]stp edged-port  enable 
[sw4-GigabitEthernet0/0/3]stp edged-port  enable 
[sw4-GigabitEthernet0/0/4]stp edged-port  enable 

svi

[sw1]int vlan1
[sw1-Vlanif1]ip address 172.16.1.1 25
[sw1]int vlan 2
[sw1-Vlanif2]ip address 172.16.1.129 25


[sw2]int vlan1
[sw2-Vlanif1]ip address 172.16.1.2 25
[sw2]int vlan2	
[sw2-Vlanif2]ip address 172.16.1.130 25

vrrp

[sw1]int vlan1
[sw1-Vlanif1]vrrp vrid 1 virtual-ip 172.16.1.126
[sw1-Vlanif1]vrrp vrid 1 priority 105
[sw1-Vlanif1]vrrp vrid 1 track interface g 0/0/1 reduced 10
[sw1-Vlanif1]int vlan 2	
[sw1-Vlanif2]vrrp vrid 1 virtual-ip 172.16.1.254

[sw2]int vlan1
[sw2-Vlanif1]vrrp vrid 1 virtual-ip 172.16.1.126
[sw2-Vlanif1]int vlan 2
[sw2-Vlanif2]vrrp vrid 1 virtual-ip 172.16.1.254
[sw2-Vlanif2]vrrp vrid 1 priority 105
[sw2-Vlanif2]vrrp vrid 1 track int g0/0/1 reduce 10

dhcp

[sw1]dhcp enable 
[sw1]ip pool 1
[sw1-ip-pool-1]network 172.16.1.0 mask 25
[sw1-ip-pool-1]gateway-list 172.16.1.126
[sw1-ip-pool-1]dns-list 114.114.144.144 8.8.8.8
[sw1-ip-pool-1]int vlan1
[sw1-Vlanif1]dhcp select global 
[sw1-Vlanif1]int vlan 2
[sw1-Vlanif2]dhcp select global 
[sw1]ip pool 2
[sw1-ip-pool-2]network 172.16.1.128 mask  25
[sw1-ip-pool-2]gateway-list 172.161.1.254
[sw1-ip-pool-2]dns-list 114.114.114.114 8.8.8.8

[sw2]dhcp enable 
[sw2-ip-pool-1]network 172.16.1.0 mask 25
[sw2-ip-pool-1]gateway-list 172.16.1.126
[sw2-ip-pool-1]dns-list 114.114.114.114 8.8.8.8
[sw2-ip-pool-1]int vlan1
[sw2-Vlanif1]dhcp select global 
[sw2-Vlanif1]int vlan2
[sw2-Vlanif2]dhcp select global
[sw2]ip pool 2
[sw2-ip-pool-2]network 172.16.1.128 mask 25
[sw2-ip-pool-2]gateway-list 172.16.1.254
[sw2-ip-pool-2]dns-list 114.114.114.114 8.8.8.8

打通三层

[sw1]vlan 100
[sw1]int Vlanif 100
[sw1-GigabitEthernet0/0/1]port link-type access 
[sw1-GigabitEthernet0/0/1]port default vlan 100

[sw2]vlan 100
[sw2]int vlan 100
[sw2-Vlanif100]ip add 172.16.0.6 30
[sw2-Vlanif100]int g0/0/1
[sw2-GigabitEthernet0/0/1]port link-type access 
[sw2-GigabitEthernet0/0/1]port default vlan 100

[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]ip add 12.1.1.1 24
[r1-GigabitEthernet0/0/0]int  g0/0/1
[r1-GigabitEthernet0/0/1]ip add 172.16.0.1 30
[r1-GigabitEthernet0/0/1]int g 0/0/2
[r1-GigabitEthernet0/0/2]ip add 172.16.0.5 30

ospf

[sw1]ospf 1 router-id 1.1.1.1
[sw1-ospf-1]area 0
[sw1-ospf-1-area-0.0.0.0]network 172.16.0.0 0.0.255.255

[sw2]ospf 1 router-id 2.2.2.2
[sw2-ospf-1]area 0
[sw2-ospf-1-area-0.0.0.0]network 172.16.0.0 0.0.255.255

[r1]ospf 1 router-id 11.11.11.11
[r1-ospf-1]area 0
[r1-ospf-1-area-0.0.0.0]network 172.16.0.0 0.0.255.255
[sw1]ospf 1
[sw1-ospf-1]silent-interface all 
[sw1-ospf-1]undo silent-interface Vlanif 100
[sw1-ospf-1]undo silent-interface Eth-Trunk 0

[sw2]ospf 1
[sw2-ospf-1]silent-interface all 
[sw2-ospf-1]undo silent-interface Vlanif 1
[sw2-ospf-1]undo silent-interface Eth-Trunk 0
[r1]ip route-static 0.0.0.0 0 12.1.1.2
[r1]ospf 1
[r1-ospf-1]default-route-advertise

ral

[r1]acl 2000
[r1-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[r1-acl-basic-2000]int g0/0/0
[r1-GigabitEthernet0/0/0]nat outbound 2000

isp公网

[r2]int g0/0/0
[r2-GigabitEthernet0/0/0]ip add 12.1.1.2 24
[r2-GigabitEthernet0/0/0]int l0
[r2-LoopBack0]ip add 1.1.1.1 24

实验到这pc都能获取ip地址
三层架构实验_第3张图片三层架构实验_第4张图片三层架构实验_第5张图片三层架构实验_第6张图片

测试
三层架构实验_第7张图片
实验结束!

你可能感兴趣的:(笔记,架构,网络)