tft每日頭條

 > 圖文

 > 思科交換機的簡單配置

思科交換機的簡單配置

圖文 更新时间:2024-09-30 15:40:46

今天我們一起來詳細的了解思科交換機的配置命令。

一、思科交換機基本配置命令

1:進入特權模式 enable

Switch> enable

switch#

2:進入全局配置模式 configure terminal

switch> enable

switch#c onfigure terminal

switch(conf)#

3:交換機命名 hostname aptech2950 以 aptech2950 為例

switch> enable

switch#c onfigure terminal

switch(conf)#hostname aptch-2950

aptech2950(conf)#

4:配置使能口令 enable password cisco 以 cisco 為例

switch> enable

switch#c onfigure terminal

switch(conf)#hostname aptch2950

aptech2950(conf)# enable password cisco

5:配置使能密碼 enable secret ciscolab 以 cicsolab 為例

switch> enable

switch#c onfigure terminal

switch(conf)#hostname aptch2950

aptech2950(conf)# enable secret ciscolab

6:創建多個VLAN

1、創建多個VLAN

Switch>enable (進入特權模式)

Switch#vlan data (進入vlan配置模式)

Switch(vlan)#vlan 10 name IT (劃分vlan10,名稱為IT)

Switch(vlan)#vlan 20 name HR (劃分vlan20,名稱為HR)

Switch(vlan)#vlan 30 name FIN (劃分vlan30,名稱為FIN)

Switch(vlan)#vlan 40 name LOG (劃分vlan40,名稱為LOG)

Switch(vlan)#exit

7:設置 vlan 1

switch> enable

switch#c onfigure terminal

switch(conf)#hostname aptch2950

aptech2950(conf)# interface vlan 1

aptech2950(conf-if)#ip address 192.168.1.1 255.255.255.0 配置交換機端口 ip 和子網掩碼

aptech2950(conf-if)#no shut 是配置處于運行中

aptech2950(conf-if)#exit

aptech2950(conf)#ip default-gateway 192.168.254 設置網關地址

8:進入交換機某一端口 interface fastehernet 0/17 以 17 端口為例

switch> enable

switch#c onfigure terminal

switch(conf)#hostname aptch2950

aptech2950(conf)# interface fastehernet 0/17

aptech2950(conf-if)#

9:查看命令 show

switch> enable

switch# show version 察看系統中的所有版本信息

show interface vlan 1 查看交換機有關 ip 協議的配置信息

show running-configure 查看交換機當前起作用的配置信息

show interface fastethernet 0/1 察看交換機 1 接口具體配置和統計信息

show mac-address-table 查看 mac 地址表

show mac-address-table aging-time 查看 mac 地址表自動老化時間

10:交換機恢複出廠默認恢複命令

switch> enable

switch# erase startup-configure

switch# reload

11:雙工模式設置

switch> enable

switch#c onfigure terminal

switch2950(conf)#hostname aptch-2950

aptech2950(conf)# interface fastehernet 0/17 以 17 端口為例

aptech2950(conf-if)#duplex full/half/auto 有 full , half, auto 三個可選

11:cdp 相關命令

switch> enable

switch# show cdp 查看設備的 cdp 全局配置信息

show cdp interface fastethernet 0/17 查看 17 端口的 cdp 配置信息

show cdp traffic 查看有關 cdp 包的統計信息

show cdp nerghbors 列出與設備相連的 cisco 設備

12:交換機 telnet 遠程登錄設置:

switch>en

switch#c onfigure terminal

switch(conf)#hostname aptech-2950

aptech2950(conf)#enable password cisco 以 cisco 為特權模式密碼

aptech2950(conf)#interface fastethernet 0/1 以 17 端口為 telnet 遠程登錄端口

aptech2950(conf-if)#ip address 192.168.1.1 255.255.255.0

aptech2950(conf-if)#no shut

aptech2950(conf-if)#exit

aptech2950(conf)line vty 0 4 設置 0-4 個用戶可以 telnet 遠程登陸

aptech2950(conf-line)#login

aptech2950(conf-line)#password edge 以 edge 為遠程登錄的用戶密碼

