交換路由命令及配置

Switch>用戶模式數據庫

Switch>enable 進入特權模式c#

Switch#特權模式dom

Switch#configure terminal 進入配置模式ide

Switch(config)#hostname 主機名學習

Switch(config)#enable password 明文密碼接口

Switch(config)#enable secret 密文密碼ip

Switch(config)#exit 退回到特權模式路由

Switch#show running-config 查看配置信息(存在RAM中)rem

Switch#exit 退回到用戶模式terminal

Switch#copy running-config startup-config (把RAM中的配置信息保存到NVRAM中)

Switch#show startup-config 查看NVRAM中的配置信息

ccc#erase startup-config恢復出廠默認配置

Switch(config)#interface fastethernet 0/1進入接口模式

Switch(config-if)# description wojiedeshizhangshaobodejizi 添加接口的描述信息

speed 100(10,auto) 配置接口帶寬

duplex full 配置雙工模式(全雙工)

Switch#show mac-address-table 查看MAC地址表中信息

交換機工做原理:

1. 轉發數據幀

2. 查看MAC地址表:(1)有,直接轉發 (2)沒有,廣播(除了發送端口外),迴應,交換機把MAC信息寫入MAC地址表(學習)(3)主機自身想廣播(把目的MAC改成全1)

Switch#show cdp neighbors 查看鄰居信息

Switch#show cdp  查看cdp包發送,更新,版本信息

Switch#show cdp neighbors detail 查看鄰居的詳細信息

Switch#show cdp traffic 查看cdp包的統計信息

Switch(config)#line console 0 進入邏輯接口模式(line模式)

Switch(config-line)#password 789 設置密碼

Switch(config-line)#login 調用

Switch(config)#line vty 0 4 進入邏輯接口(注:0 4 表示能夠同時有五個用戶訪問,最可能是0 15)

Switch(config-line)#password 123 設置密碼

Switch(config-line)#login調用

Switch(config)#interface vlan 1

Switch(config-if)#ip address 192.168.100.1 255.255.255.0 配置IP地址

No shutdown 激活

Switch(config)#ip default-gateway 192.168.0.253 配置交換機的網關(以便於對交換機進行遠程管理)

破解交換機密碼:

1. 重啓按着mode鍵進入mini IOS

2. Flash_init

3. Dir flash: (找到config.text文件)

4. Rename flash:config.text flash:config.xxx

5. Boot 重啓進入正常IOS

6. Dir flash:

7. Rename flash:config.xxx flash:config.text

8. Copy flash:config.text system:running-config

9. 從新設置密碼

10. Write 保存

6、交換機的工做模式:1。單工(只能收或只能發)2。半雙工(不能同時收發)3。全雙工(能夠同時收發)

7、衝突域與廣播域

交換機能夠隔離衝突域(每一個接口爲一個衝突域)

交換機是一個廣播域

第一種:

Switch#vlan database 進入VLAN數據庫

Switch(vlan)#vlan 66(1-1005) name renshi 建立VLAN並起名

Exit 保存並退出

第二種:

Switch(config)#vlan 88

Switch(config-vlan)#name caiwu

把一個端口加入VLAN

Switch(config)#interface f0/2

Switch(config-if)#switchport  access vlan 66

Switch(config)#interface range f0/3 - 13

Switch(config-if-range)#switchport access vlan 88

Switch(config)#default interface f0/1(恢復默認配置)

Switch#sh vlan

Switch#sh vlan brief查看彙總信息

Switch#sh vlan id 66

Switch(config)#int vlan 66

Switch(config-if)#description zheshirenshidevlan 給vlan添加描述信息

總結:1.把vlan刪除,vlan中的端口不屬於任何vlan

2.vlan信息存在vlan數據庫中(flash中vlan.dat文件)

配置信息存在running-config中

 

Switch(config-if)#switchport mode trunk (access) dynamic(動態) 

Switch#show interface f0/1 switchport (查看接口trunk信息)

Switch(config-if)# switchport trunk allowed vlan remove(add) vlan號

將flash 複製到ftp

Switch#copy flash ftp://aa:aa@1.1.1.1

show ip route 查看全部路由條目

show ip route rip 只查看rip路由條目

show ip rip database 查看宣告過的全部網段

show ip protocols 查看接收和宣告路由條目所使用的版本號

show protocols 查看協議狀態(up或down)

show ip interface brief  查看接口IP列表

clock rate 64000  配置DCE時鐘速率(DCE數據通訊設備)

show interfaces 查看交換機的MAC地址

在配置模式下輸入line console 0

Exec-timeout 0 0 永不超時

顯示同步:line console 0

Logging synchronous

禁用DNS查尋

配置模式下:no ip domain-lookup

三層交換起trunk:Switchport trunk encapsulation dot1q

PAT的配置

首選配置路由

(config)#ip route 0.0.0.0 0.0.0.0 173.16.1.128 #指向外網的靜態路由

(config)#access-list 1 permit 192.168.1.0 0.0.0.255 #建立訪問列表

(config)#ip nat inside source list 1 interface f0/1 overload #兩者關聯,地址重載

 (config)#int f0/0

 (config-if)#ip nat inside #將f0/0設置爲內網口

 (config)#int f0/1

 (config-if)#ip nat outside #將f0/1設置爲外網口

相關文章
相關標籤/搜索