當前位置:首頁 » 存儲配置 » mstp的配置有哪些

mstp的配置有哪些

發布時間: 2023-08-14 23:10:11

『壹』 銳捷MSTP配置

交換機
密碼
1234(config)#enable secret level 1 0 100
1234(config)#enable secret level 15 0 100
遠程登入密碼
1234(config)#line vty 0 4
1234(config-line)#password 100
1234(config-line)#end
交換機管理IP
1234(config)#interface vlan 1
1234(config-if)#ip address 192.168.1.10 255.255.255.0
1234(config-if)#no shutdown
修改交換機老化時間
1234(config)#mac-address-table aging-time 20
1234(config)#end
添刪vlan
1234(config)#vlan 888
1234(config-vlan)#name a888
1234(config)#no vlan 888
添加access口
1234(config)#interface gigabitEthernet 0/10
1234(config-if)#switchport mode access
1234(config-if)#switchport access vlan 10
切換assess trunk
1234(config-if)#switchport mode access
1234(config-if)#switchport mode trunk
指定特定一個native vlan
1234(config-if)#switchport trunk native vlan 10
配置trunk口的許可vlan列表
1234(config-if)#switchport trunk allowed vlan ?
add Add VLANs to the current list
all All VLANs
except All VLANs except the following
remove Remove VLANs from the current list
速成樹協議
1234(config)#spanning-tree
1234(config)#spanning-tree mode rstp/stp
配置網關:
switch(config)#ip default-gateway 192.168.1.254
交換機基本配置-常見查看命令
查看CPU利用率
show cpu
查看交換機時鍾
show clock
查看交換機日誌
show logging
查看交換機動態學習到的MAC地址表
show mac-address-table dynamic
查看當前交換機運行的配置文件
show running-config
查看交換機硬體、軟體信息
show version
查看交換機的arp表
show arp
顯示介面詳細信息的命令
show interfaces gigabitEthernet 4/1 counters
介面配置
Switch(config)#interface gigabitethernet 0/1
把介面工作模式改為光口。
Switch(config-if)#medium-type fiber
把介面工作模式改為電口。
Switch(config-if)#medium-type copper
速度/雙工配置
進入介面配置模式。
Switch(config)#interface interface-id
設置介面的速率參數,或者設置為auto。
Switch(config-if)#speed {10 | 100 | 1000 | auto }
設置介面的雙工模式。
Switch(config-if)#plex {auto | full | half}
例子
Switch(config)#interface gigabitethernet 0/1
Switch(config-if)#speed 1000
Switch(config-if)#plex full
光口不能修改速度和雙工配置,只能auto。
在故障處理的時候,如果遇到規律性的時斷時續或掉包,在排除其他原因後,可以考慮是否和對端設備的速率和雙工模式不匹配,尤其是兩端設備為不同廠商的時候。
VLAN
建立VLAN 100
Switch (config)#vlan 100
該VLAN名稱為ruijie
Switch (config)#name ruijie
將交換機介面劃入VLAN 中:
range表示選取了系列埠1-48,這個對多個埠進行相同配置時非常有用。
Switch (config)#interface range f 0/1-48
將介面劃到VLAN 100中。
Switch (config-if-range)#switchport access vlan 100
將介面劃回到默認VLAN 1中,即埠初始配置。
Switch (config-if-range)#no switchport access vlan
Switch(config)#interface fastEthernet 0/1
該埠工作在access模式下
Switch(config-if)#switchport mode access
該埠工作在trunk模式下
Switch(config-if)#switchport mode trunk
Switch(config)#interface fastEthernet 0/2
設定VLAN要修剪的VLAN。
Switch(config-if)#switchport trunk allowed vlan remove 2-9,11-19,21-4094
取消埠下的VLAN修剪。
Switch(config-if)#no switchport trunk allowed vlan
生成樹
開啟生成樹協議。
Switch(config)#spanning-tree
禁止生成樹協議。
Switch(config)#no spanning-tree
配置生成樹優先順序:
配置設備優先順序為4096。
Switch(config)#spanning-tree priority 4096
數值越低,優先順序別越高。
埠鏡像
配置G0/2為鏡像埠。
Switch (config)# monitor session 1 destination interface G 0/2
配置G0/1為被鏡像埠,且出入雙向數據均被鏡像。
Switch (config)# monitor session 1 source interface G 0/1 both
去掉鏡像1。
Switch (config)# no monitor session 1
埠聚合
Switch(config)#interface fastEthernet 0/1
把埠f0/1加入到聚合組1中。
Switch (config-if)#port-group 1
把埠f0/1從聚合組1中去掉
Switch (config-if)#no port-group 1
建立ACL:
建立ACL訪問控制列表名為ruijie,extend表示建立的是擴展訪
Switch(config)# Ip access-list exten ruijie
問控制列表。
添加ACL的規則:
禁止PING IP地址為192.168.1.1的設備。
Switch (config-ext-nacl)#deny icmp any 192.168.1.1 255.255.255.0
禁止埠號為135的應用。
Switch (config-ext-nacl)# deny tcp any any eq 135
禁止協議為www的應用。
Switch (config-ext-nacl)#deny udp any any eq www
允許所有行為。
Switch(config-ext-nacl)# permit ip any any
將ACL應用到具體的介面上:
Switch (config)#interface range f 0/1
把名為ruijie的ACL應用到埠f 0/1上。
Switch (config-if)#ip access-group ruijie in
從介面去除ACL。
Switch (config-if)#no ip access-group ruijie in
刪除ACL:
刪除名為ruijie的ACL。
Switch(config)#no Ip access-list exten ruijie
增加ACE項後,是增加到ACL最後,不可以中間插入,如果要調整ACE的順序,必須整個刪除ACL後再重新配置。
埠安全
Switch (config)#interface range f 0/1
開啟埠安全。
Switch(config-if)# switchport port-security
關閉埠安全。
Switch(config-if)# no switchport port-security
設置埠能包含的最大安全地址數為8。
Switch(config-if)# switchport port-security maximum 8
在介面fastethernet0/1配置一個安全地址00d0.f800.073c,並為其綁定一個IP地址192.168.1.1
Switch(config-if)# switchport port-security mac-address 00d0.f800.073c ip-address 192.168.1.1
刪除介面上配置的安全地址。
Switch(config-if)#no switchport port-security mac-address 00d0.f800.073c ip-address 192.168.1.1
防ARP攻擊
IP和MAC地址的綁定
Switch(config)#arp ip-address hardware-address [type] interface-id
Switch(config)#arp 192.168.12.111 00d0.f800.073c arpa g 0/1
綁定網關
進入指定埠進行配置。
Switch(config)#Interface interface-id
配置防止ip-address的ARP欺騙。
Switch(config-if)#Anti-ARP-Spoofing ip ip-address
防STP攻擊
進入埠Fa0/1。
Switch(config)# inter fastEthernet 0/1
打開該埠的的BPDU guard功能。
Switch(config-if)# spanning-tree bpguard enable
關閉該埠的的BPDU guard功能。
Switch(config-if)# spanning-tree bpguard diaable
埠關閉後只能shutdown然後再no shutdown
或者重新啟動交換機才能恢復!
防DOS/DDOS攻擊
進入埠Fa0/1。
Switch(config)# inter fastEthernet 0/1
預防偽造源IP的DOS攻擊的入口過濾功能。
Switch(config-if)#ip deny spoofing-source
關閉入口過濾功能只能在三層介面上配置。
Switch(config-if)#no ip deny spoofing-source
和ACL不能同時存在。
埠關閉後只能shutdown然後再no shutdown
或者重新啟動交換機才能恢復!
防IP掃描攻擊配置:
打開系統保護。
Switch(config)#system-guard enable
關閉系統保護功能。
Switch(config)#no system-guard
DHCP配置
打開DHCP Relay Agent:
Switch(config)#service dhcp
配置DHCP Server的IP地址:
Switch(config)#ip helper-address address
VRRP配置
Switch(config)#Interface interface-id
Switch(config-if)#Standby [group-number] ip ip-address
設置虛擬機的優先順序。
standby [group-number] priority priority
三層交換機配置
SVI:
把VLAN 10配置成SVI。
switch (config)#interface vlan 10
給該SVI介面配置一個IP地址
switch (config-if)#ip address 192.168.1.1 255.255.255.0
Routed Port:
switch (config)#interface fa 0/1
把f 0/1變成路由口。
switch (config-if)#no switch
路由配置:
添加一條路由。
switch (config)#ip route 目的地址 掩碼 下一跳
switch (config)#ip route 210.10.10.0 255.255.255.0 218.8.8.8

