CCNA實驗筆記
基礎:
1、修改名稱 全 hostname **
2、準備工作 全 no ip domain-lookup 關閉域名解析
接 no exec-timeout 關閉退出時間
接 logging synchronous 日誌同步
密碼設置:
1、enable password ***
service password-encryption (啓動明文密碼加密)
2、enable secret ***
登錄設備:
1、console
全 line console 0
no exec-timeout
logging synchronous
login
password *** (配置登錄密碼)
2、telnet
全 line vty 0 4
login
password ***
3、SSH
全 username *** password ***
line vty 0 4
login local
transport input ssh (all是默認的、 none)
全 ip domain-name ***
crypto key generate rsa
登錄:特 ssh -l ***(username) *** (IP地址)
password ***
CDP 思科發現協議 (數據鏈路層協議)
show cdp neighbors
show cdp entry *
全 no cdp run (關閉全部)
接 no cdp enable (關閉某個接口的CDP)
密碼恢復:
1、Router:重啓router & Ctrl+break ——miniIOS ——confreg 0x2142——reload
——copy start run ——改密碼——config-register 0x2102——copy run start
2、Switch: 重啓按mode——改config.text 爲 其他後綴文件 (rename flash:config.text flash:config.***)
重啓——rename flash:config.*** flash:config.text——copy flash:config.text running-config ——改密碼+保存
DHCP:
全 ip dhcp pool ***(name)
network 192.168.1.0 255.255.255.0(任意可用網段和子網掩碼)
default-router 192.168.1.1 (網段裏的默認路由的IP地址)
dns-server 8.8.8.8 (DNS服務器的IP地址 )
全 ip dhcp excluded-address 192.168.1.2(起始地址) 192.168.1.10(終點地址)
全 ip dhcp excluded-addess 192.168.1.1 (除去網關IP地址)
VLAN:
1、創建一個VLan
全 vlan **(ID 1-4096)
name ***
2、將接口放入Vlan
接 switchport mode access
switchport access vlan **(ID)
注:將多個連續的接口加入VLan 可以用 range
全 interface range f 0/11 - 15
3、Vlan間的通信——將接口配爲trunk
接 switchport mode trunk
4、VTP 用於傳遞Vlan配置信息 工作在trunk 鏈路上
全 vtp domain ***(域名)
vtp password ***(密碼)
vtp mode server/client/transparent (server是默認的)
vtp pruning (vtp 修剪)
show vtp status
show vtp password
注:接口不屬於VTP,要自己去分配
STP:
接 switchport mode access
spanning-tree portfast
爲路由器接口設置trunk
全 interface f 0/0.2(進入子接口)
子接口 encapsulation dot1q **(Vlan ID)
子接口 ip address 192.168.1.1 255.255.255.0(子接口IP)
交換機安全:
SwitchX(config-if)#switchport port-security [mac-address mac-address
|mac-address sticky [mac-address]|maximum value | violation {restrict | shutdown}]
SwitchX(config)#interface fa0/5
SwitchX(config-if)#switchport mode access
SwitchX(config-if)#switchport port-security
SwitchX(config-if)#switchport port-security maximum 1
SwitchX(config-if)#switchport port-security mac-address sticky
SwitchX(config-if)#switchport port-security violation shutdown
靜態路由:
全 ip route 192.168.23.0 255.255.255.0(目的網段IP地址和子網掩碼) 192.168.1.12(下一跳IP地址)
全 ip route 192.168.23.0 255.255.255.0(目的網段IP地址和子網掩碼) f 0/0 (接口號 這種多用於點對點的情況)
默認路由:
全 ip route 0.0.0.0 0.0.0.0 192.2.3.1(嚇一跳IP地址)
環回口:
全 interface loopback (這和其他接口一樣 但是是默認打開的)
RIP:
全 router rip(打開rip 協議)
version 1/2 (默認是v1)
network 192.168.2.0 (申明網段 可以申明多個網段)
EIGRP:
全 router eigrp 100(自治系統號1-65535)
network 192.168.2.0(申明路由器上的網段 可以申明多個)
no auto-summary (關閉自動彙總)
show ip eigrp neighbors
show ip eigrp topology
OSPF:
全 router ospf 1(路由進程號 本地有效)
** network 192.168.2.0 0.0.0.255(通配符) area 0(區域號) (申明路由上的網段 可以申明多個)
show ip ospf neighbors
show ip protocols
特 clear ip route(重新運算協議)
全 no router rip/eigrp/ospf(刪除某個路由協議的全部配置
ACL:
1、標準
全 access-list **(ID 1-99 1300-1999) permit/deny 源地址+通配符(0表示匹配)
接 ip access-group **(ID) in/out
全 no access-list **(ID) (表示刪除整個ID的ACL)
注:在所有列表中 有隱含拒絕全部的語句(access-list **ID deny any)
2、擴展
全 access-list **(ID 100-199 2000-2699) permit/deny pro(協議) 源地址+通配符 目的地址+通配符 eq 端口號/共識協議
接 ip access-group ID in/out
3、命名
全 ip access-list standard/extended ***(name)
進入列表 接着原來的命令繼續寫
NAT:
1、靜態 nat
全 ip nat inside source static 內網IP 外網IP
接 ip nat inside/outside
2、動態 nat
全 access-list **(ID) permit 內網段+通配符
全 ip nat pool ***(name) 外網IP起始地址 外網IP終止地址 netmask 子網掩碼
全 ip nat insde source list **(ID) pool **(name)
3、PAT
全 access-list **(ID) permit 內網段+通配符
全 ip nat pool ***(name) 外網IP起始地址 外網IP終止地址 netmask 子網掩碼
全 ip nat insde source list **(ID) pool **(name) overload
4、特 clear ip nat translation *(星號)
特 show ip nat translations
5、刪除一個NAT
全 no ip nat inside source list **(ID) pool **(name) overload (清除映射關係)
全 no ip nat pool **(name) (刪除地址池)
全 no access-list **(ID)
PPP:
1、PAP (R1是客戶端 R2是服務端)
R2 全 username **(name) password *** (在R2上創建用戶名數據)
接 PPP authentication pap
R1 接 ppp pap sent-username **(name) password *** (啓用pap認證)
2、CHAP
R1、R2 全 username ***(對端的主機名) password ***
R1、R2 接 ppp authentication chap (對應的接口下封裝chap)
注 接口默認的封裝是dhlc