用到的命令--[數(shù)通]

一、STP
在交換機(jī)操作:
[SW1]int g0/0/1
[SW1-GigabitEthernet0/0/1]stp port priority 0 ###修改接口優(yōu)先級
[SW1]display stp ###查看STP協(xié)議的狀態(tài)
CIST Bridge 值和CIST root一致,則為root
[SW1]display stp brief ###查看STP端口角色和端口狀態(tài)
[SW1]stp mode stp ###修改STP模式
[SW1]stp priority 0 ###修改STP優(yōu)先級
int g0/0/1
[SW1]stp cost 20000 ###修改路徑開銷
二、RSTP
邊緣端口:
作用: 接口up,立即進(jìn)入轉(zhuǎn)發(fā)狀態(tài)
a.系統(tǒng)視圖:
[SW1]stp edged-port default ###將所有端口設(shè)置為邊緣端口
b.接口下:
[SW1]interface GigabitEthernet0/0/1
[SW1-GigabitEthernet0/0/1] stp edged-port enable
undo ###用于刪除已經(jīng)執(zhí)行的命令
保護(hù)機(jī)制:
(1)根(root)保護(hù):
用于防止root被搶占,在DP上配置
當(dāng)DP端口收到更優(yōu)BPDU時,會處于阻塞狀態(tài)。如果30s內(nèi)沒有再次收到更優(yōu)BPDU,回到轉(zhuǎn)發(fā)狀態(tài)。
配置:
[SW1]int g0/0/1
[SW1-GigabitEthernet0/0/1]stp root-protection ###在端口處配置根保護(hù)
(2)BPDU保護(hù):
用于防止邊緣端口收到BPDU報文,重新進(jìn)行STP計算
edge-port收到BPDU報文,不會喪失edge-port
配置:
[SW1]stp bpdu-protection ###配置BPDU保護(hù)

三、IP路由
優(yōu)先級:用于標(biāo)識路由的可靠程度
0~255 , 數(shù)值越小越優(yōu)
direct 0
ospf 10
rip 100
static 60

四、靜態(tài)路由
1.串行鏈路
a.ip route-static 目的網(wǎng)段 掩碼 下一跳
b.ip route-static 目的網(wǎng)段 掩碼 出接口
c.ip route-static 目的網(wǎng)段 掩碼 出接口 下一跳
例子:
ip route-static 192.168.39.0 24 10.1.12.2


1-1.png

2.以太網(wǎng)鏈路
a.ip route-static 目的網(wǎng)段 掩碼 下一跳
c.ip route-static 目的網(wǎng)段 掩碼 出接口 下一跳
3.浮動路由
通過調(diào)整路由優(yōu)先級實現(xiàn)
[R1]ip route-static 192.168.39.0 24 10.1.12.2
[R1]ip route-static 192.168.39.0 24 10.1.12.2 preference 70
4.默認(rèn)路由
[R1]ip route-static 0.0.0.0 0 10.1.12.2
0.0.0.0/0 表示任意匹配

五、RIP(路由信息協(xié)議)
配置:
[R1] rip 1
[R1-rip-1] version 2 ###修改版本號
[R1-rip-1] network 192.168.1.0
[R1-rip-1] network 10.0.0.0

六、(1)OSPF配置
1.配置接口IP地址
2.激活OSPF進(jìn)程
OSPF
3.進(jìn)入?yún)^(qū)域下,宣告接口
area 0
network 10.1.1.0 0.0.0.255
格式:
area area-id
network 網(wǎng)絡(luò)號 反掩碼
反掩碼:
0: 精確匹配
1: 任意匹配

Router-id
(2)手工配置:
系統(tǒng)視圖下:
router-id 1.1.1.1
配置協(xié)議時:
ospf route-id 100.1.1.1
協(xié)議 > 系統(tǒng)視圖
reset ospf process ###重置ospf進(jìn)程
display ospf brief ###查看ospf簡要信息
display ospf peer brief ###查看ospf鄰居狀態(tài)
display ospf routing ###只查看ospf路由信息
display ospf interface ###查看有哪些接口被宣告進(jìn)ospf
(3)下放默認(rèn)路由
1.配置默認(rèn)路由
2.ospf視圖下,下放默認(rèn)路由
ospf 1
default-route-advertise

七、鏈路聚合
(1)配置:
interface Eth-trunk 1 ###創(chuàng)建Eth-trunk 1 接口
trunkport g/0/0/0 to g0/0/3 ###加入成員接口g0/0/0 ~ g0/0/3
display Eth-trunk 1 ###查看Eth-trunk1的接口狀態(tài)