主機設置:

ip 192.168.1.2 主機的 ip 必須和交換機端口的地址在同一網絡

netmask 255.255.255.0

gate-way 192.168.1.1 網關地址是交換機端口地址

運行:

telnet 192.168.1.1

進入 telnet 遠程登錄界面

password : edge

aptech2950>en

password: cisco

aptech#

二、利用三層交換機,實現不同vlan間互相通信

上面我們了解了思科交換機的基本配置命令,下面我們來看下配置案例。

案例如下:

pc1與pc2由于阻絕在了兩個不同的交換機裡,且在不同的vlan中,是無法通信的,那怎麼辦呢?

S3550-24(三層交換機)1台、S2126交換機1台、pc1在vlan10裡,pc2在vlan20裡,如下圖所示。

思科交換機的簡單配置(思科交換機配置命令大全)1

VLAN間通信實驗拓撲結構圖

配置如下:

1、在交換機SwitchA上創建VLAN 20,并将F0/15口劃分到VLAN 20中。

SwitchA>enable

SwitchA#configure terminal

SwitchA(config)#vlan20 //創建VLAN 20

SwitchA(config-vlan)#name vlan20 //将VLAN 20 命名為vlan20

SwitchA(config)#interface f0/15 //進入F0/15接口配置模式

SwitchA(config-if)#switchport access vlan 20 //将F0/15端口劃入VLAN 20

SwitchA #showvlan id 20 //驗證已創建了VLAN 20并已将F0/15端口劃入VLAN 20中。

2、在交換機SwitchA上與SwitchB相連的端口(此處為F0/24端口)定義為tag vlan 模式。

SwitchA>enable

SwitchA#configure terminal

SwitchA (config)#interface f0/24 //進入接口配置模式

SwitchA (config-if)#switchport mode trunk //将F0/24口設置為tag vlan模式

SwitchA (config)#show interfaces f0/24 switch //驗證F0/24口已被設置為tag vlan模式

3、在交換機SwitchB上創建VLAN 10,并将F0/5端口劃入VLAN 10中。

SwitchA>enable

SwitchA#configure terminal

SwitchB(config)#vlan 10 //創建VLAN 10

SwitchB (config-vlan)#name vlan10 //将VLAN 10 命名為vlan

SwitchB (config)#interface f0/5 //進入F0/5接口配置模式

SwitchB (config-if)#switchport access vlan10 !将F0/5端口劃入VLAN 10

SwitchB #show vlan id 10 //驗證已創建了VLAN 10并已将F0/5端口劃入VLAN 10中

4、在交換機SwitchB上與SwitchA相連的端口(此處為F0/24端口)定義為tag vlan 模式。

SwitchA>enable

SwitchA#configure terminal

SwitchB (config)#interface f0/24 //進入接口配置模式

SwitchB (config-if)#switchport mode trunk //将F0/24口設置為tag vlan模式

SwitchB (config)#show interfaces f0/24 switch //驗證F0/24口已被設置為tag vlan模式。

5、設置三層交換機VLAN 間通訊,開啟三層交換機的路由功能

SwitchA>enable

SwitchA#configure terminal

SwitchA(config)#ip routing //開啟三層交換機的路由功能

SwitchA(config) #interface vlan 10 //創建虛拟接口vlan10

SwitchA(config-if) #ip address 192.168.10.254 255.255.255.0 //配置vlan10的虛拟接口ip地址

SwitchA(config) #interface vlan 20 //創建虛拟接口vlan20

配置vlan20的虛拟接口ip地址

SwitchA(config-if) #ip address 192.168.20.254 255.255.255.0 //配置vlan20的虛拟接口ip地址

5、配置默認網關

将PC1的默認網關設置為192.168.10.254,将PC2的默認網關設置為192.168.20.254

如此,pc1與pc2便可以相互通。

,

更多精彩资讯请关注tft每日頭條,我们将持续为您更新最新资讯!

查看全部

相关圖文资讯推荐

热门圖文资讯推荐

网友关注

Copyright 2023-2024 - www.tftnews.com All Rights Reserved