# PACKET TRACER的筆記 ## 常用指令 參考文章:https://home.gamer.com.tw/creationDetail.php?sn=3022918 若點開檔案沒有出現題目,則按照以下步驟 FILE->open->選擇檔案 ### 進入管理者模式:  enable(或者en) . ### 進入組態模式:  conf t . . ### 設定機器名稱 hostname 名稱 . . ### 中斷搜尋:  ctrl + shift + 6 . . . ### 新增子介面: int fa0/0.10 encapsulation dot1Q 10 ##使用802.1q協定並加上Vlan 10標籤 show ip interface brief #查看介面狀態 . . ### 設定路由器單臂路由(Router on a Stick;Router 對 VLAN) //page 10-38 >conf t > >int f0/0 > >no shut > >int f0/0.10 //建立子介面10 > >encapsulation dot1Q 10 //在10的子介面下啟動 802.1Q 的 TRUNK 協定;10代表Vlan 10 ip addr 192.168.10.254 255.255.255.0 > >int f0/0.20 //建立子介面20 > >encapsulation dot1Q 20 //在20的子介面下啟動 802.1Q 的 TRUNK 協定;20代表Vlan 20 > >ip addr 172.30.10.254 255.255.255.0 > ### 設定密碼 >Privileged EXEC Mode conf t enable secret nscenpa //secret 為密文密碼                       password為明文密碼     >Console line console 0 password nscloginpa login //啟用密碼 >VTY line vty 0 15 password nscloginpa login ///若輸入完密碼要直接進入特權模式則須多打 pri vilege level 15 . .  .  #### 使用ACL 控制VTY連線: access list 11 permit host 192.168.1.1 line vty 0 4 access-class 11 in ### 設定SERIAL介面連線速率: int s0/0 clock rate 128000 ### 修改附載平衡 >port-channel load-blance ? > >port-channel load-blance dst-mac ### 關閉網路設備的自動埆換網路線功能(auto-MDIX; Medium-Dependent interface Crossover) >en > > conf t > >int fa0/1 > > no mdix auto ### 停用 VTP 協定 ``` vtp mode transparent ```   ### 停用 DTP 協定 >switchport nonegotiate //如果先前是設定 dynamic 不可停止,需變更 ### 查詢 >看 running 組態檔內容: show run(runing-config) >看 startup 組態檔內容: show start(startup-config) >看 flash(存放 IOS)內容: show flash >詢路由資訊: show ip route >查詢網路介面: show ip int brief >查詢登入狀況: show users >詢路由器軟體資訊: show version >查看網卡狀態/MAC位址/雙工模式/速度: show int fa0/1 >顯示啟動開始執行過的指令:  show history //設定儲存歷史指令的大小               terminal history size >查看vlan  show vlan brief .  show vlan vlan 20 .  show interface vlan 20 .  show interface trunk .  show interface fa0/1 switchport >看 RIP show ip route (ip 位址) >查看 ospf  show ip protocols .  show ip ospf neighbor .  show ip ospf database .  show ip ospf interface serial 0/0/0 >查詢 TRUNK 協定 show int trunk ## RIP V1 V2 無論是哪種版本的RIP路由協議,都是同屬於距離矢量路由協議的,所以周期性的更新,全路由表擴散 http://www.clyeh.org/iprip/iprip.htm http://www.tsnien.idv.tw/Manager_WebBook/chap7/7-5%20RIPv2%E7%B9%9E%E8%B7%AF%E5%8D%94%E5%AE%9A%E8%88%87%E8%A8%AD%E5%AE%9A.html ``` RIP V1 1、有類路由協議(classful) 不支持不連續的子網 用的是廣播 2、不支持變長子網掩碼(VLSM) 3、更新方式為廣播 4、不支持認證 5、每個更新包最大支持25條路由條目 6、路由表查詢方式由大類-->小類(即先查詢主類網絡,再查詢子網號) 7、不支持不連續子網 8、不支持全0、全1子網 ``` classful routing protocol (分級路由協定) 屬於這類性質的routing protocol只看得懂A,B,或C級網路位址,所以它並不支援可變長度的子網路之設定. 這類routing protocol有 RIPv1 和 IGRP. . ``` RIP V2 1、無類路由協議(classless) 支持不連續的子網 用no all-sumary 取消自動匯總 用的是群播 2、支持變長子網掩碼(VLSM) 3、路由更新方式為多播,目的地址為224.0.0.9 4、支持明文及密文認證(思科私有) 5、每個更新包視認證方式不同,支持路由條目數為24或23條 6、路由表查詢機制是由小類-->大類(按位查詢,最長匹配、精確匹配,先檢查32位掩碼的) 7、支持不連續子網 8、支持全0、全1子網 ``` classless routing protocol (不分級路由協定) 反之,屬於這類性質的routing protocol支援可變長度的子網路之設定. 這類routing protocol有 RIPv2 和 OSPF 和 EIGRP. . ``` 由於 internet 發展迅速, IP 位址分配不足,以及 routing table 資料庫日益龐大造成, router loading 加重. 因此衍伸出 VLSM 和 CIDR 兩種技術,其簡單說明如下: VLSM (Variable Length Subnet Masking) 可將一個完整的 Classful 的 IP 網段"切割"成若干的子網、subnet 來使用的技術. CIDR (Classless Inter-Domain Routing) 可將若干個連續的 Classful 的 IP 網段"組合"成一個較大的網路、Supernet 來使用的技術. ``` >RIPV2的基本設定 >R1(config)#router rip [進入設定 rip 繞路功能] R1(config-router)#version 2 [選擇 RIPv2 版本] R1(config-router)#network 192.168.0.0 [設定網路管轄範圍] R1(config-router)#network 192.168.100.0 [設定網路管轄範圍] ## DHCP POOL (config)#ip dhcp pool pool1 建立位址儲備池,並命名為pool1 (dhcp-config)#network 10.0.0.0 255.255.255.0 指定要分配的IP範圍(10.0.0.0為Network ID) (dhcp-config)#default-router 10.0.0.254 設定預設閘道 (dhcp-config)#dns-server 8.8.8.8 設定DNS (dhcp-config)#exit 回到全域模式 (config)#ip dhcp exclude-address 10.0.0.200 10.0.0.254 指定10.0.0.200 ~ 10.0.0.254不配發 查詢DHCP池使用狀況 #show ip dhcp binding ## STP (Spanning Tree Protocol) https://www.twblogs.net/a/5c421bdbbd9eee35b21e9933 http://blog.sina.com.cn/s/blog_9950926401018bj6.html http://systw.net/note/af/sblog/more.php?id=222 https://blog.xuite.net/ivan1193/blog/7801194-Spanning+Tree+Protocol+ https://johnson560.pixnet.net/blog/post/310873077-ccna-stp%28spanning-tree-protocol%E6%93%B4%E5%BC%B5%E6%A8%B9%E5%8D%94%E5%AE%9A%29 . . 802.1d --> STP 802.1w -->RSTP . . ### RSTP對STP的改進  >1 STP收斂主要依赖port status RSTP收斂主要依赖port type 2 STP port state改變,需依賴timer超時 RSTP port state改變,是主動協商 #### 停用 STP 功能 >no spanning-tree vlan 1 #### 顯示STP設定 >spanning-tree mode rapid-pvst > #### 不經過學習直接進入Forward狀態 >spanning-tree portfast > #### 設定AS1 為VLAN10的Primary Root Bridge >spanning-tree vlan 10 priority 0 > #### 指定 Vlan 的 STP Root 交換器 //page 11-51 conf t spanning-tree vlan 10 root primary spannong-tree vlan 20 root primary