如何配置交換機的mac位址表

2021-03-08 21:58:13 字數 7578 閱讀 2318

1樓:小跳醬醬

cisco交換機配置

清除、啟動及基本配置 cisco交換機基本配置

switch>ena 進入特權模式

switch#erase nvram 全部清除交換機的所有配置

switch#reload 重新啟動交換機(初始提示符為switch> )

cisco交換機基本配置:console埠連線

使用者模式hostname> ;

特權模式hostname(config)# ;

全域性配置模式hostname(config-if)# ;

交換機口令設定:

switch>enable ;進入特權模式

switch#config;進入全域性配置模式

switch(config)#hostname csico ;設定交換機的主機名

switch(config)#enable secret csico1 ;設定特權加密口令

switch(config)#enable password csico8 ;設定特權非密口令

switch(config)#line console 0 ;進入控制台口

switch(config-line)#line vty 0 4 ;進入虛擬終端

switch(config-line)#login ;虛擬終端允許登入

switch(config-line)#password csico6 ;設定虛擬終端登入口令csico6

switch#write 儲存配置設定

switch#copy running-config startup-config 儲存配置設定,與write一樣

switch#exit ;返回命令

配置終端過一會時間就會由全域性配置模式自動改為使用者模式,將超時設定為永不超時

switch#conf t

switch(config)#line con 0

switch(config-line)#exec-timeout 0

交換機顯示命令:

switch#write ;儲存配置資訊

switch#show vtp ;檢視vtp配置資訊

switch#show run ;檢視當前配置資訊

switch#show vlan ;檢視vlan配置資訊

switch#show vlan name vlan2

switch#show inte***ce ;檢視埠資訊

switch#show int f0/0 ;檢視指定埠資訊

switch#show int f0/0 status;檢視指定埠狀態

switch#show inte***ce status

switch#dir flash: ;檢視快閃儲存器

switch#show running-config

switch(config)#do show running-config 顯示儲存在記憶體中的當前正確配置檔案。

show startup-configuration:顯示儲存在非易失性儲存器(nvram)的配置檔案。

show users:顯示所有連線到路由器的使用者。

show hosts:顯示主機名和位址資訊。

switch(config)#do show inte***ce

switch(config-if)#do show int f0/21

switch#show arp

switch#show mac-address-table

2960交換機上配置,配置ip及閘道器

switch#conf t

switch(config)#inte***ce vlan1 進入vlan 1特殊介面配置模式

switch(config-if)#ip address 192.168.1.1 255.255.255.0 設定交換機的管理ip位址

switch(config)#ip default-gateway 192.168.1.1 設定交換機的閘道器位址

switch(config)#ip domain-name pctc.***.** 設定交換機所連域的網域名稱

switch(config)#no ip domain-name

switch#ip name-server 218.87.18.230 設定交換機所連域的網域名稱伺服器ip

switch#show int vlan 1 檢視交換機的vlan 1特殊介面配置資訊

switch#show run 檢視交換機的當前執行配置等全部資訊

交換機vlan建立,刪除,埠屬性的設定,配置trunk埠,將某埠加入vlan中,配置vtp:

switch(config)#vlan 2

switch#vlan database ;進入vlan設定

switch(vlan)#vlan 2 ;建vlan 2

switch(vlan)#vlan 3 name vlan3 ;建vlan 3並命名為vlan3

switch(vlan)#no vlan 2 ;刪vlan 2

switch(config)#int f0/1 ;進入埠1

switch(config)#speed ? 檢視speed命令的子命令

switch(config)#speed 100 設定該埠速率為100mb/s (10/auto)

switch(config-if)#do show int f0/21 顯示21口配置資訊

switch(config-if)#shut ;shutdown 關閉當前埠

switch(config-if)#no shut ;no shutdown 開啟當前埠

switch(config)#duplex ? 檢視duplex的子命令

switch(config)#duplex full 設定該埠為全雙工(auto/half)

switch(config)#description to_pc1 這是該埠描述為to_pc1

switch(config)#inte***ce f0/21

switch(config-if)#switchport access vlan 2 ;當前埠加入vlan 2

switch(config-if)#switchport mode trunk ;設定為trunk模式(access模式)

switch(config-if)#switchport trunk allowed vlan 1,2 ;設定允許的vlan

switch(config-if)#switchport trunk encap dot1q ;設定vlan 中繼

switch(config)#vtp domain vtpserver ;設定vtp網域名稱相同

switch(config)#vtp password ;設定發vtp密碼

switch(config)#vtp server ;設定vtp伺服器模式

switch(config)#vtp client ;設定vtp客戶機模式

交換機設定ip位址,預設閘道器,網域名稱,網域名稱伺服器,配置和檢視mac位址表:

switch(config)#inte***ce vlan 1 ;進入vlan 1

switch(config-if)#ip address 192.168.1.1 255.255.255.0 ;設定ip位址

switch(config)#ip default-gateway 192.168.1.6 ;設定預設閘道器

switch(config)#ip domain-name cisco.*** 設定網域名稱

switch(config)#ip name-server 192.168.1.18 設定網域名稱伺服器

switch(config)#mac-address-table? 檢視mac-address-table的子命令

switch(config)#mac-address-table aging-time 100 設定超時時間為100ms