『貳』 華為交換機配置vrrp、mstp綜合實驗

;

1.PC1的網關ip位於匯聚交換機凳缺A,PC2的網關IP位於匯聚交換機B,默認均為vlan 1;

2.核心交換機A 與核心交換機B 採用VRRP實現高可用,雙機互聯埠採用二層聚合;

3.核心交換機A 指定為Vlan 194 和 vlan 192 的根橋(bridge root),核心交換機B指定為vlan195 和vlan193的根橋(bridge root);

匯聚層交換機A:

#生成樹的模式選為mstp

stp mode mstp

#進入生成樹的配置模式

stp region-configuration

region-name yongfu

#創建實例1,將vlan192、194劃到實例1中

instance 1 vlan 192 194 

#創建實例1,將vlan193、195劃到實例2中

instance 2 vlan 193 195

#激活配置

active region-configuration

interface Vlanif1

#接入層交換機的網關ip

ip address 10.12.192.254 255.255.255.128

interface Vlanif192

ip address 10.13.192.156 255.255.255.248

interface Ethernet0/0/1

port link-type trunk

port trunk allow-pass vlan 2 to 4094

interface Ethernet0/0/2

port link-type trunk

port trunk allow-pass vlan 2 to 4094

#配置環棗茄辯回介面的IP地址

