思科模擬器常用命令總結

xiaoxiao亮發表於2017-03-20

最近在思科模擬器上做無線網路搭建的實驗。原例是PT-練習上的WRT300N無線路由器練習,這裡將用到的一些命令做一個總結。之前做實驗敲的命令較少,而這個是隻能手動輸入命令。在網上查詢有些命令花費了不少時間,最重要的是記住命令,而不是花費太多的時間在查詢命令。這個實驗還沒做完,有一個環節命名的問題,按照正確的操作步驟,但還是出現問題,找不到解決的方法。雖然對最終的結果不會有影響,但是,還是不想在往下做了。

常用命令

路由器命令

1,路由器口令設定:

router>enable                           進入特權模式
router#config terminal                  進入全域性配置模式
router(config)#hostname <hostname>      設定交換機的主機名
router(config)#enable secret xxx        設定特權加密口令
router(config)#enable password xxb      設定特權非密口令
router(config)#line console 0           進入控制檯口
router(config-line)#line vty 0 4        進入虛擬終端
router(config-line)#login               要求口令驗證
router(config-line)#password xx         設定登入口令xx
router(config)#(Ctrl+z)                 返回特權模式
router#exit                             返回命令

2,路由器配置:

router(config)#int s0/0                             進入Serail介面
router(config-if)#no shutdown                       啟用當前介面
router(config-if)#clock rate 64000                  設定同步時鐘
router(config-if)#ip address <ip> <netmask>         設定IP地址
router(config-if)#ip address <ip> <netmask> second  設定第二個IP
router(config-if)#int f0/0.1                        進入子介面
router(config-subif.1)#ip address <ip> <netmask>    設定子介面IP
router(config-subif.1)#encapsulation dot1q <n>      繫結vlan中繼協議
router(config)#config-register 0x2142               跳過配置檔案
router(config)#config-register 0x2102               正常使用配置檔案
router#reload                                       重新引導

3,路由器檔案操作:


router#copy running-config startup-config           儲存配置
router#copy running-config tftp                     儲存配置到tftp
router#copy startup-config tftp                     開機配置存到tftp
router#copy tftp flash:                             下傳檔案到flash
router#copy tftp startup-config                     下載配置檔案
ROM狀態:
Ctrl+Break                                          進入ROM監控狀態
rommon>confreg 0x2142                               跳過配置檔案
rommon>confreg 0x2102                               恢復配置檔案
rommon>reset                                        重新引導
rommon>copy xmodem:<sname> flash:<dname>            從console傳輸檔案
rommon>IP_ADDRESS=10.65.1.2                         設定路由器IP
rommon>IP_SUBNET_MASK=255.255.0.0                   設定路由器掩碼
rommon>TFTP_SERVER=10.65.1.1                        指定TFTP伺服器IP
rommon>TFTP_FILE=c2600.bin                          指定下載的檔案
rommon>tftpdnld                                     從tftp下載
rommon>dir flash:                                   檢視快閃記憶體內容
rommon>boot                                         引導IOS

4,靜態路由:

ip route <ip-address> <subnet-mask> <gateway>       命令格式
router(config)#ip route 2.0.0.0 255.0.0.0 1.1.1.2   靜態路由舉例
router(config)#ip route 0.0.0.0 0.0.0.0 1.1.1.2     預設路由舉例

5,動態路由:

router(config)#ip routing                          啟動路由轉發
router(config)#router rip                          啟動RIP路由協議。
router(config-router)#network <netid>              設定釋出路由
router(config-router)#negihbor <ip>                點對點幀中繼用。

6,幀中繼命令:

router(config)#frame-relay switching               使能幀中繼交換
router(config-s0)#encapsulation frame-relay        使能幀中繼
router(config-s0)#fram-relay lmi-type cisco        設定管理型別
router(config-s0)#frame-relay intf-type DCE        設定為DCE
router(config-s0)#frame-relay dlci 16              
router(config-s0)#frame-relay local-dlci 20        設定虛電路號
router(config-s0)#frame-relay interface-dlci 16 
router(config)#log-adjacency-changes             記錄鄰接變化
router(config)#int s0/0.1 point-to-point         設定子介面點對點
router#show frame pvc                            顯示永久虛電路
router#show frame map                            顯示對映

7,基本訪問控制列表:

router(config)#access-list <number> permit|deny <source_ip> <wild|any>
router(config)#interface <interface>             ;default:deny any
router(config-if)#ip access-group <number> in|out   ;defaultut
1:
router(config)#access-list 1 deny host 10.65.1.1
router(config)#access-list 1 permit any
router(config)#int f0/0
router(config-if)#ip access-group 4 in2:
router(config)#access-list 4 permit 10.8.1.1
router(config)#access-list 4 deny 10.8.1.0 0.0.0.255
router(config)#access-list 4 permit 10.8.0.0 0.0.255.255
router(config)#access-list 4 deny 10.0.0.0 0.255.255.255
router(config)#access-list 4 permit any
router(config)#int f0/1
router(config-if)#ip access-group 4 in
擴充套件訪問控制列表:
access-list <number> permit|deny icmp <S_IP wild> <D_IP wild>[type]
access-list <number> permit|deny tcp <S_IP wild> <D_IP wild>[port]
例1:
router(config)#access-list 101 deny icmp any 10.64.0.2 0.0.0.0 echo
router(config)#access-list 101 permit ip any any
router(config)#int s0/0
router(config-if)#ip access-group 101 in2:
router(config)#access-list 102 deny tcp any 10.65.0.2 0.0.0.0 eq 80
router(config)#access-list 102 permit ip any any
router(config)#interface s0/1
router(config-if)#ip access-group 102 out
刪除訪問控制例表:
router(config)#no access-list 102
router(config-if)#no ip access-group 101 in
路由器的nat配置
Router(config-if)#ip nat inside              當前介面指定為內部介面
Router(config-if)#ip nat outside             當前介面指定為外部介面
Router(config)#ip nat inside source static [p] <私有IP><公網IP> [port]
Router(config)#ip nat inside source static 10.65.1.2 60.1.1.1
Router(config)#ip nat inside source static tcp 10.65.1.3 80 60.1.1.1 80
Router(config)#ip nat pool p1 60.1.1.1 60.1.1.20 255.255.255.0
Router(config)#ip nat inside source list 1 pool p1
Router(config)#ip nat inside destination list 2 pool p2
Router(config)#ip nat inside source list 2 interface s0/0 overload
Router(config)#ip nat pool p2 10.65.1.2 10.65.1.4 255.255.255.0 type rotary
Router#show ip nat translation
rotary 引數是輪流的意思,地址池中的IP輪流與NAT分配的地址匹配。
overload引數用於PAT 將內部IP對映到一個公網IP不同的埠上。
外部閘道器協議配置
routerA(config)#router bgp 100
routerA(config-router)#network 19.0.0.0
routerA(config-router)#neighbor 8.1.1.2 remote-as 200
配置PPP驗證:
RouterA(config)#username <RouterB> password <word>
RouterA(config)#int s0
RouterA(config-if)#ppp authentication {chap|pap}

8,路由器子介面封裝為8021Q (補充)

Encapsulation dot1q 2      封裝型別設定為 802.1Q,2是子介面號標識,這裡是示範,可以隨意設定。

結束

資料來自於網上,自己在做實驗的時候參考了這份資料,很感謝提供資料的網友,這裡將自己遇到的有些問題的命令做個補充。如果發現有錯誤的話,歡迎指出,有些命令自己也沒有試過。後續還會更新交換機的相關命令。

相關文章