switch(config)#mac-address-table permanent 0000.0c01.bbcc f0/3 加入永久位址在f0/3埠

switch(config)#mac-address-table restricted static 0000.0c02.bbcc f0/6 f0/7 加入靜態位址目標埠f0/6源埠f0/7

switch(config)#end

switch#show mac-address-table 檢視整個mac位址表

switch#clear mac-address-table restricted static 清除限制性靜態位址

交換機埠加入vlan

將多個埠加入到vlan2

switch(config)#inte***ce range fa 0/17-24

switch(config-if-range)#switchport access vlan 2

單個埠加入vlan

switch(config)#inte***ce f0/1

switch(config-if-range)#switchport access vlan 2

交換機的埠和mac位址表的設定

2960交換機配置埠屬性

switch#conf t

switch#inte***ce ether*** 0/1

進入第1個埠

switch#description switch-e0/1-pc1

給埠寫入注釋資訊

switch#duplex auto/full/full-flow-control/half

設定埠的工作模式

switch#port secure

啟用埠安全性

switch#port secure max-mac-count 1

設定該埠允許對應的mac位址數(預設132個)

switch#sh mac-address-table security

檢視埠安全性

2912交換機配置埠屬性

switch#conf t

進入全域性配置模式

switch#inte***ce fastether*** 0/1

進入第1個埠

switch#description switch-f0/1-pc1

給埠寫入注釋資訊

switch#duplex auto/full/half

設定埠的工作模式

switch#port security

啟用埠安全性

switch#port security max-mac-count 1

設定該埠允許對應的mac位址數(預設132個)

switch#end

返回特權模式

switch#sh port security

檢視埠安全性

配置和檢視mac位址表

1924交換機配置mac位址表

switch#mac-address-table aging-time 600

設定動態位址超時時間

switch#mac-address-table permanent 0000.0cdd.5a4d e0/3

定義永久mac位址(繫結mac位址)

switch#mac-address-table restricted static 0000.0cdd.aaed e0/6 e0/7

定義受限mac位址

switch#address-violation disable/ignore/suspend

定義位址安全違規

switch#show mac-address-table

檢視上述配置

switch#clear mac-addr restric static

清除受限mac位址表項

2912交換機配置mac位址表

switch#mac-address-table aging-time 700

設定動態位址超時時間

switch#mac-address-table static 0000.0cdd.5a4d e0/3

定義永久mac位址(繫結mac位址)

switch#mac-address-table secure 00d0.f80d.3333 f0/3 vlan 1

定義受限mac位址

switch#port security action shutdown/trap

定義位址安全違規

switch#show port security

檢視上述配置

配置vtp、vlan、vlan trunk和stp

配置vtp

switch#conf t

switch#vtp server

定義vtp的工作模式

switch#vtp domain cisco

定義vtp的網域名稱

switch#trunk on

啟用幹道

switch#vtp domain cisco

加入vtp域

switch#vtp client

定義vtp的工作模式

switch#trunk on

啟用幹道

switch#show trunk b

switch#show trunk b allowed-vlans

檢視幹道資訊

配置vlan

switch#vlan 10 dept1

switch#vlan 20 dept2

switch#vlan 30 dept3

switch#vlan 40 dept4

定義所需vlan

switch#show vlan

檢視vlan資訊

switch#show vlan

switch#show vtp

檢視vtp的資訊

switch#int e0/1

switch#vlan-membership static 10

switch#int e0/2

switch#vlan-membership static 20

switch#int e0/3

switch#vlan-membership static 30

switch#int e0/4

switch#vlan-membership static 40

把介面劃入各自vlan

配置spanning tree

switch#spantree 1

啟用生成樹協議

switch#sh spantree 1

檢視生成樹資訊

switch#no spantree 1

關閉生成樹協議

switch#sh spantree 1

檢視生成樹資訊

交換機上遮蔽個別mac位址方法

configure terminal

inte***ce gigabitether*** 0/20

switchport

sw mode acc

sw port-sec

sw port-sec mac-add [macaddress]

sw port-sec max 1

sw port-sec violation restrict

如何查詢交換機的IP地址,如何檢視交換機的ip地址

一般需要配置的網路裝置如交換機,路由器等的ip都是閘道器ip。看一下你連交換機電腦的閘道器。還有,一般企業中的交換機都是充當一根網線分多根用的,都不帶配置介面,除了一些高檔的中心交換機,帶路由的,支援配置。另外,有些交換機可以配。但是需要telnet上去才能配。沒有web配置介面的。如果,交換機上一...

華為交換機怎樣查mac對應埠,華為交換機怎樣查MAC對應埠

1 首先連線交換機,可以通過遠端登入到交換機。2 找到本機的mac位址,這個可以在命令列中輸入 ipconfig all 來進行查詢。找到當前網絡卡位址。3 之後在交換機中輸入命令 dis mac address 448a 5be2 5800 就可以查到這個mac位址所對應的埠。4 可以輕鬆的看到結...

華為交換機配置問題華為交換機配置問題

1.你這個是華三的交換機,不是華為的 2.h3c的裝置跟中興一樣要用命令來指定乙個管理vlan,否則無法配置別的vlan虛介面 3.你可以這麼試試看 inte ce valn inte ce 1undo ip address shudown undo inte ce valn inte ce 1ma...