LACP 鏈路聚合控制協(xié)議
(2)配置:
interface Eth-trunk 1
mode lacp-static ###修改模式為LACP
trunkport g/0/0/0 to g0/0/3

(3)修改 LACP優(yōu)先級:
LACP priority 0 ###0~65535 ,默認(rèn):32768

(4)配置最大活動鏈路數(shù)量:
interface Eth-trunk 1
max active-linknumber 2

(5)修改接口LACP優(yōu)先級
int g/0/0/1
lacp priority 65535

(6)開始搶占和設(shè)置搶占延時
int eth-trunk 1
lacp preempt enable
lacp preempt delay 10

(7)接口初始化
clear configuration int g/0/0/1

int eth-trunk 1
undo portswitch ###關(guān)閉二層,開啟三層
ip address 10.1.12.2 24

八、VLAN原理和配置
1.鏈路類型


2-1.png

(1)接入鏈路:access,用于交換機(jī)和終端之間的互聯(lián)
【a】配置:
display port vlan ###查看接口所在的vlan
diaplay vlan ###查看激活的vlan
【b】創(chuàng)建vlan:
[S1] vlan 10
[S1] vlan batch 10 20
[S1] vlan batch 10 to 20
【c】將接口劃入vlan中 + 配置PVID
[S1] interface GigabitEthernet0/0/1
[S1-GigabitEthernet0/0/1] port link-type access ###修改接口類型為access
[S1-GigabitEthernet0/0/1] port default vlan 10
(2)干道鏈路:trunk,用于交換機(jī)之間的互聯(lián)
配置:
[S1] interface GigabitEthernet0/0/4
[S1-GigabitEthernet0/0/4] port link-type trunk
[S1-GigabitEthernet0/0/4] port trunk allow-pass vlan 10 20
(3)hybrid


3-1.png

在S3上的配置:
交換機(jī)與客戶端
[S3]interface GigabitEthernet0/0/1
[S3-GigabitEthernet0/0/1]port link-type hybrid
[S3-GigabitEthernet0/0/1] port hybrid pvid vlan 10
[S3-GigabitEthernet0/0/1] port hybrid untagged vlan 10 100
在g0/0/2接口也執(zhí)行以上操作
交換機(jī)與交換機(jī)
[S3-GigabitEthernet0/0/3]port hybrid tagged vlan all
在S2也執(zhí)行S1的操作
效果:
PC6能ping通server,但是不能ping通PC7


3-2.png

九、單臂路由
(1)配置子接口
int g0/0/0.1
ip address 192.168.1.254/24

(2)將SW連接Router的接口配置為trunk
int g0/0/1
port link-type trunk
`trunk allow-pass all

(3)在子接口下配置VLAN-ID終結(jié)
int g0/0/0.1
dotlq termination vid 10 ###封裝和解封裝vlan-id

(4)在子接口下開啟ARP識別
int g/0/0/0.1
arp broadcast enable

十、使用三層SW配置VLANIF接口作為網(wǎng)關(guān)
1.創(chuàng)建vlan
2.將接口劃入vlan
3.創(chuàng)建vlanif接口 + 配置IP 地址
int vlanif 10
ip address 192.168.1.254 24

十一、DHCP的配置
1.全局地址

(1)開啟DHCP功能
dhcp enable
(2)創(chuàng)建IP地址池
ip pool huawei
(3)配置網(wǎng)關(guān):
gateway-list 192.168.1.254 192.168.1.253
(4)指定地址池的范圍
network 192.168.1.0 mask 255.255.255.0
(5)配置DNS
dns-list 114.114.114.114
(6)保留IP地址
excluded-ip-address 192.168.1.100 192.168.1.200
(7)配置租約
lease day 0 hour 2 minute 0
(8)靜態(tài)綁定
static-bind ip-address 192.168.1.1 mac-address 5489-98F5-33 36
(9)調(diào)用全局地址池
interface GigabitEthernet0/0/0
ip address 192.168.1.254 255.255.255.0
dhcp select global

2.接口地址
interface GigabitEthernet0/0/0
dhcp select interface ###開啟接口地址池
dhcp server static-bind ip-address 192.168.2.2 mac-address 5489-9867-4f6e
dhcp server excluded-ip-address 192.168.2.100 192.168.2.200
dhcp server lease day 0 hour 2 minute 0
dhcp server dns-list 8.8.8.8

ipconfig /release ###釋放地址
ipconfig /renew ###重新獲得地址

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。