拓扑
中心网络
- VLAN
- 终端接口模式
- 聚合链路
- Trunk干道
- MSTP
- VRRP
- 端口安全
骨干网络
- OSPF
- BGP
- MPLS
- VPN
分支
- BGP
配置
SW1:
#关闭日志
undo terminal trapping
sys
sys SW1
user-interface con 0
#用不超时
idle-timeout 0 0
q
#VLAN
vlan batch 2 3 101 102
#聚合链路
int e 1
trunkport g0/0/23
trunkport g0/0/24
load-balance src-dst-ip
q
#Trunk干道
port-group 1
group-member g0/0/21 to g0/0/22
port link-ty trunk
port trunk all vl 2 3
q
undo port-group 1
#MSTP
stp enable
stp mode mstp
stp region-configuration
region-name hw
#可省略
revision-level 1
#可省略
instance 1 vlan 2
instance 2 vlan 3
active region-configuration
q
stp instance 1 root secondary
stp instance 2 root primary
#VRRP
int Vlanif 2
ip address 10.2.2.1 24
#网关IP
vrrp vrid 1 virtual-ip 10.2.2.254
#优先级
vrrp v 1 priority 120
#抢占延时
vrrp vrid 1 preempt-mode timer delay 10
#认证
vrrp vrid 1 authentication-mode md5 12345
#上行检测
vrrp vrid 1 track interface g0/0/20 reduced 50
int Vlanif 3
ip address 10.2.3.2 24
#网关IP
vrrp vrid 1 virtual-ip 10.2.3.254
#优先级
vrrp v 1 priority 100
#抢占延时
vrrp vrid 1 preempt-mode timer delay 10
#认证
vrrp vrid 1 authentication-mode md5 12345
#上行检测
vrrp vrid 1 track interface g0/0/20 reduced 50
q
#互备分流+路由
int vl 101
ip add 10.2.1.1 30
int g0/0/20
port link-ty access
port def vl 101
int l0
ip add 10.2.10.101 32
int vl 102
ip add 10.2.1.13 30
int e 1
port link-ty trunk
port trunk all vl 2 3 101 102
q
ospf 200 router-id 20.2.10.101
area 0.0.0.0
network 10.2.10.101 0.0.0.0
network 10.2.1.1 0.0.0.0
network 10.2.1.13 0.0.0.0
q
area 0.0.0.1
network 10.2.2.1 0.0.0.0
q
area 0.0.0.2
network 10.2.3.2 0.0.0.0
q
silent-interface Vlanif 2
silent-interface Vlanif 3
q
#DHCP
dhcp enable
int vl 2
dhcp select interface
dhcp server excluded-ip-address 10.2.2.126 10.2.2.254
dhcp server dns-list 8.8.8.8
int vl 3
dhcp select interface
dhcp server excluded-ip-address 10.2.3.126 10.2.3.254
dhcp server dns-list 8.8.8.8
SW2:
#关闭日志
undo terminal trapping
sys
sys SW2
user-interface con 0
#用不超时
idle-timeout 0 0
q
#VLAN
vlan batch 2 3 101 102
#聚合链路
int e 1
trunkport g0/0/23
trunkport g0/0/24
load-balance src-dst-ip
q
#Trunk干道
port-group 1
group-member g0/0/21 to g0/0/22
port link-ty trunk
port trunk all vl 2 3
q
undo port-group 1
#MSTP
stp enable
stp mode mstp
stp region-configuration
region-name hw
#可省略
revision-level 1
#可省略
instance 1 vlan 2
instance 2 vlan 3
active region-configuration
q
stp instance 1 root secondary
stp instance 2 root primary
#VRRP
int Vlanif 2
ip address 10.2.2.2 24
#网关IP
vrrp vrid 1 virtual-ip 10.2.2.254
#优先级
vrrp v 1 priority 100
#抢占延时
vrrp vrid 1 preempt-mode timer delay 10
#认证
vrrp vrid 1 authentication-mode md5 12345
#上行检测
vrrp vrid 1 track interface g0/0/20 reduced 50
int Vlanif 3
ip address 10.2.3.1 24
#网关IP
vrrp vrid 1 virtual-ip 10.2.3.254
#优先级
vrrp v 1 priority 120
#抢占延时
vrrp vrid 1 preempt-mode timer delay 10
#认证
vrrp vrid 1 authentication-mode md5 12345
#上行检测
vrrp vrid 1 track interface g0/0/20 reduced 50
q
#互备分流+路由
int vl 101
ip add 10.2.1.5 30
int g0/0/20
port link-ty access
port def vl 101
int l0
ip add 10.2.10.102 32
int vl 102
ip add 10.2.1.14 30
int e 1
port link-ty trunk
port trunk all vl 2 3 101 102
q
ospf 200 router-id 20.2.10.102
area 0.0.0.0
network 10.2.1.5 0.0.0.0
network 10.2.10.102 0.0.0.0
network 10.2.1.14 0.0.0.0
q
area 0.0.0.1
network 10.2.2.2 0.0.0.0
q
area 0.0.0.2
network 10.2.3.1 0.0.0.0
q
silent-interface Vlanif 2
silent-interface Vlanif 3
q
#DHCP
dhcp enable
int vl 2
dhcp select interface
dhcp server excluded-ip-address 10.2.2.3 10.2.2.125
dhcp server excluded-ip-address 10.2.2.1
dhcp server dns-list 8.8.8.8
int vl 3
dhcp select interface
dhcp server excluded-ip-address 10.2.3.2
dhcp server dns-list 8.8.8.8
SW3:
#关闭日志
undo terminal trapping
sys
sys SW3
user-interface con 0
#用不超时
idle-timeout 0 0
q
#VLAN
vlan batch 2 3
#接口模式
int g0/0/1
port link-ty access
port def vlan 2
int g0/0/2
port link-ty access
port def vlan 3
#Trunk干道
int g0/0/21
port link-ty trunk
port trunk allow vl 2 3
int g0/0/22
port link-ty trunk
port trunk allow vl 2 3
q
#MSTP
stp enable
stp mode mstp
stp region-configuration
region-name hw
#可省略
revision-level 1
#可省略
instance 1 vlan 2
instance 2 vlan 3
active region-configuration
q
#端口安全
port-group 1
group-member g0/0/1 g0/0/2
stp edged-port enable
q
undo port-group 1
stp bpdu-protection
SW4:
#关闭日志
undo terminal trapping
sys
sys SW4
user-interface con 0
#用不超时
idle-timeout 0 0
q
#VLAN
vlan batch 2 3
#接口模式
int g0/0/1
port link-ty access
port def vlan 2
int g0/0/2
port link-ty access
port def vlan 3
#Trunk干道
int g0/0/21
port link-ty trunk
port trunk allow vl 2 3
int g0/0/22
port link-ty trunk
port trunk allow vl 2 3
#MSTP
stp enable
stp mode mstp
stp region-configuration
region-name hw
#可省略
revision-level 1
#可省略
instance 1 vlan 2
instance 2 vlan 3
active region-configuration
q
#端口安全
port-group 1
group-member g0/0/1 g0/0/2
stp edged-port enable
q
undo port-group 1
stp bpdu-protection
R1:
#关闭日志
undo terminal trapping
sys
sys R1
user-interface con 0
#用不超时
idle-timeout 0 0
q
#接口IP
int g0/0/0
ip add 10.2.1.9 30
int g0/0/1
ip add 10.2.1.2 30
int g0/0/2
ip add 10.1.2.5 30
int l 0
ip add 10.1.10.101 32
q
#路由
ospf 200 router-id 20.1.10.101
area 0.0.0.0
network 10.1.10.101 0.0.0.0
network 10.2.1.2 0.0.0.0
network 10.2.1.9 0.0.0.0
int g0/0/0
ospf cost 2
q
#BGP
bgp 2
peer 10.1.2.6 as-number 1
peer 10.1.10.102 as-number 2
peer 10.1.10.102 connect-interface LoopBack0
peer 10.1.10.102 next-hop-local
q
#路由重发布
bgp 2
import ospf 200
ospf 200
import bgp
R2:
#关闭日志
undo terminal trapping
sys
sys R2
user-interface con 0
#用不超时
idle-timeout 0 0
q
#接口IP
int g0/0/0
ip add 10.2.1.10 30
int g0/0/1
ip add 10.2.1.6 30
int g0/0/2
ip add 10.1.2.1 30
int l 0
ip add 10.1.10.102 32
q
#路由
ospf 200 router-id 20.1.10.102
area 0.0.0.0
network 10.1.10.102 0.0.0.0
network 10.2.1.6 0.0.0.0
network 10.2.1.10 0.0.0.0
int g0/0/0
ospf cost 2
q
#BGP
bgp 2
peer 10.1.2.2 as-number 1
peer 10.1.10.101 as-number 2
peer 10.1.10.101 connect-interface LoopBack0
peer 10.1.10.101 next-hop-local
q
#路由重发布
bgp 2
import ospf 200
ospf 200
import bgp
R3:
#关闭日志
undo terminal trapping
sys
sys R3
user-interface con 0
#用不超时
idle-timeout 0 0
q
#接口IP
int g0/0/0
ip add 10.1.1.1 30
int g0/0/1
ip add 10.1.1.22 30
int g0/0/2
ip add 10.1.2.6 30
int l 0
ip add 10.1.10.103 32
q
#OSPF
ospf 100 router-id 20.1.10.103
area 0.0.0.0
network 10.1.1.1 0.0.0.0
network 10.1.10.103 0.0.0.0
network 10.1.1.22 0.0.0.0
q
q
#BGP
bgp 1
peer 10.1.10.106 as-number 1
peer 10.1.10.106 connect-interface l 0
ipv4-family vpnv4
undo policy vpn-target
peer 10.1.10.106 enable
peer 10.1.10.106 advertise-community
q
q
#MPLS
mpls lsr-id 20.1.10.103
mpls
q
mpls ldp
q
int g0/0/0
mpls
mpls ldp
int g0/0/1
mpls
mpls ldp
q
#VPN
ip vpn-instance 1
route-distinguisher 3:3
vpn-target 3:3 export-extcommunity
q
q
int g0/0/2
ip binding vpn-instance 1
ip add 10.1.2.6 30
bgp 1
ipv4-family vpn-instance 1
peer 10.1.2.5 as-number 2
q
q
R4:
#关闭日志
undo terminal trapping
sys
sys R4
user-interface con 0
#用不超时
idle-timeout 0 0
q
#接口IP
int g0/0/0
ip add 10.1.1.5 30
int g0/0/1
ip add 10.1.1.2 30
int g0/0/2
ip add 10.1.2.2 30
int l 0
ip add 10.1.10.104 32
q
#OSPF
ospf 100 router-id 20.1.10.104
area 0.0.0.0
network 10.1.1.5 0.0.0.0
network 10.1.1.2 0.0.0.0
network 10.1.10.104 0.0.0.0
network 10.1.2.2 0.0.0.0
q
q
#BGP
bgp 1
peer 10.1.10.106 as-number 1
peer 10.1.10.106 connect-interface l 0
ipv4-family vpnv4
undo policy vpn-target
peer 10.1.10.106 enable
peer 10.1.10.106 advertise-community
q
q
#MPLS
mpls lsr-id 20.1.10.104
mpls
q
mpls ldp
q
int g0/0/0
mpls
mpls ldp
int g0/0/1
mpls
mpls ldp
q
#VPN
ip vpn-instance 1
route-distinguisher 4:4
vpn-target 4:4 export-extcommunity
q
q
int g0/0/2
ip binding vpn-instance 1
ip add 10.1.2.2 30
bgp 1
ipv4-family vpn-instance 1
peer 10.1.2.1 as-number 2
q
q
R5:
#关闭日志
undo terminal trapping
sys
sys R5
user-interface con 0
#用不超时
idle-timeout 0 0
q
#接口IP
int g0/0/0
ip add 10.1.1.21 30
int g0/0/1
ip add 10.1.1.18 30
int g0/0/2
ip add 10.1.1.25 30
int l 0
ip add 10.1.10.105 32
q
#OSPF
ospf 100 router-id 20.1.10.105
area 0.0.0.0
network 10.1.1.21 0.0.0.0
network 10.1.1.18 0.0.0.0
network 10.1.1.25 0.0.0.0
network 10.1.10.105 0.0.0.0
q
q
#MPLS
mpls lsr-id 20.1.10.105
mpls
q
mpls ldp
q
int g0/0/0
mpls
mpls ldp
int g0/0/1
mpls
mpls ldp
int g0/0/2
mpls
mpls ldp
q
R6:
#关闭日志
undo terminal trapping
sys
sys R6
user-interface con 0
#用不超时
idle-timeout 0 0
q
#接口IP
int g0/0/1
ip add 10.1.1.30 30
int g0/0/2
ip add 10.1.1.26 30
int l 0
ip add 10.1.10.106 32
q
#OSPF
ospf 100 router-id 20.1.10.106
area 0.0.0.0
network 10.1.1.30 0.0.0.0
network 10.1.1.26 0.0.0.0
network 10.1.10.106 0.0.0.0
q
stub-router
q
#BGP
bgp 1
group XIXI
peer XIXI connnect-interface l 0
peer XIXI reflect-client
peer 10.1.10.103 group IBGP
peer 10.1.10.104 group IBGP
peer 10.1.10.108 group IBGP
peer 10.1.10.109 group IBGP
ipv4-family vpnv4
peer XIXI enable
peer XIXI reflect-client
undo policy vpn-target
peer XIXI advertise-community
peer 10.1.10.103 group XIXI
peer 10.1.10.104 group XIXI
peer 10.1.10.108 group XIXI
peer 10.1.10.109 group XIXI
#MPLS
mpls lsr-id 20.1.10.106
mpls
q
mpls ldp
q
int g0/0/2
mpls
mpls ldp
int g0/0/1
mpls
mpls ldp
q
R7:
#关闭日志
undo terminal trapping
sys
sys R7
user-interface con 0
#用不超时
idle-timeout 0 0
q
#接口IP
int g0/0/0
ip add 10.1.1.9 30
int g0/0/1
ip add 10.1.1.6 30
int g0/0/2
ip add 10.1.1.29 30
int l 0
ip add 10.1.10.107 32
q
#OSPF
ospf 100 router-id 20.1.10.107
area 0.0.0.0
network 10.1.1.9 0.0.0.0
network 10.1.1.6 0.0.0.0
network 10.1.1.29 0.0.0.0
network 10.1.10.107 0.0.0.0
q
q
#MPLS
mpls lsr-id 20.1.10.107
mpls
q
mpls ldp
q
int g0/0/0
mpls
mpls ldp
int g0/0/1
mpls
mpls ldp
int g0/0/2
mpls
mpls ldp
q
R8:
#关闭日志
undo terminal trapping
sys
sys R8
user-interface con 0
#用不超时
idle-timeout 0 0
q
#接口IP
int g0/0/0
ip add 10.1.1.17 30
int g0/0/1
ip add 10.1.1.14 30
int g0/0/2
ip add 10.3.1.1 30
int l 0
ip add 10.1.10.108 32
q
#OSPF
ospf 100 router-id 20.1.10.108
area 0.0.0.0
network 10.1.1.17 0.0.0.0
network 10.1.1.14 0.0.0.0
network 10.1.10.108 0.0.0.0
q
q
#BGP
bgp 1
peer 10.1.10.106 as-number 1
peer 10.1.10.106 connect-interface l 0
ipv4-family vpnv4
undo policy vpn-target
peer 10.1.10.106 enable
peer 10.1.10.106 advertise-community
q
q
#MPLS
mpls lsr-id 20.1.10.108
mpls
q
mpls ldp
q
int g0/0/0
mpls
mpls ldp
int g0/0/1
mpls
mpls ldp
q
#VPN
ip vpn-instance 1
route-distinguisher 8:8
vpn-target 8:8 export-extcommunity
q
q
int g0/0/2
ip binding vpn-instance 1
ip add 10.3.1.1 30
bgp 1
ipv4-family vpn-instance 1
peer 10.3.1.2 as-number 3
q
q
R9:
#关闭日志
undo terminal trapping
sys
sys R9
user-interface con 0
#用不超时
idle-timeout 0 0
q
#接口IP
int g0/0/0
ip add 10.1.1.13 30
int g0/0/1
ip add 10.1.1.10 30
int g0/0/2
ip add 10.4.1.1 30
int l 0
ip add 10.1.10.109 32
q
#OSPF
ospf 100 router-id 20.1.10.109
area 0.0.0.0
network 10.1.1.13 0.0.0.0
network 10.1.1.10 0.0.0.0
network 10.1.10.109 0.0.0.0
q
q
#BGP
bgp 1
peer 10.1.10.106 as-number 1
peer 10.1.10.106 connect-interface l 0
ipv4-family vpnv4
undo policy vpn-target
peer 10.1.10.106 enable
peer 10.1.10.106 advertise-community
q
q
#MPLS
mpls lsr-id 20.1.10.109
mpls
q
mpls ldp
q
int g0/0/0
mpls
mpls ldp
int g0/0/1
mpls
mpls ldp
q
#VPN
ip vpn-instance 1
route-distinguisher 9:9
vpn-target 9:9 export-extcommunity
q
q
int g0/0/2
ip binding vpn-instance 1
ip add 10.4.1.1 30
bgp 1
ipv4-family vpn-instance 1
peer 10.4.1.2 as-number 4
q
q
R10:
#关闭日志
undo terminal trapping
sys
sys R10
user-interface con 0
#用不超时
idle-timeout 0 0
q
#接口IP
int g0/0/0
ip add 10.3.2.1 24
int g0/0/2
ip add 10.3.1.2 30
int l 0
ip add 10.3.10.110 32
q
#BGP
bgp 3
peer 10.3.1.1 as-number 1
q
R11:
#关闭日志
undo terminal trapping
sys
sys R11
user-interface con 0
#用不超时
idle-timeout 0 0
q
#接口IP
int g0/0/0
ip add 10.4.2.1 24
int g0/0/2
ip add 10.4.1.2 30
int l 0
ip add 10.4.10.111 32
q
#BGP
bgp 4
peer 10.4.1.1 as-number 1
q
R12:
#关闭日志
undo terminal trapping
sys
sys R12
user-interface con 0
#用不超时
idle-timeout 0 0
q
#接口IP
int g0/0/0
ip add 10.5.1.2 30
int g0/0/1
ip add 10.5.1.6 30
int l 0
ip add 10.5.10.112 32
q