萬盛學電腦網

您现在的位置: 萬盛學電腦網 >> 網路安全 >  >> 網路應用技術 >> 應用程式教學

Cisco 路由器核心配置指令大全:RIP、OSPF、HSRP、ACL、NAT 三模式

精簡整理 Cisco 路由器最核心的 5 大功能模組配置指令,適合考證複習與現場速查。

一、RIP 路由協定

router rip
 network 172.17.0.0
 passive-interface fastethernet 0/1
 neighbor 172.17.12.67
 version 2
 no auto-summary
interface fastethernet 0/1
 ip rip send version 1
 ip rip receive version 2
 no ip split-horizon

二、OSPF 路由協定

router ospf 10
 network 192.168.10.0 0.0.0.255 area 0
 area 1 stub
 area 1 stub no-summary          # Totally Stubby
 area 1 nssa
 area 25 range 172.16.0.0 255.240.0.0
 area 100 virtual-link 192.168.100.33

# LSA 資料庫檢視
show ip ospf database router 192.168.30.10
show ip ospf database network 192.168.17.18
show ip ospf database summary 172.16.121.0
show ip ospf database asbr-summary
show ip ospf database external 10.83.10.0
show ip ospf database nssa-external

三、HSRP 熱備份路由器協定

interface fastethernet 0/0
 standby 172 ip 172.16.10.254
 standby 47 priority 150
 standby 47 preempt
 standby 47 timers 2 9
 standby 47 track serial 0 100
show standby brief

四、ACL 存取控制清單

# 標準 ACL
access-list 1 permit 192.168.10.0 0.0.0.255
access-list 1 deny 192.168.10.2 0.0.0.255
access-list 1 permit any
access-list 1 permit host 172.30.16.29

# 延伸 ACL
access-list 101 deny tcp 172.16.4.0 0.0.0.255 172.16.3.0 0.0.0.255 eq 21

# 命名 ACL
ip access-list extended cisco

# 奏用
interface fastethernet 0/0
 ip access-group 1 in
 ip access-group 1 out

五、NAT 三種模式完整配置

1. 靜態 NAT (一對一映射,伺服器發布)

interface serial 0
 ip address 61.159.62.129 255.255.255.248
 ip nat outside
interface ethernet 0
 ip address 192.168.100.1 255.255.255.0
 ip nat inside
ip nat inside source static 192.168.100.2 61.159.62.130

2. 動態 NAT (地址池一對一,無連接埠轉換)

access-list 1 permit 192.168.100.0 0.0.0.255
ip nat pool chen 61.159.62.129 61.159.62.190 netmask 255.255.255.248
ip nat inside source list 1 pool chen
interface serial 0; ip nat outside
 interface ethernet 0; ip nat inside

3. PAT/NAPT (多對一,Overload,最常用)

access-list 1 permit 192.168.100.0 0.0.0.255
ip nat pool chen 61.159.62.129 61.159.62.190 netmask 255.255.255.248
ip nat inside source list 1 pool chen overload
interface serial 0; ip nat outside
 interface ethernet 0; ip nat inside

關鍵差異: 靜態 NAT 適合伺服器發布;動態 NAT 需公網 IP 池等同內部主機數;PAT 單一公網 IP 承載眾多內部主機,企業上網首選。

copyright © 萬盛學電腦網 all rights reserved