interface LoopBack0

ip address 1.1.1.1 255.255.255.0

#配置route-id 1.1.1.1

ospf 1 router-id 1.1.1.1

area 0

#宣告直連網路

  network 10.13.192.0 0.0.0.255

  network 10.12.192.128 0.0.0.127

匯聚層交換機B:納空

vlan batch 193

stp mode mstp

stp region-configuration

region-name yongfu

instance 1 vlan 192 194

instance 2 vlan 193 195

active region-configuration

interface Vlanif1

#pc2的網關ip

ip address 10.14.192.126 255.255.255.128

interface Vlanif193

ip address 10.13.193.156 255.255.255.248

interface Ethernet0/0/1

port link-type trunk

port trunk allow-pass vlan 193

interface Ethernet0/0/2

port link-type trunk

port trunk allow-pass vlan 193

#配置ospf,手動設置route-id

ospf 1 router-id 2.2.2.2

area 0

#宣告直連網段

  network 10.14.192.0 0.0.0.127

  network 10.13.193.152 0.0.0.7

核心交換機lsw1:

#創建vlan192-195

vlan batch 192 to 195

#指定該交換機為實例1的根網橋(即為vlan 192、194的根橋)

stp instance 1 root primary

#指定該交換機為實例2的根網橋(即為vlan 193、195的備根橋)

stp instance 2 root secondary

#配置mstp生成樹協議

stp mode mstp

stp region-configuration

region-name yongfu

instance 1 vlan 192 194

instance 2 vlan 193 195

active region-configuration

interface Vlanif192

ip address 10.13.192.153 255.255.255.248

#配置vrrp協議,vrid為192,虛擬網關地址為10.13.192.155

vrrp vrid 192 virtual-ip 10.13.192.155

#默認優先順序是100,現將優先順序設置為120,為主網關設備

vrrp vrid 192 priority 120

interface Vlanif193

ip address 10.13.193.153 255.255.255.248

#不配置優先順序,默認為100,作為備用網關

vrrp vrid 193 virtual-ip 10.13.193.155

interface Vlanif194

ip address 10.13.194.1 255.255.255.248

vrrp vrid 194 virtual-ip 10.13.194.3

vrrp vrid 194 priority 120

interface Vlanif195

ip address 10.13.195.1 255.255.255.248

vrrp vrid 195 virtual-ip 10.13.195.3

#配置聚合口

interface Eth-Trunk1

port link-type trunk

#放通所有vlan

port trunk allow-pass vlan 2 to 4094

#將介面劃分為對應的vlan

interface GigabitEthernet0/0/1

port link-type trunk

port trunk allow-pass vlan 192

interface GigabitEthernet0/0/2

port link-type trunk

port trunk allow-pass vlan 193

#將GigabitEthernet0/0/3、GigabitEthernet0/0/4捆綁成一個聚合口

interface GigabitEthernet0/0/3

eth-trunk 1

interface GigabitEthernet0/0/4

eth-trunk 1

interface GigabitEthernet0/0/5

port link-type trunk

port trunk allow-pass vlan 2 to 4094

interface GigabitEthernet0/0/6

port link-type trunk

port trunk allow-pass vlan 2 to 4094

#配置ospf,進程號為1,route-id為3.3.3.3

ospf 1 router-id 3.3.3.3

area 0.0.0.0

#宣告直連網段

  network 10.13.192.152 0.0.0.7

  network 10.13.193.152 0.0.0.7

  network 10.13.194.0 0.0.0.7

  network 10.13.195.0 0.0.0.7

ip route-static 19.130.107.0 255.255.255.192 10.13.194.5

核心交換機lsw2:(配置與lsw1相似)

#創建vlan192-195

vlan batch 192 to 195

stp mode mstp

stp instance 2 root primary

stp instance 1 root secondary

stp region-configuration

region-name yongfu

instance 1 vlan 192 194

instance 2 vlan 193 195

active region-configuration

#配置個介面的ip地址,配置vrrp,設置主、備網關

interface Vlanif192

