思科网络基础配置命令大全(二)
【歡迎關注微信公眾號:廈門微思網絡】
一、靜態路由
?
?
??Ip route x.x.x.x(網段)?x.x.x.x( 子網掩碼)?x.x.x.x/出接口(下一跳) (盡量用下一跳地址,出接口會產生 ARP ?消息)
?
1
默認路由:
? ?Ip route 0.0.0.0 0.0.0.0 x.x.x.x(下一跳) ?
?
2
黑洞路由:
? ?IP route x.x.x.x x.x.x.x null 0?將不需要的流量丟棄到 null 0(黑洞接口)
?
3
Loopback 接口:
? ?Interface loopback 0
? ?Interface loopback 1
? ?Interface loopback 2
4
BFD雙向轉發檢測:
? ?Interface ethernet0/0
? ?Bfd interval 50 min_rx 50 multiplier 3?? ? ? 接口開啟BFD檢測,50ms發送一次探測幀,3次超時
? ?Ip route static bfd e0/0 x.x.x.x
??Ip route 1.1.1.1 255.255.255.255 e0/0 x.x.x.x?? ? 靜態路由聯動BFD
? ?Show bfd neighboor?? 查看BFD鄰居
二、動態路由
?
1
Rip:
? ?Router rip?? 啟動 rip ?進程
? ?Version 2??指定版本 ?2
? ?Network x.x.x.x??宣告網段
? ?No auto-summary?關閉自動匯總 重點!!!
? ?Default-information originate??默認路由下發
? ?Redistribute static??靜態路由重分布
?
2
EIgrp ?(cisco ?私有):
? ?Router eigrp 1??同區域同 AS ?號
? ?Network x.x.x.x x.x.x.x?(反掩碼)宣告網段
? ?No auto-summary?? 關閉自動匯總
?
3
Ospf ?:
? ?Router-id x.x.x.x ??設置 ?routeID
? ?Router ospf 1 ??啟動 ospf 進程為 ?1
? ?Network x.x.x.x x.x.x.x area 0?? 宣告網段,這里區域為 ?0
? ?Ip ospf network x.x.x.x?接口下更改 ospf ?網絡類型
? ?Show ip ospf nei??查看 ospf ?鄰居
? ?Show ip ospf interface brief??查看接口關于 ospf ?的信息
? ?Show ip route ospf??查看 ospf ?路由
? ?Show ip ospf database?? 查看 ospf ?鏈路狀態數據庫
? ?Debug ip ospf adj ??查看 ospf ?鄰居關系建立過程
? ?Debug ip ospf hello?? 查看 ospf hello 包
? ?Debug ip ospf events??查看 ospf ?相關事件
?
4
DHCP:
? ?Service dhcp??開啟 dhcp (默認開啟)
? ?IP dhcp pool name ??設置地址池名稱
? ?Network 192.168.1.0 255.255.255.0??指定可分配網段
? ?Default-router 192.168.1.254??下發網關
? ?Dns-server 8.8.8.8??下發 ?dns
? ?ip dhcp excluded-address 192.168.1.254 ??排除這個地址不做分配
? ?Pc端:interface e0/0
? ?Ip add dhcp??地址通過DHCP方式獲取
? ?DHCP ?中繼:
? ?Int vlan x
? ?Ip add x.x.x.x x.x.x.x
? ?Ip helper-address ?192.168.1.254?(dhcp 服務器上的接口) ?指向 dhcp ?服務器
? ?Show ip dhcp pool name?查看 dhcp ?地址池
三、ACL 訪問控制列表
?
1
標準 ACL:
? ??1-99 “No access-list ?一條”將會刪除整個 ACL 列表。
??
? ?Access-list 1 deny x.x.x.x x.x.x.x?拒絕某網段通過
? ?Access-list 1 permit any ?允許所有通過
? ?Inter e0/0
? ?Ip access-group 1 in?進接口下調用
? ? 配置了 ACL ?一定要在接口下調用,否則不生效,或者接口下調用了,全局下沒有這個 ACL ?也不生效。
?
2
擴展 ACL:
? ? 100-199 “No access-list ?一條”將會刪除整個 ACL 列表。
?
? ?Access-list(100-199) per/deny 協議(IP 代表所有 TCP/IP 協議)x.x.x.x(源地址)?反掩碼 端口號(選加) ?x.x.x.x(目的) 反掩碼(不加默認為 0.0.0.0)端口號(選加)Access-list 100 deny(拒絕或允許) tcp(協議) any(源地址) ?host(精確主機,) x.x.x.x ?(不加反掩碼默認為 0.0.0.0)eq 23 或者 access-list 100 deny tcp?any ?x.x.x.x 0.0.0.0 eq ?23 拒絕所有的 TCP 協議訪問 x.x.x.x 的 23端口
? ?Access-list 100 permit ip(所有 TCP/IP 協議) any(源) any(目的)?? 允許所有
? ?Int e0/1?? 進入接口
? ?Ip access-group 1 out??調用在出接口
? ?Show ip access-list ?編號??查看 ?ACL
? ?Show ip access-list int vlan x
? ?Show run | sec access-list ??查看 ACL ?配置
?
3
字符命名 ?ACL:
? Ip access-list standard(標準)/extended(擴展) name??創建命名 ACL,如果name 用數字命名,則會進入到數字 ACL 下,并不是字符命名 ACL。
? ? ? ?數字 ?ACL 下刪除一條語句就會刪除整個 ?ACL,所以可以用字符命名的方式,name 用數字來命名,這樣就會進入對應的數字 ACL 里,然后 no 編號,就可以解決數字命名里無法逐一刪除語句了。
可以逐一刪除語句,只需進入 ACL:no 編號
? ? ?Ip access-list stan ACL-A?創建命名 ACL-A 的標準 ?ACL
5 per x.x.x.x(網段) x.x.x.x(反掩碼)允許 x.x.x.x 語句 5 ?是語句編號
? ? ?10 per x.x.x.x x.x.x.x ?編號最好 0-5-10 ?中間有間隔,方便以后插入語句
?
? ? ? 15 deny any(不加也可以,ACL 最后隱藏了默認拒絕全部)
?
?
? ? ? ? 每個接口,每個方向,每種協議,只能有一個 ?ACL
? ? ? ? ACL 做 telnet 限制時,需要去 VTY 線程下調用 ACL。
? ? ? ? 交換機二層接口只能調用 In 方向的 ALC,交換機 ACL 可以調用在 SVI,或者三層接口上。
end?【歡迎關注微信公眾號:廈門微思網絡】
?
總結
以上是生活随笔為你收集整理的思科网络基础配置命令大全(二)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 送你了,思科设备基础配置命令大全(一),
- 下一篇: 【超详细】模拟器EVE的安装与使用,附下