ip address 10.13.192.154 255.255.255.248

vrrp vrid 192 virtual-ip 10.13.192.155

interface Vlanif193

ip address 10.13.193.154 255.255.255.248

vrrp vrid 193 virtual-ip 10.13.193.155

vrrp vrid 193 priority 120

interface Vlanif194

ip address 10.13.194.2 255.255.255.248

vrrp vrid 194 virtual-ip 10.13.194.3

interface Vlanif195

ip address 10.13.195.2 255.255.255.248

vrrp vrid 195 virtual-ip 10.13.195.3

vrrp vrid 195 priority 120

interface Eth-Trunk1

port link-type trunk

port trunk allow-pass vlan 2 to 4094

interface GigabitEthernet0/0/1

port link-type trunk

port trunk allow-pass vlan 192

interface GigabitEthernet0/0/2

port link-type trunk

port trunk allow-pass vlan 193

interface GigabitEthernet0/0/3

eth-trunk 1

interface GigabitEthernet0/0/4

eth-trunk 1

interface GigabitEthernet0/0/5

port link-type trunk

port trunk allow-pass vlan 2 to 4094

interface GigabitEthernet0/0/6

port link-type trunk

port trunk allow-pass vlan 2 to 4094

交換機lsw14:

vlan batch 194

stp mode mstp 

stp region-configuration

region-name yongfu

instance 1 vlan 192 194

instance 2 vlan 193 195

active region-configuration

interface Vlanif1

ip address 10.13.192.133 255.255.255.252

interface Vlanif194

ip address 10.13.194.5 255.255.255.248

interface Ethernet0/0/1

port link-type trunk

port trunk allow-pass vlan 194

interface Ethernet0/0/2

port link-type trunk

port trunk allow-pass vlan 194

#配置ospf,進程號為1,route-id 5.5.5.5

ospf 1 router-id 5.5.5.5

area 0.0.0.0

  network 10.13.194.0 0.0.0.7

  network 10.13.192.132 0.0.0.3

ip route-static 19.130.107.0 255.255.255.0 10.13.192.134

交換機lsw15:

vlan batch 195

stp mode mstp

stp region-configuration

region-name yongu

instance 1 vlan 192 194

instance 2 vlan 193 195

active region-configuration

interface Vlanif1

ip address 10.13.192.149 255.255.255.252

interface Vlanif195

ip address 10.13.195.5 255.255.255.248

interface Ethernet0/0/1

port link-type trunk

port trunk allow-pass vlan 195

interface Ethernet0/0/2

port link-type trunk

port trunk allow-pass vlan 195

ospf 1 router-id 6.6.6.6

area 0.0.0.0

  network 10.13.192.148 0.0.0.3

  network 10.13.195.0 0.0.0.7

ip route-static 61.142.211.0 255.255.255.0 10.13.192.150

出口路由器R1:

interface Ethernet0/0/0

ip address 10.13.192.134 255.255.255.252

interface Ethernet0/0/1

ip address 19.130.107.1 255.255.255.0

ospf 1 router-id 7.7.7.7

area 0.0.0.0

  network 10.13.192.132 0.0.0.3

  network 19.130.107.0 0.0.0.255

ip route-static 0.0.0.0 0.0.0.0 10.13.192.133

出口路由器R2:

interface Ethernet0/0/0

ip address 10.13.192.150 255.255.255.252

interface Ethernet0/0/1

interface GigabitEthernet0/0/0

ip address 61.142.211.122 255.255.255.0

nat static global 61.142.211.123 inside 10.12.194.1 netmask 255.255.255.255

nat static enable

ospf 1 router-id 8.8.8.8

area 0.0.0.0

  network 10.13.192.148 0.0.0.3

  network 61.142.211.0 0.0.0.255

ip route-static 0.0.0.0 0.0.0.0 10.13.192.149

熱點內容
腳本微信取關 發布:2025-02-01 19:35:01 瀏覽:150
如何用雲伺服器部署svn 發布:2025-02-01 19:33:20 瀏覽:989
緩存迅雷 發布:2025-02-01 19:31:53 瀏覽:975
linux與unixshell編程指南 發布:2025-02-01 19:25:03 瀏覽:939
護膚品資料庫 發布:2025-02-01 19:25:02 瀏覽:648
python接受json數據 發布:2025-02-01 19:24:24 瀏覽:943
修改網站資料庫 發布:2025-02-01 19:02:16 瀏覽:423
果粉不換安卓怎麼辦 發布:2025-02-01 18:57:21 瀏覽:796
網頁卡需要什麼配置 發布:2025-02-01 18:50:30 瀏覽:136
編程玩家 發布:2025-02-01 18:22:36 瀏覽:823