「緯育 2026-0608」修訂間的差異

出自頂極製作所
行 1: 行 1:
== S1 ==
* VLAN12
** vlan 12
** name RD
* VLAN13
** vlan 13
** name sales
* VLAN14
** vlan 14
** name IT
* VLAN99
** vlan 99
** name MGMT
** exit
** interface vlan 99
** ip address 10.1.99.101 255.255.255.0
** no shutdown
** exit
* trunk allowed VLAN
** interface range fa0/23 - 24
** switchport mode trunk
** switchport trunk allowed vlan 12,13,14,99
** no shutdown
** exit
** ip default-gateway 10.1.99.254
* S1 to R1 Trunk
** configure terminal
** interface fa0/5
** switchport mode trunk
** switchport trunk allowed vlan 12,13,14,99
** no shutdown
** exit
* Fa0/21
** interface fa0/21
** switchport mode access
** switchport access vlan 99
** no shutdown
* Fa0/11
** interface fa0/11
** switchport mode access
** switchport access vlan 12
** no shutdown
** exit
* Fa0/15
** interface fa0/15
** switchport mode access
** switchport access vlan 13
** no shutdown
** exit


=== 單機設定 ===
{| class="wikitable"
* S1 網管 IP
! 類別
** 10.1.99.101
! 設備 / 位置
** 255.255.255.0
! 設定數值
** 10.1.99.254
! 輸入指令
* VLAN12-RD1
! 系統回應 / 驗證結果
** 10.1.12.17
! 說明
** 255.255.255.240
|-
** 10.1.12.30
* VLAN13-Sales1
** 10.1.13.25
** 255.255.255.248
** 10.1.13.30
* Mgmt Server IP
** 10.1.99.100
** 255.255.255.0
** 10.1.99.254


== S2 ==
| 終端設備
* VLAN12
| S1 網管 IP
** vlan 12
| IP:10.1.99.101<br>Mask:255.255.255.0<br>Gateway:10.1.99.254
** name RD
| <pre>
* Fa0/11
在 Switch S1 的 Config / VLAN Interface 或 CLI 設定:
** interface fa0/11
interface vlan 99
** switchport mode access
ip address 10.1.99.101 255.255.255.0
** switchport access vlan 12
no shutdown
** no shutdown
exit
* VLAN13
ip default-gateway 10.1.99.254
** vlan 13
</pre>
** name sales
| <pre>
* VLAN14
show ip interface brief
** vlan 14
** name IT
* VLAN99
** vlan 99
** name MGMT
** exit
** interface vlan 99
** ip address 10.1.99.102 255.255.255.0
** no shutdown
** exit
** ip default-gateway 10.1.99.254
* trunk allowed VLAN
** interface range fa0/23 - 24
** switchport mode trunk
** switchport trunk allowed vlan 12,13,14,99
** no shutdown
* Fa0/15
** interface fa0/15
** switchport mode access
** switchport access vlan 13
** no shutdown
** exit
* Fa0/19
** interface fa0/19
** switchport mode access
** switchport access vlan 14
** no shutdown
** exit
=== 單機設定 ===
* S2 IP
** 10.1.99.102
** 255.255.255.0
** 10.1.99.254
* VLAN12-RD2
** 10.1.12.18
** 255.255.255.240
** 10.1.12.30
* VLAN13-Sales2
** 10.1.13.26
** 255.255.255.248
** 10.1.13.30
* VLAN14-IT
** 10.1.14.65
** 255.255.255.224
** 10.1.14.94


== R1 ==
Vlan99  10.1.99.101  YES manual  up  up
* no ip domain-lookup
</pre>
* Fa0/0
| S1 管理 VLAN 使用 VLAN99,Gateway 指向 R1 的 Fa0/0.99:10.1.99.254。
** interface fa0/0
|-
** no shutdown
* Serial 0/0/0
** interface serial0/0/0
** ip address 192.168.123.1 255.255.255.252
** bandwidth 128
** no shutdown
** exit
* Serial 0/0/1
** interface serial0/0/1
** ip address 192.168.123.5 255.255.255.252
** bandwidth 64
** clock rate 64000
** no shutdown
** exit
** router ospf 1
** no passive-interface serial0/0/1
** network 192.168.123.4 0.0.0.3 area 0
*子介面
** interface fa0/0.2
** encapsulation dot1Q 12
** ip address 10.1.12.30 255.255.255.240
** interface fa0/0.3
** encapsulation dot1Q 13
** ip address 10.1.13.30 255.255.255.248
** interface fa0/0.4
** encapsulation dot1Q 14
** ip address 10.1.14.94 255.255.255.224
** interface fa0/0.99
** encapsulation dot1Q 99
** ip address 10.1.99.254 255.255.255.0
** no shutdown
* R1 to R3 靜態路由
** ip route 10.3.2.0 255.255.255.0 192.168.123.6
** exit
*R1 to R2 靜態路由備援
** ip route 10.3.2.0 255.255.255.0 192.168.123.2 2
** exit
* OSPF
** Loopback0
** interface loopback0
** 192.168.99.1 255.255.255.255
** router ospf 1
** router-id 192.168.99.1
** passive-interface default
** no passive-interface serial0/0/0
** no passive-interface serial0/0/1
** network 192.168.123.0 0.0.0.3 area 0
** network 192.168.123.4 0.0.0.3 area 0
** network 10.1.12.16 0.0.0.15 area 0
** network 10.1.13.24 0.0.0.7 area 0
** network 192.168.99.1 0.0.0.0 area 0
** R1 把 VLAN99 加入 OSPF Area 0
*** router ospf 1
*** network 10.1.99.0 0.0.0.255 area 0
* 對接 Internet
** interface serial0/1/1
** ip address 193.16.1.254 255.255.255.252
** no shutdown
** exit
** ip route 0.0.0.0 0.0.0.0 193.16.1.253


== R2 ==
| 終端設備
* no ip domain-lookup
| S2 網管 IP
* R2 to R3
| IP:10.1.99.102<br>Mask:255.255.255.0<br>Gateway:10.1.99.254
** interface s0/0/1
| <pre>
** ip address 192.168.123.9 255.255.255.252
interface vlan 99
** bandwidth 128
ip address 10.1.99.102 255.255.255.0
** clock rate 128000
no shutdown
** no shutdown
exit
** exit
ip default-gateway 10.1.99.254
* R2 to R1
</pre>
** interface serial0/0/0
| <pre>
** ip address 192.168.123.2 255.255.255.252
show ip interface brief
** bandwidth 128
** no shutdown
** exit
* Fa0/0
** interface fa0/0
** ip address 172.16.100.254 255.255.255.0
** no shutdown
** exit
*R2 支援 VLAN14 ↔ R3-PC2 備援路徑的靜態路由
** ip route 10.3.2.0 255.255.255.0 192.168.123.10
** 滿足VLAN 14 IT 的路由:ip route 10.1.14.64 255.255.255.224 192.168.123.1
** exit
* OSPF
** interface loopback0
** ip address 192.168.99.2 255.255.255.255
** router ospf 2
** router-id 192.168.99.2
** network 192.168.123.2 0.0.0.0 area 0
** network 192.168.123.9 0.0.0.0 area 0
** network 172.16.100.254 0.0.0.0 area 2
** network 192.168.99.2 0.0.0.0 area 2
** passive-interface fa0/0
* 等價路由特別設定
** interface serial0/0/0
** bandwidth 128
** exit
** interface serial0/0/1
** bandwidth 128
** no shutdown
** exit
** router ospf 2
** network 192.168.123.9 0.0.0.0 area 0
** no passive-interface serial0/0/1
=== 單機設定 ===
* R2-Server1
** 172.16.100.101
** 255.255.255.0
** 172.16.100.254
* R2-Server2
** 172.16.100.102
** 255.255.255.0
** 172.16.100.254
* R2-Private
** 172.16.100.103
** 255.255.255.0
** 172.16.100.254


== R3 ==
Vlan99  10.1.99.102  YES manual  up  up
* no ip domain-lookup
</pre>
* VPN 前置整理:
| S2 管理 VLAN 使用 VLAN99,Gateway 同樣指向 R1 的 10.1.99.254。
** 第一階段 R3 暫不參與 R1 ↔ R6 IPSec VPN 測試。
|-
** 目前 R3 只保留到 VLAN14 的靜態路由:
** R3 to R1 靜態路由
*** ip route 10.1.14.64 255.255.255.224 192.168.123.5
* R3 to VLAN14 靜態路由備援
** ip route 10.1.14.64 255.255.255.224 192.168.123.9 2
** exit
* Fa0/0
** interface fa0/0
** ip address 10.3.1.254 255.255.255.0
** ip ospf 3 area 0
** no shutdown
** end
* F0/1
** interface fa0/1
** ip address 10.3.2.254 255.255.255.0
** no shutdown
** end
* OSPF
** interface loopback0
** ip address 192.168.99.3 255.255.255.255
** ip ospf 3 area 3
** exit
** router ospf 3
** router-id 192.168.99.3
** R3 Serial 加入 Area 0
*** interface serial0/0/0
*** ip address 192.168.123.6 255.255.255.252
*** bandwidth 64
*** no shutdown
*** ip ospf 3 area 0
*** exit
*** interface serial0/0/1
*** ip address 192.168.123.10 255.255.255.252
*** bandwidth 128
*** ip ospf 3 area 0
*** no shutdown
** R3 OSPF process
*** router ospf 3
*** passive-interface fa0/0
* 等價路由特別設定
** interface serial0/0/0
** bandwidth 64
** exit
** interface serial0/0/1
** bandwidth 128
** exit
** end
=== 單機設定 ===
* R3-PC1
** 10.3.1.10
** 255.255.255.0
** 10.3.1.254
* R3-PC2
** 10.3.2.10
** 255.255.255.0
** 10.3.2.254


=== ACL ===
| 終端設備
* ACL 設定條件
| Mgmt Server
** 把 telnet 改成 SSH 連線。
| IP:10.1.99.100<br>Mask:255.255.255.0<br>Gateway:10.1.99.254
** 只允許 IT 部門 (也就是 VLAN 14 的網段 10.1.14.64/27) 使用 SSH 遠端連入。
| <pre>
** 到該網路設備做網管,可同時允許 6 條 SSH sessions 連入 R3。
Desktop > IP Configuration
** SSH 條件:
*** username user
*** password 123
*** 網址 ckc.com
*** crypto 1024
* ACL 指令
** username user password 123
** ip domain-name ckc.com
** crypto key generate rsa
*** 1024
** ip ssh version 2
** access-list 12 permit 10.1.14.64 0.0.0.31
** line vty 0 5
** login local
** transport input ssh
** access-class 12 in
** exit
** line vty 6 15
** transport input none
** exit
** end


== R6 ==
IP Address: 10.1.99.100
* no ip domain-lookup
Subnet Mask: 255.255.255.0
* hostname R6
Default Gateway: 10.1.99.254
* Loopback0
</pre>
** interface loopback0
| <pre>
** ip address 192.168.99.6 255.255.255.255
ping 10.1.99.254
** exit
* Internet Router 對面:193.16.6.253/30
* R6 指令集:
* Fa0/1
** interface fastEthernet0/1
** ip address 10.5.0.254 255.255.255.0
** no shutdown
** exit
* Fa0/0
** interface fastEthernet0/0
** ip address 10.6.0.254 255.255.255.0
** no shutdown
** exit
* 對接 Internet Router
** interface serial0/0/0
** ip address 193.16.6.254 255.255.255.252
** no shutdown
** exit
** ip route 0.0.0.0 0.0.0.0 193.16.6.253


=== 單機設定 ===
Reply from 10.1.99.254
* R6-PC5:10.5.0.10/24
</pre>
** IP Address:10.5.0.10
| Mgmt Server 放在 VLAN99,用來測試交換器管理 VLAN 與 R1 單臂路由。
** Subnet Mask:255.255.255.0
|-
** Default Gateway:10.5.0.254
* R6-PC6:10.6.0.10/24
** IP Address:10.6.0.10
** Subnet Mask:255.255.255.0
** Default Gateway:10.6.0.254


== Internet ==
| 終端設備
* no ip domain-lookup
| VLAN12-RD1
* hostname Internet
| IP:10.1.12.17<br>Mask:255.255.255.240<br>Gateway:10.1.12.30
* 對接 R6
| <pre>
** interface serial0/0/1
Desktop > IP Configuration
** ip address 193.16.6.253 255.255.255.252
** clock rate 64000
** no shutdown
** exit
* Internet_WWW
** interface fastEthernet0/0
** ip address 200.200.200.254 255.255.255.0
** no shutdown
** exit
* Internet_User
** interface fastEthernet0/1
** ip address 201.201.201.254 255.255.255.0
** no shutdown
** exit
* 對接 R1
** interface serial0/0/0
** ip address 193.16.1.253 255.255.255.252
** clock rate 64000
** no shutdown
** exit
=== 單機設定 ===
* Internet WWW
** IP Address:200.200.200.200
** Subnet Mask:255.255.255.0
** Default Gateway:200.200.200.254
* Internet User
** IP Address:201.201.201.201
** Subnet Mask:255.255.255.0
** Default Gateway:201.201.201.254


== 更新版整理 ==
IP Address: 10.1.12.17
== 更新版整理:NAT / PAT / VPN / ACL 最終完成紀錄 ==
Subnet Mask: 255.255.255.240
Default Gateway: 10.1.12.30
</pre>
| <pre>
ping 10.1.12.30


本段紀錄 2026-0608 Lab 後半段完成內容,包含 NAT、PAT、Dynamic NAT、Static NAT、IPSec VPN 與 Exted ACL 100。
Reply from 10.1.12.30
</pre>
| VLAN12-RD1 接在 S1 Fa0/11,屬於 RD 部門 VLAN12。
|-


=== 一、最終完成狀態總表 ===
| 終端設備
| VLAN12-RD2
| IP:10.1.12.18<br>Mask:255.255.255.240<br>Gateway:10.1.12.30
| <pre>
Desktop > IP Configuration


{| class="wikitable"
IP Address: 10.1.12.18
! 項目
Subnet Mask: 255.255.255.240
! 完成狀態
Default Gateway: 10.1.12.30
! 驗證重點
</pre>
| <pre>
ping 10.1.12.30
 
Reply from 10.1.12.30
</pre>
| VLAN12-RD2 接在 S2 Fa0/11,屬於 RD 部門 VLAN12。
|-
 
| 終端設備
| VLAN13-Sales1
| IP:10.1.13.25<br>Mask:255.255.255.248<br>Gateway:10.1.13.30
| <pre>
Desktop > IP Configuration
 
IP Address: 10.1.13.25
Subnet Mask: 255.255.255.248
Default Gateway: 10.1.13.30
</pre>
| <pre>
ping 10.1.13.30
 
Reply from 10.1.13.30
</pre>
| VLAN13-Sales1 接在 S1 Fa0/15,屬於 Sales 部門 VLAN13。
|-
 
| 終端設備
| VLAN13-Sales2
| IP:10.1.13.26<br>Mask:255.255.255.248<br>Gateway:10.1.13.30
| <pre>
Desktop > IP Configuration
 
IP Address: 10.1.13.26
Subnet Mask: 255.255.255.248
Default Gateway: 10.1.13.30
</pre>
| <pre>
ping 10.1.13.30
 
Reply from 10.1.13.30
</pre>
| VLAN13-Sales2 接在 S2 Fa0/15,後續 Dynamic NAT 測試使用此主機。
|-
 
| 終端設備
| VLAN14-IT
| IP:10.1.14.65<br>Mask:255.255.255.224<br>Gateway:10.1.14.94
| <pre>
Desktop > IP Configuration
 
IP Address: 10.1.14.65
Subnet Mask: 255.255.255.224
Default Gateway: 10.1.14.94
</pre>
| <pre>
ping 10.1.14.94
 
Reply from 10.1.14.94
</pre>
| VLAN14-IT 接在 S2 Fa0/19,後續也用於 SSH ACL 測試。
|-
 
| 終端設備
| R2-Private / R2-Server1
| IP:172.16.100.101<br>Mask:255.255.255.0<br>Gateway:172.16.100.254
| <pre>
Desktop > IP Configuration
 
IP Address: 172.16.100.101
Subnet Mask: 255.255.255.0
Default Gateway: 172.16.100.254
</pre>
| <pre>
VLAN12-RD1 ftp 172.16.100.101
 
Connected to 172.16.100.101
230 Logged in
</pre>
| R2-Private 伺服器,ACL 要求只允許 VLAN12 使用 FTP 存取。
|-
|-
| VLAN12 PAT
 
| 完成
| 終端設備
| VLAN12-RD1 可以 ping / http Internet WWW
| R2-DMZ / R2-Server2
| IP:172.16.100.102<br>Mask:255.255.255.0<br>Gateway:172.16.100.254
| <pre>
Desktop > IP Configuration
 
IP Address: 172.16.100.102
Subnet Mask: 255.255.255.0
Default Gateway: 172.16.100.254
</pre>
| <pre>
R3-PC ping 172.16.100.102
 
Reply from 172.16.100.102
</pre>
| R2-DMZ 伺服器,後續 Static NAT 對應到 171.69.233.209,ACL 只允許 ping / http。
|-
|-
| VLAN13 Dynamic NAT
 
| 完成
| 終端設備
| VLAN13-Sales2 可以 ping / http Internet WWW,並產生 NAT translation
| R3-PC1
| IP:10.3.1.10<br>Mask:255.255.255.0<br>Gateway:10.3.1.254
| <pre>
Desktop > IP Configuration
 
IP Address: 10.3.1.10
Subnet Mask: 255.255.255.0
Default Gateway: 10.3.1.254
</pre>
| <pre>
R6-PC6 ping 10.3.1.10
 
Reply from 10.3.1.10
</pre>
| R3-PC1 是 IPSec VPN 的遠端內網目的端。
|-
|-
| R2-DMZ Static NAT
 
| 完成
| 終端設備
| 172.16.100.102 對應 171.69.233.209
| R3-PC2
| IP:10.3.2.10<br>Mask:255.255.255.0<br>Gateway:10.3.2.254
| <pre>
Desktop > IP Configuration
 
IP Address: 10.3.2.10
Subnet Mask: 255.255.255.0
Default Gateway: 10.3.2.254
</pre>
| <pre>
ping 10.3.2.254
 
Reply from 10.3.2.254
</pre>
| 10.3.2.0/24 為 R3 第二內網,曾用於 Static Route / Floating Static Route 測試。
|-
|-
| R6-PC5 PAT
 
| 完成
| 終端設備
| R6-PC5 可以 ping / http Internet WWW
| R6-PC5
| IP:10.5.0.10<br>Mask:255.255.255.0<br>Gateway:10.5.0.254
| <pre>
Desktop > IP Configuration
 
IP Address: 10.5.0.10
Subnet Mask: 255.255.255.0
Default Gateway: 10.5.0.254
</pre>
| <pre>
ping 200.200.200.200
 
Reply from 200.200.200.200
</pre>
| R6-PC5 使用 R6 PAT 連到 Internet。
|-
|-
| Internet Router 回程路由
 
| 完成
| 終端設備
| 171.69.233.208/28 指回 R1 外部 IP 193.16.1.254
| R6-PC6
| IP:10.6.0.10<br>Mask:255.255.255.0<br>Gateway:10.6.0.254
| <pre>
Desktop > IP Configuration
 
IP Address: 10.6.0.10
Subnet Mask: 255.255.255.0
Default Gateway: 10.6.0.254
</pre>
| <pre>
ping 10.3.1.10
 
Sent = 4, Received = 4, Lost = 0
</pre>
| R6-PC6 是 IPSec VPN 的本端內網來源。
|-
|-
| R1 ↔ R6 IPSec VPN Phase 1
 
| 完成
| 終端設備
| show crypto isakmp sa 顯示 QM_IDLE / ACTIVE
| Internet WWW
| IP:200.200.200.200<br>Mask:255.255.255.0<br>Gateway:200.200.200.254
| <pre>
Desktop > IP Configuration
 
IP Address: 200.200.200.200
Subnet Mask: 255.255.255.0
Default Gateway: 200.200.200.254
</pre>
| <pre>
VLAN12-RD1 ping 200.200.200.200
 
Reply from 200.200.200.200
</pre>
| Internet WWW 是 NAT / PAT 連外測試目的端。
|-
|-
| R1 ↔ R6 IPSec VPN Phase 2
 
| 完成
| 終端設備
| show crypto ipsec sa 顯示 encaps / decaps 數字增加
| Internet User
| IP:201.201.201.201<br>Mask:255.255.255.0<br>Gateway:201.201.201.254
| <pre>
Desktop > IP Configuration
 
IP Address: 201.201.201.201
Subnet Mask: 255.255.255.0
Default Gateway: 201.201.201.254
</pre>
| <pre>
ping 171.69.233.209
 
Reply from 171.69.233.209
</pre>
| Internet User 用於測試 R2-DMZ Static NAT 公有 IP 171.69.233.209。
|-
|-
| R2 Exted ACL 100
| 完成
| Permit / Deny 規則皆有 match
|}


----
| Switch VLAN
| S1 建立 VLAN
| VLAN12:RD<br>VLAN13:Sales<br>VLAN14:IT<br>VLAN99:MGMT
| <pre>
conf t
vlan 12
name RD
vlan 13
name sales
vlan 14
name IT
vlan 99
name MGMT
 
 
</pre>
| <pre>
show vlan brief
 
12  RD
13  sales
14  IT
99  MGMT
</pre>
| S1 建立全部 VLAN,供 access port 與 trunk 使用。
|-
 
| Switch VLAN
| S2 建立 VLAN
| VLAN12:RD<br>VLAN13:Sales<br>VLAN14:IT<br>VLAN99:MGMT
| <pre>
conf t
vlan 12
name RD
vlan 13
name sales
vlan 14
name IT
vlan 99
name MGMT
 


== 二、R1 補充設定 ==
</pre>
| <pre>
show vlan brief


=== R1-1 Default Route ===
12  RD
13  sales
14  IT
99  MGMT
</pre>
| S2 建立與 S1 相同的 VLAN。
|-


輸入指令:
| Switch Access Port
<pre>
| S1 Access Port
| Fa0/11:VLAN12<br>Fa0/15:VLAN13<br>Fa0/21:VLAN99
| <pre>
conf t
conf t
ip route 0.0.0.0 0.0.0.0 193.16.1.253
 
interface fa0/11
switchport mode access
switchport access vlan 12
no shutdown
exit
 
interface fa0/15
switchport mode access
switchport access vlan 13
no shutdown
exit
 
interface fa0/21
switchport mode access
switchport access vlan 99
no shutdown
exit
 




</pre>
</pre>
| <pre>
show vlan brief


說明:
Fa0/11 在 VLAN12
* R1 是企業內部對外連接 Internet 的邊界路由器。
Fa0/15 在 VLAN13
* R1 必須先有靜態 Default Route,後續才能透過 OSPF 將預設路由宣告給 R2 / R3。
Fa0/21 在 VLAN99
</pre>
| S1 上的終端設備分別放入對應 VLAN。
|-


驗證指令:
| Switch Access Port
<pre>
| S2 Access Port
show ip route
| Fa0/11:VLAN12<br>Fa0/15:VLAN13<br>Fa0/19:VLAN14
show ip route 0.0.0.0
| <pre>
conf t
 
interface fa0/11
switchport mode access
switchport access vlan 12
no shutdown
exit
 
interface fa0/15
switchport mode access
switchport access vlan 13
no shutdown
exit
 
interface fa0/19
switchport mode access
switchport access vlan 14
no shutdown
exit
 
 
 
</pre>
| <pre>
show vlan brief
 
Fa0/11 在 VLAN12
Fa0/15 在 VLAN13
Fa0/19 在 VLAN14
</pre>
</pre>
| S2 上的 RD、Sales、IT 主機分別放入 VLAN12、VLAN13、VLAN14。
|-
| Switch Trunk
| S1 連接 S2 的 Trunk
| Trunk Port:Fa0/23 - 24<br>Allowed VLAN:12,13,14,99
| <pre>
conf t
interface range fa0/23 - 24
switchport mode trunk
switchport trunk allowed vlan 12,13,14,99
no shutdown


系統回應 / 驗證結果應看到:
<pre>
S* 0.0.0.0/0 [1/0] via 193.16.1.253
</pre>
</pre>
| <pre>
show interfaces trunk


=== R1-2 OSPF 宣告 Default Route ===
Port        Mode    Status
Fa0/23      on      trunking
Fa0/24      on      trunking


輸入指令:
Vlans allowed on trunk: 12,13,14,99
<pre>
</pre>
| S1 與 S2 之間使用 trunk 傳送多個 VLAN。
|-
 
| Switch Trunk
| S2 連接 S1 的 Trunk
| Trunk Port:Fa0/23 - 24<br>Allowed VLAN:12,13,14,99
| <pre>
conf t
conf t
router ospf 1
default-information originate


interface range fa0/23 - 24
switchport mode trunk
switchport trunk allowed vlan 12,13,14,99
no shutdown
</pre>
| <pre>
show interfaces trunk
Port        Mode    Status
Fa0/23      on      trunking
Fa0/24      on      trunking


Vlans allowed on trunk: 12,13,14,99
</pre>
</pre>
| S2 與 S1 之間使用 trunk 傳送多個 VLAN。
|-
| Switch Trunk
| S1 連接 R1 的 Trunk
| S1 Fa0/5 → R1 Fa0/0<br>Allowed VLAN:12,13,14,99
| <pre>
conf t
interface fa0/5
switchport mode trunk
switchport trunk allowed vlan 12,13,14,99
no shutdown


說明:
</pre>
* R1 將自己的 Default Route 透過 OSPF 宣告給內部路由器。
| <pre>
* R2 / R3 應該學到 O*E2 0.0.0.0/0。
show interfaces trunk


驗證指令:
Fa0/5 trunking
<pre>
Vlans allowed on trunk: 12,13,14,99
show ip route
</pre>
</pre>
| S1 Fa0/5 連接 R1 Fa0/0,提供 Router-on-a-stick 單臂路由。
|-
| Router-on-a-stick
| R1 啟用實體 Fa0/0
| R1 Fa0/0 不設 IP,只作為子介面承載 trunk
| <pre>
conf t
interface fa0/0
no shutdown


在 R2 / R3 的系統回應 / 驗證結果應看到:
<pre>
O*E2 0.0.0.0/0
</pre>
</pre>
| <pre>
show ip interface brief


=== R1-3 NAT Inside / Outside 介面設定 ===
FastEthernet0/0  unassigned  up  up
</pre>
| R1 Fa0/0 為 trunk 母介面,實際閘道 IP 設在子介面。
|-


輸入指令:
| Router-on-a-stick
<pre>
| R1 Fa0/0.2
| VLAN12 Gateway:10.1.12.30/28
| <pre>
conf t
conf t


interface fa0/0.2
interface fa0/0.2
  ip nat inside
encapsulation dot1Q 12
  ip address 10.1.12.30 255.255.255.240
 
 
 
</pre>
| <pre>
show ip interface brief
 
FastEthernet0/0.2  10.1.12.30  up  up
</pre>
| VLAN12 的 Default Gateway。
|-
 
| Router-on-a-stick
| R1 Fa0/0.3
| VLAN13 Gateway:10.1.13.30/29
| <pre>
conf t


interface fa0/0.3
interface fa0/0.3
  ip nat inside
encapsulation dot1Q 13
  ip address 10.1.13.30 255.255.255.248
 
 
 
</pre>
| <pre>
show ip interface brief
 
FastEthernet0/0.3  10.1.13.30  up  up
</pre>
| VLAN13 的 Default Gateway。
|-


interface serial0/0/0
| Router-on-a-stick
ip nat inside
| R1 Fa0/0.4
| VLAN14 Gateway:10.1.14.94/27
| <pre>
conf t


interface serial0/0/1
interface fa0/0.4
  ip nat inside
encapsulation dot1Q 14
  ip address 10.1.14.94 255.255.255.224


interface serial0/1/1
ip nat outside




</pre>
| <pre>
show ip interface brief


FastEthernet0/0.4  10.1.14.94  up  up
</pre>
</pre>
| VLAN14 的 Default Gateway。
|-
| Router-on-a-stick
| R1 Fa0/0.99
| VLAN99 Gateway:10.1.99.254/24
| <pre>
conf t
interface fa0/0.99
encapsulation dot1Q 99
ip address 10.1.99.254 255.255.255.0


說明:
* VLAN12、VLAN13、R2 / R3 方向屬於 NAT inside。
* R1 對 Internet 的 Serial0/1/1 屬於 NAT outside。


驗證指令:
<pre>
show running-config interface fa0/0.2
show running-config interface fa0/0.3
show running-config interface serial0/0/0
show running-config interface serial0/0/1
show running-config interface serial0/1/1
</pre>
</pre>
| <pre>
show ip interface brief


系統回應 / 驗證結果應看到:
FastEthernet0/0.99  10.1.99.254  up  up
<pre>
ip nat inside
ip nat outside
</pre>
</pre>
| VLAN99 管理網段的 Default Gateway。
|-


=== R1-4 VLAN12 PAT 設定 ===
| R1 介面
| R1 to R2
| Serial0/0/0:192.168.123.1/30<br>Bandwidth:128
| <pre>
conf t


輸入指令:
interface serial0/0/0
<pre>
ip address 192.168.123.1 255.255.255.252
bandwidth 128
no shutdown
 
 
 
</pre>
| <pre>
show ip interface brief
 
Serial0/0/0  192.168.123.1  up  up
</pre>
| R1 與 R2 的 Serial link。
|-
 
| R1 介面
| R1 to R3
| Serial0/0/1:192.168.123.5/30<br>Bandwidth:64<br>Clock rate:64000
| <pre>
conf t
conf t


access-list 12 permit 10.1.12.16 0.0.0.15
interface serial0/0/1
ip nat inside source list 12 interface serial0/1/1 overload
ip address 192.168.123.5 255.255.255.252
bandwidth 64
clock rate 64000
no shutdown






</pre>
</pre>
| <pre>
show ip interface brief
Serial0/0/1  192.168.123.5  up  up
</pre>
| R1 與 R3 的 Serial link,成本較高,用於 OSPF cost / ECMP 設計。
|-
| R1 介面
| R1 to Internet
| Serial0/1/1:193.16.1.254/30
| <pre>
conf t
interface serial0/1/1
ip address 193.16.1.254 255.255.255.252
no shutdown


說明:
* VLAN12 網段為 10.1.12.16/28。
* VLAN12 使用 R1 Serial0/1/1 的公有 IP 做 PAT overload。


驗證指令:
<pre>
show ip nat translations
show access-lists 12
</pre>
</pre>
| <pre>
show ip interface brief


測試來源:
Serial0/1/1  193.16.1.254  up  up
<pre>
VLAN12-RD1> ping 200.200.200.200
VLAN12-RD1> 使用 Web Browser 開啟 http://200.200.200.200
</pre>
</pre>
| R1 對接 Internet Router,後續 NAT outside 與 VPN peer 都使用此介面。
|-
| R2 介面
| R2 to R1
| Serial0/0/0:192.168.123.2/30<br>Bandwidth:128
| <pre>
conf t
interface serial0/0/0
ip address 192.168.123.2 255.255.255.252
bandwidth 128
no shutdown


系統回應 / 驗證結果:
<pre>
VLAN12-RD1 ping Internet WWW:OK
VLAN12-RD1 http Internet WWW:OK
R1 show ip nat translations 可看到 PAT 轉址紀錄
</pre>
</pre>
| <pre>
show ip interface brief


=== R1-5 VLAN13 Dynamic NAT 設定 ===
Serial0/0/0  192.168.123.2  up  up
</pre>
| R2 與 R1 的 Serial link。
|-


輸入指令:
| R2 介面
<pre>
| R2 to R3
| Serial0/0/1:192.168.123.9/30<br>Bandwidth:128<br>Clock rate:128000
| <pre>
conf t
conf t


access-list 13 permit 10.1.13.24 0.0.0.7
interface serial0/0/1
ip nat pool VLAN13_POOL 171.69.233.210 171.69.233.222 netmask 255.255.255.240
ip address 192.168.123.9 255.255.255.252
ip nat inside source list 13 pool VLAN13_POOL
bandwidth 128
clock rate 128000
no shutdown






</pre>
</pre>
| <pre>
show ip interface brief
Serial0/0/1  192.168.123.9  up  up
</pre>
| R2 與 R3 的 Serial link。
|-
| R2 介面
| R2 Server 區
| Fa0/0:172.16.100.254/24
| <pre>
conf t
interface fa0/0
ip address 172.16.100.254 255.255.255.0
no shutdown


說明:
* VLAN13 網段為 10.1.13.24/29。
* Dynamic NAT 公有 IP 池為 171.69.233.210 到 171.69.233.222。
* 171.69.233.209 保留給 R2-DMZ Static NAT 使用。


驗證指令:
<pre>
show ip nat translations
show ip nat statistics
show access-lists 13
</pre>
</pre>
| <pre>
show ip interface brief


測試來源:
FastEthernet0/0  172.16.100.254  up  up
<pre>
VLAN13-Sales2> ping 200.200.200.200
VLAN13-Sales2> 使用 Web Browser 開啟 http://200.200.200.200
</pre>
</pre>
| R2 Server / DMZ 區 gateway,後續 ACL 100 套用於此介面 outbound。
|-
| R3 介面
| R3 Fa0/0
| 10.3.1.254/24
| <pre>
conf t
interface fa0/0
ip address 10.3.1.254 255.255.255.0
no shutdown


系統回應 / 驗證結果:
<pre>
VLAN13-Sales2 ping Internet WWW:OK
VLAN13-Sales2 http Internet WWW:OK
R1 show ip nat translations 可看到 10.1.13.26 轉成 171.69.233.210
</pre>
</pre>
| <pre>
show ip interface brief


=== R1-6 R2-DMZ Static NAT 設定 ===
FastEthernet0/0  10.3.1.254  up  up
</pre>
| R3-PC1 所在網段 gateway,也是 VPN 遠端內網。
|-


輸入指令:
| R3 介面
<pre>
| R3 Fa0/1
| 10.3.2.254/24
| <pre>
conf t
conf t


ip nat inside source static 172.16.100.102 171.69.233.209
interface fa0/1
ip address 10.3.2.254 255.255.255.0
no shutdown






</pre>
</pre>
| <pre>
show ip interface brief
FastEthernet0/1  10.3.2.254  up  up
</pre>
| R3 第二內網。
|-
| R3 介面
| R3 to R1
| Serial0/0/0:192.168.123.6/30<br>Bandwidth:64
| <pre>
conf t
interface serial0/0/0
ip address 192.168.123.6 255.255.255.252
bandwidth 64
no shutdown


說明:
* R2-DMZ 私有 IP:172.16.100.102。
* 對外公有 IP:171.69.233.209。
* Static NAT 不需要先通過流量,設定完成後 NAT table 內就會看到固定轉址紀錄。


驗證指令:
<pre>
show ip nat translations
</pre>
</pre>
| <pre>
show ip interface brief


系統回應 / 驗證結果應看到:
Serial0/0/0  192.168.123.6  up  up
<pre>
Pro Inside global      Inside local      Outside local      Outside global
--- 171.69.233.209    172.16.100.102    ---                ---
</pre>
</pre>
| R3 與 R1 的 Serial link。
|-
| R3 介面
| R3 to R2
| Serial0/0/1:192.168.123.10/30<br>Bandwidth:128
| <pre>
conf t


=== R1-7 IPSec VPN 設定 ===
interface serial0/0/1
ip address 192.168.123.10 255.255.255.252
bandwidth 128
no shutdown


說明:
* R1 與 R6 外部介面建立 IPSec Tunnel。
* R1 外部 IP:193.16.1.254。
* R6 外部 IP:193.16.6.254。
* R3-PC1 網段:10.3.1.0/24。
* R6-PC6 網段:10.6.0.0/24。
* PSK:SeCrEt。
* Phase 1:3DES / SHA / Group 2。
* Phase 2:ESP / AES / MD5。


輸入指令:
 
<pre>
</pre>
| <pre>
show ip interface brief
 
Serial0/0/1  192.168.123.10  up  up
</pre>
| R3 與 R2 的 Serial link。
|-
 
| R6 介面
| R6 Fa0/1
| 10.5.0.254/24
| <pre>
conf t
conf t


crypto isakmp policy 10
interface fastEthernet0/1
  encr 3des
  ip address 10.5.0.254 255.255.255.0
hash sha
  no shutdown
authentication pre-share
 
group 2
  lifetime 86400
exit


crypto isakmp key SeCrEt address 193.16.6.254


crypto ipsec transform-set ts16 esp-aes esp-md5-hmac
</pre>
| <pre>
show ip interface brief


access-list 110 permit ip 10.3.1.0 0.0.0.255 10.6.0.0 0.0.0.255
FastEthernet0/1 10.5.0.254  up  up
</pre>
| R6-PC5 所在網段 gateway,後續 R6 PAT inside。
|-


crypto map map16 10 ipsec-isakmp
| R6 介面
set peer 193.16.6.254
| R6 Fa0/0
set transform-set ts16
| 10.6.0.254/24
match address 110
| <pre>
exit
conf t


interface serial0/1/1
interface fastEthernet0/0
  crypto map map16
ip address 10.6.0.254 255.255.255.0
  no shutdown






</pre>
</pre>
| <pre>
show ip interface brief


驗證指令:
FastEthernet0/0  10.6.0.254  up  up
<pre>
show crypto isakmp sa
show crypto ipsec sa
show access-lists 110
</pre>
</pre>
| R6-PC6 所在網段 gateway,後續 VPN protected LAN。
|-
| R6 介面
| R6 to Internet
| Serial0/0/0:193.16.6.254/30
| <pre>
conf t
interface serial0/0/0
ip address 193.16.6.254 255.255.255.252
no shutdown


系統回應 / 驗證結果應看到:
<pre>
show crypto isakmp sa:
QM_IDLE / ACTIVE


show crypto ipsec sa:
#pkts encaps 有數字
#pkts decaps 有數字
</pre>
</pre>
| <pre>
show ip interface brief


----
Serial0/0/0  193.16.6.254  up  up
</pre>
| R6 對接 Internet Router,後續 NAT outside 與 VPN peer 都使用此介面。
|-
 
| Internet 介面
| Internet to R1
| Serial0/0/0:193.16.1.253/30<br>Clock rate:64000
| <pre>
conf t
 
interface serial0/0/0
ip address 193.16.1.253 255.255.255.252
clock rate 64000
no shutdown


== 三、R2 補充設定 ==


=== R2-1 Exted ACL 100 設定 ===


說明:
</pre>
* ACL 套用路由器:R2。
| <pre>
* ACL 套用介面:Fa0/0。
show ip interface brief
* ACL 套用方向:out。
* 控制目標一:R2-Private,172.16.100.101。
* 控制目標二:R2-DMZ,172.16.100.102。


輸入指令:
Serial0/0/0  193.16.1.253  up  up
<pre>
</pre>
| Internet Router 對接 R1。
|-
 
| Internet 介面
| Internet to R6
| Serial0/0/1:193.16.6.253/30<br>Clock rate:64000
| <pre>
conf t
conf t


no access-list 100
interface serial0/0/1
ip address 193.16.6.253 255.255.255.252
clock rate 64000
no shutdown
 
 
 
</pre>
| <pre>
show ip interface brief
 
Serial0/0/1  193.16.6.253  up  up
</pre>
| Internet Router 對接 R6。
|-


access-list 100 permit tcp 10.1.12.16 0.0.0.15 172.16.100.101 0.0.0.0 eq 20
| Internet 介面
access-list 100 permit tcp 10.1.12.16 0.0.0.15 172.16.100.101 0.0.0.0 eq 21
| Internet WWW
access-list 100 deny  ip  10.1.12.16 0.0.0.15 172.16.100.101 0.0.0.0
| Fa0/0:200.200.200.254/24
access-list 100 deny  ip  10.0.0.0  0.255.255.255 172.16.100.101 0.0.0.0
| <pre>
conf t


access-list 100 permit tcp any 172.16.100.102 0.0.0.0 eq 80
interface fastEthernet0/0
access-list 100 permit icmp any 172.16.100.102 0.0.0.0
ip address 200.200.200.254 255.255.255.0
access-list 100 deny ip any 172.16.100.102 0.0.0.0
no shutdown


interface fa0/0
ip access-group 100 out




</pre>
| <pre>
show ip interface brief


FastEthernet0/0  200.200.200.254  up  up
</pre>
</pre>
| Internet WWW Server 的 gateway。
|-
| Internet 介面
| Internet User
| Fa0/1:201.201.201.254/24
| <pre>
conf t
interface fastEthernet0/1
ip address 201.201.201.254 255.255.255.0
no shutdown


驗證指令:
<pre>
show access-lists 100
show running-config interface fa0/0
</pre>
</pre>
| <pre>
show ip interface brief


系統回應 / 驗證結果應看到:
FastEthernet0/1  201.201.201.254  up up
<pre>
interface FastEthernet0/0
  ip access-group 100 out
</pre>
</pre>
| Internet User 的 gateway。
|-
| Static Route
| R1 到 R3 10.3.2.0/24 主路由
| 目的:10.3.2.0/24<br>Next-hop:192.168.123.6
| <pre>
conf t
ip route 10.3.2.0 255.255.255.0 192.168.123.6


=== R2-2 ACL 100 測試前清除計數器 ===


輸入指令:
<pre>
clear access-list counters 100
</pre>
</pre>
| <pre>
show ip route 10.3.2.0


系統回應:
S 10.3.2.0/24 via 192.168.123.6
<pre>
沒有錯誤訊息即代表完成。
</pre>
</pre>
| R1 到 R3 Fa0/1 網段的主要靜態路由。
|-
| Floating Static Route
| R1 到 R3 10.3.2.0/24 備援路由
| 目的:10.3.2.0/24<br>Next-hop:192.168.123.2<br>AD:2
| <pre>
conf t
ip route 10.3.2.0 255.255.255.0 192.168.123.2 2


=== R2-3 ACL 100 測試項目 ===


{| class="wikitable"
</pre>
! 測試來源
| <pre>
! 目的地
show running-config
! 測試服務
 
! 預期結果
ip route 10.3.2.0 255.255.255.0 192.168.123.2 2
! 實測結果
</pre>
| Floating Static Route 的 AD 為 2,正常狀況下不會優先於 AD 1 的主靜態路由。
|-
|-
| VLAN12-RD1
 
| 172.16.100.101
| Static Route
| FTP
| R2 到 R3 10.3.2.0/24
| OK
| 目的:10.3.2.0/24<br>Next-hop:192.168.123.10
| OK,成功登入 FTP
| <pre>
conf t
 
ip route 10.3.2.0 255.255.255.0 192.168.123.10
 
 
 
</pre>
| <pre>
show ip route 10.3.2.0
 
S 10.3.2.0/24 via 192.168.123.10
</pre>
| R2 到 R3 Fa0/1 網段的靜態路由。
|-
|-
| VLAN12-RD1
 
| 172.16.100.101
| Static Route
| ping
| R2 到 VLAN14
| Not OK
| 目的:10.1.14.64/27<br>Next-hop:192.168.123.1
| Not OK,Destination host unreachable
| <pre>
conf t
 
ip route 10.1.14.64 255.255.255.224 192.168.123.1
 
 
 
</pre>
| <pre>
show ip route 10.1.14.64
 
S 10.1.14.64/27 via 192.168.123.1
</pre>
| R2 前往 VLAN14 的靜態路由。
|-
|-
| R3-PC
 
| 172.16.100.101
| Static Route
| ping
| R3 到 VLAN14 主路由
| Not OK
| 目的:10.1.14.64/27<br>Next-hop:192.168.123.5
| Not OK,Destination host unreachable
| <pre>
conf t
 
ip route 10.1.14.64 255.255.255.224 192.168.123.5
 
 
 
</pre>
| <pre>
show ip route 10.1.14.64
 
S 10.1.14.64/27 via 192.168.123.5
</pre>
| R3 到 VLAN14 的主靜態路由。
|-
|-
| R3-PC
 
| 172.16.100.102
| Floating Static Route
| ping
| R3 到 VLAN14 備援路由
| OK
| 目的:10.1.14.64/27<br>Next-hop:192.168.123.9<br>AD:2
| OK,4/4 replies
| <pre>
conf t
 
ip route 10.1.14.64 255.255.255.224 192.168.123.9 2
 
 
 
</pre>
| <pre>
show running-config
 
ip route 10.1.14.64 255.255.255.224 192.168.123.9 2
</pre>
| Floating Static Route 的 AD 為 2,作為備援路徑。
|-
|-
| R3-PC
 
| 172.16.100.102
| OSPF
| HTTP
| R1 OSPF
| OK
| Process ID:1<br>Router ID:192.168.99.1<br>Area:0
| OK,網頁成功開啟
| <pre>
conf t
 
interface loopback0
ip address 192.168.99.1 255.255.255.255
exit
 
router ospf 1
router-id 192.168.99.1
passive-interface default
no passive-interface serial0/0/0
no passive-interface serial0/0/1
network 192.168.123.0 0.0.0.3 area 0
network 192.168.123.4 0.0.0.3 area 0
network 10.1.12.16 0.0.0.15 area 0
network 10.1.13.24 0.0.0.7 area 0
network 10.1.99.0 0.0.0.255 area 0
network 192.168.99.1 0.0.0.0 area 0
 
 
 
</pre>
| <pre>
show ip ospf neighbor
show ip route ospf
 
R1 與 R2 / R3 建立 OSPF 鄰居
</pre>
| R1 使用 network subnet method 宣告 OSPF,並將 VLAN12、VLAN13、VLAN99 納入 OSPF。
|-
|-
| R3-PC
| 172.16.100.102
| FTP
| Not OK
| Not OK,Timed out
|}


=== R2-4 ACL 100 Match 驗證 ===
| OSPF
| R2 OSPF
| Process ID:2<br>Router ID:192.168.99.2<br>Area 0 / Area 2
| <pre>
conf t
 
interface loopback0
ip address 192.168.99.2 255.255.255.255
exit
 
router ospf 2
router-id 192.168.99.2
network 192.168.123.2 0.0.0.0 area 0
network 192.168.123.9 0.0.0.0 area 0
network 172.16.100.254 0.0.0.0 area 2
network 192.168.99.2 0.0.0.0 area 2
passive-interface fa0/0
no passive-interface serial0/0/1
 
 


輸入指令:
<pre>
show access-lists 100
</pre>
</pre>
| <pre>
show ip ospf neighbor
show ip route ospf


系統回應 / 驗證結果:
R2 與 R1 / R3 建立 OSPF 鄰居
<pre>
R2 Fa0/0 被 passive-interface 保護
Exted IP access list 100
permit tcp 10.1.12.16 0.0.0.15 host 172.16.100.101 eq 20
permit tcp 10.1.12.16 0.0.0.15 host 172.16.100.101 eq ftp (11 match(es))
deny ip 10.1.12.16 0.0.0.15 host 172.16.100.101 (4 match(es))
deny ip 10.0.0.0 0.255.255.255 host 172.16.100.101 (101 match(es))
permit tcp any host 172.16.100.102 eq www (5 match(es))
permit icmp any host 172.16.100.102 (4 match(es))
deny ip any host 172.16.100.102 (12 match(es))
</pre>
</pre>
| R2 使用 interface IP 精準宣告方式,Server 區在 Area 2,Serial links 在 Area 0。
|-
| OSPF
| R3 OSPF
| Process ID:3<br>Router ID:192.168.99.3<br>Area 0 / Area 3
| <pre>
conf t


判定:
interface loopback0
<pre>
ip address 192.168.99.3 255.255.255.255
ACL Permit 測試:完成
ip ospf 3 area 3
ACL Deny 測試:完成
exit
R2 Fa0/0 outbound ACL 100:完成
</pre>


----
interface fa0/0
ip ospf 3 area 0
exit


== 四、R3 補充紀錄 ==
interface serial0/0/0
ip ospf 3 area 0
exit


=== R3-1 本階段角色 ===
interface serial0/0/1
ip ospf 3 area 0
exit


說明:
router ospf 3
* R3 本階段主要作為 ACL 測試來源與 VPN 遠端內網目的端。
router-id 192.168.99.3
* R3-PC1:10.3.1.10。
passive-interface fa0/0
* R3-PC:10.3.2.10。
* R3 本身在 NAT / ACL / VPN 最終階段沒有新增主要設定,重點是確認路由與 OSPF 正常。


=== R3-2 驗證指令 ===


輸入指令:
 
<pre>
</pre>
show ip route
| <pre>
show ip route 0.0.0.0
show ip ospf neighbor
show ip ospf neighbor
show ip route ospf
R3 與 R1 / R2 建立 OSPF 鄰居
R3 Fa0/0 可被宣告但不送 Hello
</pre>
</pre>
| R3 使用 interface mode 的 ip ospf process area 方式啟用 OSPF。
|-


系統回應 / 驗證結果應看到:
| OSPF Cost
<pre>
| Serial bandwidth 調整
R3 有正常路由。
| R1-R2:128K<br>R2-R3:128K<br>R1-R3:64K
R3 可作為 ACL 測試來源。
| <pre>
R3-PC1 10.3.1.10 可作為 VPN 遠端目的端。
R1:
interface serial0/0/0
bandwidth 128
interface serial0/0/1
bandwidth 64
 
R2:
interface serial0/0/0
bandwidth 128
interface serial0/0/1
bandwidth 128
 
R3:
interface serial0/0/0
bandwidth 64
interface serial0/0/1
bandwidth 128
</pre>
| <pre>
show ip route ospf
show interfaces serial0/0/0
show interfaces serial0/0/1
 
可看到依 bandwidth 產生不同 OSPF cost
</pre>
</pre>
| 用 bandwidth 調整 OSPF cost,產生預期的等值路由或指定路徑。
|-
| Default Route
| R1 對 Internet
| Default route:0.0.0.0/0<br>Next-hop:193.16.1.253
| <pre>
conf t
ip route 0.0.0.0 0.0.0.0 193.16.1.253


=== R3-3 R3-PC 測試紀錄 ===


輸入指令:
<pre>
R3-PC> ping 172.16.100.101
R3-PC> ping 172.16.100.102
R3-PC> ftp 172.16.100.102
</pre>
</pre>
| <pre>
show ip route


系統回應 / 驗證結果:
S* 0.0.0.0/0 via 193.16.1.253
<pre>
R3-PC ping 172.16.100.101:Not OK
R3-PC ping 172.16.100.102:OK
R3-PC http 172.16.100.102:OK
R3-PC ftp 172.16.100.102:Not OK
</pre>
</pre>
| R1 是總公司對 Internet 出口。
|-
| OSPF Default
| R1 宣告 default route
| OSPF default-information originate
| <pre>
conf t


----
router ospf 1
default-information originate


== 五、R6 補充設定 ==


=== R6-1 Default Route ===


輸入指令:
</pre>
<pre>
| <pre>
R2 / R3 show ip route
 
O*E2 0.0.0.0/0
</pre>
| R2 / R3 透過 OSPF 學到預設路由。
|-
 
| Default Route
| R6 對 Internet
| Default route:0.0.0.0/0<br>Next-hop:193.16.6.253
| <pre>
conf t
conf t
ip route 0.0.0.0 0.0.0.0 193.16.6.253
ip route 0.0.0.0 0.0.0.0 193.16.6.253




</pre>
</pre>
| <pre>
show ip route


驗證指令:
S* 0.0.0.0/0 via 193.16.6.253
<pre>
show ip route
show ip route 0.0.0.0
</pre>
</pre>
| R6 是分公司對 Internet 出口。
|-
| NAT / PAT
| R1 VLAN12 PAT
| Inside:Fa0/0.2<br>Outside:Serial0/1/1<br>ACL:10<br>VLAN12:10.1.12.16/28
| <pre>
conf t
interface fa0/0.2
ip nat inside
exit
interface serial0/1/1
ip nat outside
exit
access-list 10 permit 10.1.12.16 0.0.0.15
ip nat inside source list 10 interface serial0/1/1 overload


系統回應 / 驗證結果應看到:
<pre>
S* 0.0.0.0/0 [1/0] via 193.16.6.253
</pre>
</pre>
| <pre>
VLAN12-RD1:
ping 200.200.200.200


=== R6-2 PAT 設定 ===
R1:
show ip nat translations


說明:
可看到 PAT translation
* R6-PC5 網段:10.5.0.0/24。
</pre>
* R6-PC5 Gateway:10.5.0.254。
| VLAN12 使用 R1 Serial0/1/1 的公有 IP 做 overload PAT。
* R6 PAT outside:Serial0/0/0。
|-
* PAT 公網位址:193.16.6.254。


輸入指令:
| NAT / PAT
<pre>
| R6-PC5 PAT
| Inside:Fa0/1<br>Outside:Serial0/0/0<br>ACL:10<br>R6-PC5 網段:10.5.0.0/24
| <pre>
conf t
conf t


access-list 5 permit 10.5.0.0 0.0.0.255
interface fa0/1
ip nat inside
exit
 
interface serial0/0/0
ip nat outside
exit
 
access-list 10 permit 10.5.0.0 0.0.0.255
 
ip nat inside source list 10 interface serial0/0/0 overload
 
 
 
</pre>
| <pre>
R6-PC5:
ping 200.200.200.200


interface fastEthernet0/1
R6:
show ip nat translations
 
可看到 PAT translation
</pre>
| R6-PC5 使用 R6 Serial0/0/0 的公有 IP 做 overload PAT。
|-
 
| Dynamic NAT
| R1 VLAN13 Dynamic NAT
| Inside:Fa0/0.3<br>Outside:Serial0/1/1<br>ACL:20<br>Pool:171.69.233.210 - 171.69.233.222
| <pre>
conf t
 
interface fa0/0.3
  ip nat inside
  ip nat inside
exit


interface serial0/0/0
interface serial0/1/1
  ip nat outside
  ip nat outside
exit
no access-list 20
no ip nat inside source list 20 pool netpool
no ip nat pool netpool 171.69.233.210 171.69.233.222 netmask 255.255.255.240
access-list 20 permit 10.1.13.24 0.0.0.7
ip nat pool natpool 171.69.233.210 171.69.233.222 netmask 255.255.255.240


ip nat inside source list 5 interface serial0/0/0 overload
ip nat inside source list 20 pool natpool






</pre>
</pre>
| <pre>
VLAN13-Sales2:
ping 200.200.200.200


驗證指令:
R1:
<pre>
show ip nat translations
show ip nat translations
show access-lists 5
 
可看到 10.1.13.26 轉成 171.69.233.210
</pre>
| VLAN13 使用 Dynamic NAT,公有 IP 池從 171.69.233.210 到 171.69.233.222。
|-
 
| NAT 回程路由
| Internet Router 回指公有 IP 池
| Public Pool:171.69.233.208/28<br>Next-hop:193.16.1.254
| <pre>
conf t
 
ip route 171.69.233.208 255.255.255.240 193.16.1.254
 
 
 
</pre>
</pre>
| <pre>
show ip route


測試來源:
S 171.69.233.208/28 via 193.16.1.254
<pre>
R6-PC5> ping 200.200.200.200
R6-PC5> 使用 Web Browser 開啟 http://200.200.200.200
</pre>
</pre>
| Internet Router 必須知道 NAT 公有 IP 池要回到 R1。
|-
| Static NAT
| R2-DMZ Static NAT
| Inside local:172.16.100.102<br>Inside global:171.69.233.209
| <pre>
conf t
interface serial0/0/0
ip nat inside
exit
interface serial0/1/1
ip nat outside
exit
no ip nat inside source static 172.16.100.103 171.69.233.209
ip nat inside source static 172.16.100.102 171.69.233.209


系統回應 / 驗證結果:
<pre>
R6-PC5 ping Internet WWW:OK
R6-PC5 http Internet WWW:OK
R6 show ip nat translations 可看到 PAT 轉址紀錄
</pre>
</pre>
| <pre>
R1:
show ip nat translations


=== R6-3 IPSec VPN 設定 ===
--- 171.69.233.209  172.16.100.102  ---  ---


說明:
Internet User:
* R6-PC6:10.6.0.10。
ping 171.69.233.209
* R3-PC1:10.3.1.10。
 
* R6 外部 IP:193.16.6.254。
Reply from 171.69.233.209
* R1 外部 IP:193.16.1.254。
</pre>
* PSK:SeCrEt。
| R2-DMZ 伺服器 172.16.100.102 固定對應到公有 IP 171.69.233.209。
* Phase 1:3DES / SHA / Group 2。
|-
* Phase 2:ESP / AES / MD5。


輸入指令:
| IPSec VPN
<pre>
| R1 Phase 1
| PSK:SeCrEt<br>Encryption:3DES<br>Hash:SHA<br>DH Group:2<br>Lifetime:86400
| <pre>
conf t
conf t


行 984: 行 1,456:
exit
exit


crypto isakmp key SeCrEt address 193.16.1.254
crypto isakmp key SeCrEt address 193.16.6.254
 
 
 
</pre>
| <pre>
show crypto isakmp policy
 
encryption algorithm: Three key triple DES
hash algorithm: Secure Hash Standard
authentication method: Pre-Shared Key
Diffie-Hellman group: #2
lifetime: 86400 seconds
</pre>
| R1 的 IKE Phase 1 參數。
|-
 
| IPSec VPN
| R1 Phase 2 / Crypto Map
| Transform-set:ts16<br>ESP AES / MD5<br>Peer:193.16.6.254<br>Crypto ACL:110
| <pre>
conf t


crypto ipsec transform-set ts61 esp-aes esp-md5-hmac
crypto ipsec transform-set ts16 esp-aes esp-md5-hmac


access-list 110 permit ip 10.6.0.0 0.0.0.255 10.3.1.0 0.0.0.255
no access-list 110
access-list 110 permit ip 10.3.1.0 0.0.0.255 10.6.0.0 0.0.0.255


crypto map map61 10 ipsec-isakmp
crypto map map16 10 ipsec-isakmp
  set peer 193.16.1.254
  set peer 193.16.6.254
  set transform-set ts61
  set transform-set ts16
  match address 110
  match address 110
exit
exit


interface serial0/0/0
interface serial0/1/1
  crypto map map61
  crypto map map16






</pre>
</pre>
| <pre>
show crypto ipsec sa
local ident: 10.3.1.0/24
remote ident: 10.6.0.0/24
encaps / decaps 有數字
</pre>
| R1 crypto ACL 與 R6 必須鏡像對稱。
|-
| IPSec VPN
| R6 Phase 1
| PSK:SeCrEt<br>Encryption:3DES<br>Hash:SHA<br>DH Group:2<br>Lifetime:86400
| <pre>
conf t
crypto isakmp policy 10
encr 3des
hash sha
authentication pre-share
group 2
lifetime 86400
exit
crypto isakmp key SeCrEt address 193.16.1.254


=== R6-4 VPN 查修時重掛 Crypto Map ===


說明:
</pre>
* 若 ACL 110 有 match,但是 show crypto ipsec sa encaps / decaps 仍為 0,可重新套用 crypto map。
| <pre>
* 本次查修時曾使用此方式讓 Packet Tracer 重新吃到設定。
show crypto isakmp policy
 
encryption algorithm: Three key triple DES
hash algorithm: Secure Hash Standard
authentication method: Pre-Shared Key
Diffie-Hellman group: #2
lifetime: 86400 seconds
</pre>
| R6 IKE Phase 1 參數。
|-


輸入指令:
| IPSec VPN
<pre>
| R6 Phase 2 / Crypto Map
| Transform-set:ts61<br>ESP AES / MD5<br>Peer:193.16.1.254<br>Crypto ACL:110
| <pre>
conf t
conf t
crypto ipsec transform-set ts61 esp-aes esp-md5-hmac
no access-list 110
access-list 110 permit ip 10.6.0.0 0.0.0.255 10.3.1.0 0.0.0.255
crypto map map61 10 ipsec-isakmp
set peer 193.16.1.254
set transform-set ts61
match address 110
exit


interface serial0/0/0
interface serial0/0/0
no crypto map map61
  crypto map map61
  crypto map map61


行 1,020: 行 1,560:


</pre>
</pre>
| <pre>
show crypto ipsec sa


系統回應:
local ident: 10.6.0.0/24
<pre>
remote ident: 10.3.1.0/24
沒有錯誤訊息即代表重新套用完成。
encaps / decaps 有數字
</pre>
</pre>
| R6 crypto ACL 與 R1 必須鏡像對稱。
|-


=== R6-5 VPN 驗證指令 ===
| IPSec VPN 驗證
| R6-PC6 到 R3-PC1
| Source:10.6.0.10<br>Destination:10.3.1.10
| <pre>
R6-PC6:
ping 10.3.1.10
</pre>
| <pre>
Reply from 10.3.1.10
Sent = 4, Received = 4, Lost = 0
</pre>
| VPN 端到端通訊成功。
|-


輸入指令:
| IPSec VPN 驗證
<pre>
| R6 ISAKMP SA
| Phase 1 狀態
| <pre>
show crypto isakmp sa
show crypto isakmp sa
show crypto ipsec sa
show access-lists 110
</pre>
</pre>
 
| <pre>
系統回應 / 驗證結果:
<pre>
show crypto isakmp sa:
IPv4 Crypto ISAKMP SA
IPv4 Crypto ISAKMP SA
dst          src          state    conn-id  slot  status
dst          src          state    conn-id  slot  status
193.16.1.254  193.16.6.254  QM_IDLE  1024    0    ACTIVE
193.16.1.254  193.16.6.254  QM_IDLE  1024    0    ACTIVE
</pre>
</pre>
| QM_IDLE / ACTIVE 代表 Phase 1 成功。
|-


系統回應 / 驗證結果:
| IPSec VPN 驗證
<pre>
| R6 IPSec SA
show crypto ipsec sa:
| Phase 2 封包計數
| <pre>
show crypto ipsec sa
</pre>
| <pre>
#pkts encaps: 7
#pkts encaps: 7
#pkts encrypt: 7
#pkts encrypt: 7
行 1,057: 行 1,616:
  Status: ACTIVE
  Status: ACTIVE
</pre>
</pre>
| encaps / decaps 有增加,代表 Phase 2 成功加密與解密。
|-


系統回應 / 驗證結果:
| ACL
<pre>
| R2 Exted ACL 100
show access-lists 110:
| 套用介面:R2 Fa0/0<br>方向:out<br>控制 172.16.100.101 / 172.16.100.102
permit ip 10.6.0.0 0.0.0.255 10.3.1.0 0.0.0.255 (7 match(es))
| <pre>
</pre>
conf t


=== R6-6 VPN 端點測試 ===
no access-list 100


輸入指令:
access-list 100 permit tcp 10.1.12.16 0.0.0.15 172.16.100.101 0.0.0.0 eq 20
<pre>
access-list 100 permit tcp 10.1.12.16 0.0.0.15 172.16.100.101 0.0.0.0 eq 21
R6-PC6> ping 10.3.1.10
access-list 100 deny ip 10.1.12.16 0.0.0.15 172.16.100.101 0.0.0.0
</pre>
access-list 100 deny ip 10.0.0.0 0.255.255.255 172.16.100.101 0.0.0.0


系統回應 / 驗證結果:
access-list 100 permit tcp any 172.16.100.102 0.0.0.0 eq 80
<pre>
access-list 100 permit icmp any 172.16.100.102 0.0.0.0
Reply from 10.3.1.10
access-list 100 deny ip any 172.16.100.102 0.0.0.0
Sent = 4, Received = 4, Lost = 0
</pre>


判定:
interface fa0/0
<pre>
ip access-group 100 out
IPSec VPN Phase 1:完成
IPSec VPN Phase 2:完成
R6-PC6 到 R3-PC1 通訊:完成
</pre>


----


== 六、Internet Router 補充設定 ==


=== Internet-1 公有 IP 池回程路由 ===
</pre>
| <pre>
show running-config interface fa0/0


說明:
interface FastEthernet0/0
* Dynamic NAT 與 Static NAT 使用的公有 IP 範圍:
ip access-group 100 out
  * 171.69.233.209 ~ 171.69.233.222
</pre>
* 歸納網段:
| ACL 100 套在 R2 Fa0/0 outbound,控制往 Server 區的流量。
  * 171.69.233.208/28
|-
* 回程下一跳:
  * R1 外部 IP:193.16.1.254


輸入指令:
| ACL 驗證
<pre>
| 清除 ACL 計數器
conf t
| ACL 100
| <pre>
clear access-list counters 100
</pre>
| <pre>
沒有錯誤訊息即代表完成
</pre>
| 測試前先清除計數器,方便確認 permit / deny 是否被命中。
|-


ip route 171.69.233.208 255.255.255.240 193.16.1.254
| ACL 驗證
| VLAN12-RD1 FTP R2-Private
| Source:10.1.12.17<br>Destination:172.16.100.101<br>Service:FTP
| <pre>
ftp 172.16.100.101
</pre>
| <pre>
Connected to 172.16.100.101
230 Logged in
</pre>
| 符合 ACL 要求:VLAN12 可使用 FTP 存取 R2-Private。
|-


| ACL 驗證
| VLAN12-RD1 ping R2-Private
| Source:10.1.12.17<br>Destination:172.16.100.101<br>Service:ICMP
| <pre>
ping 172.16.100.101
</pre>
| <pre>
Destination host unreachable
Sent = 4, Received = 0, Lost = 4
</pre>
| 符合 ACL 要求:VLAN12 除 FTP 以外不可存取 R2-Private。
|-


| ACL 驗證
| R3-PC ping R2-Private
| Source:10.3.2.10<br>Destination:172.16.100.101<br>Service:ICMP
| <pre>
ping 172.16.100.101
</pre>
| <pre>
Destination host unreachable
Sent = 4, Received = 0, Lost = 4
</pre>
| 符合 ACL 要求:總公司其他 VLAN / R3 內網不可存取 R2-Private。
|-


| ACL 驗證
| R3-PC ping R2-DMZ
| Source:10.3.2.10<br>Destination:172.16.100.102<br>Service:ICMP
| <pre>
ping 172.16.100.102
</pre>
| <pre>
Reply from 172.16.100.102
Sent = 4, Received = 4, Lost = 0
</pre>
</pre>
| 符合 ACL 要求:Any-PC 可 ping R2-DMZ。
|-


驗證指令:
| ACL 驗證
<pre>
| R3-PC http R2-DMZ
show ip route
| Source:10.3.2.10<br>Destination:172.16.100.102<br>Service:HTTP
show running-config | include 171.69.233.208
| <pre>
Web Browser:
http://172.16.100.102
</pre>
| <pre>
Cisco Packet Tracer 網頁成功開啟
</pre>
</pre>
| 符合 ACL 要求:Any-PC 可使用 HTTP 存取 R2-DMZ。
|-


系統回應 / 驗證結果應看到:
| ACL 驗證
<pre>
| R3-PC ftp R2-DMZ
S 171.69.233.208/28 [1/0] via 193.16.1.254
| Source:10.3.2.10<br>Destination:172.16.100.102<br>Service:FTP
| <pre>
ftp 172.16.100.102
</pre>
| <pre>
Error opening ftp://172.16.100.102/
Timed out
</pre>
</pre>
| 符合 ACL 要求:R2-DMZ 不允許 FTP 等其他服務。
|-


=== Internet-2 Internet Router 注意事項 ===
| ACL 驗證
 
| R2 show access-lists 100
說明:
| ACL match 結果
<pre>
| <pre>
Internet Router 不應設定指向企業內部私有 IP 的 static route。
show access-lists 100
Internet Router 不應出現指向 10.0.0.0/8 的 static route。
</pre>
Internet Router 不應出現指向 172.16.100.0/24 的 static route。
| <pre>
Internet Router 不應出現指向 192.168.123.0/30 的 static route。
permit tcp 10.1.12.16 0.0.0.15 host 172.16.100.101 eq ftp (11 match(es))
Internet Router 只需要知道如何回到 NAT 公有 IP 池 171.69.233.208/28。
deny ip 10.1.12.16 0.0.0.15 host 172.16.100.101 (4 match(es))
deny ip 10.0.0.0 0.255.255.255 host 172.16.100.101 (101 match(es))
permit tcp any host 172.16.100.102 eq www (5 match(es))
permit icmp any host 172.16.100.102 (4 match(es))
deny ip any host 172.16.100.102 (12 match(es))
</pre>
</pre>
| permit / deny 規則皆有 match,ACL 驗證完成。
|-


----
| SSH ACL
| R3 只允許 VLAN14 IT SSH
| Username:user<br>Password:123<br>Domain:ckc.com<br>RSA:1024<br>ACL:12
| <pre>
conf t


== 七、終端設備測試紀錄 ==
username user password 123
ip domain-name ckc.com
crypto key generate rsa
1024
ip ssh version 2


=== VLAN12-RD1 測試 ===
access-list 12 permit 10.1.14.64 0.0.0.31


輸入指令:
line vty 0 5
<pre>
login local
ping 200.200.200.200
transport input ssh
ftp 172.16.100.101
access-class 12 in
ping 172.16.100.101
exit
</pre>


系統回應 / 驗證結果:
line vty 6 15
<pre>
transport input none
ping 200.200.200.200:OK
exit
ftp 172.16.100.101:OK
ping 172.16.100.101:Not OK
</pre>


=== R3-PC 測試 ===


輸入指令:
<pre>
ping 172.16.100.101
ping 172.16.100.102
ftp 172.16.100.102
</pre>


系統回應 / 驗證結果:
<pre>
ping 172.16.100.101:Not OK
ping 172.16.100.102:OK
http 172.16.100.102:OK
ftp 172.16.100.102:Not OK
</pre>
</pre>
 
| <pre>
=== R6-PC6 VPN 測試 ===
VLAN14-IT ssh 到 R3:OK
 
其他 VLAN ssh 到 R3:Not OK
輸入指令:
<pre>
ping 10.3.1.10
</pre>
</pre>
| 只允許 VLAN14 IT 網段使用 SSH 管理 R3,最多開放 vty 0 到 5 共 6 條 sessions。
|-


系統回應 / 驗證結果:
| 最終驗證
<pre>
| NAT / PAT
ping 10.3.1.10:OK
| VLAN12、VLAN13、R6-PC5
Sent = 4, Received = 4, Lost = 0
| <pre>
</pre>
VLAN12-RD1:
ping 200.200.200.200


----
VLAN13-Sales2:
ping 200.200.200.200


== 八、最終結論 ==
R6-PC5:
ping 200.200.200.200


{| class="wikitable"
R1 / R6:
! 大項
show ip nat translations
! 結果
</pre>
|-
| <pre>
| NAT / PAT
VLAN12 PAT:OK
| 完成
VLAN13 Dynamic NAT:OK
|-
R6-PC5 PAT:OK
| Dynamic NAT
NAT translation 有產生
| 完成
</pre>
| NAT / PAT 完成。
|-
|-
| 最終驗證
| Static NAT
| Static NAT
| 完成
| 172.16.100.102 ↔ 171.69.233.209
| <pre>
Internet User:
ping 171.69.233.209
http://171.69.233.209
 
R1:
show ip nat translations
</pre>
| <pre>
Internet User ping R2-DMZ 公有 IP:OK
Internet User http R2-DMZ 公有 IP:OK
Static NAT translation 存在
</pre>
| Static NAT 完成。
|-
|-
| 最終驗證
| IPSec VPN
| IPSec VPN
| 完成
| R6-PC6 ↔ R3-PC1
| <pre>
R6-PC6:
ping 10.3.1.10
 
R6:
show crypto isakmp sa
show crypto ipsec sa
</pre>
| <pre>
R6-PC6 ping 10.3.1.10:OK
QM_IDLE / ACTIVE
encaps / decaps 有增加
</pre>
| IPSec VPN 完成。
|-
|-
| Exted ACL 100
 
| 完成
| 最終驗證
|-
| ACL 100
| Permit 測試
| R2 Fa0/0 outbound
| 完成
| <pre>
|-
R2:
| Deny 測試
show access-lists 100
| 完成
</pre>
| <pre>
permit 規則有 match
deny 規則有 match
ACL 測試全部符合預期
</pre>
| Exted ACL 100 完成。
|}
|}
'''2026-0608 ACL / NAT / PAT / VPN Lab 已完成。'''

於 2026年5月25日 (一) 02:55 的修訂

類別 設備 / 位置 設定數值 輸入指令 系統回應 / 驗證結果 說明
終端設備 S1 網管 IP IP:10.1.99.101
Mask:255.255.255.0
Gateway:10.1.99.254
在 Switch S1 的 Config / VLAN Interface 或 CLI 設定:
interface vlan 99
 ip address 10.1.99.101 255.255.255.0
 no shutdown
exit
ip default-gateway 10.1.99.254
show ip interface brief

Vlan99  10.1.99.101  YES manual  up  up
S1 管理 VLAN 使用 VLAN99,Gateway 指向 R1 的 Fa0/0.99:10.1.99.254。
終端設備 S2 網管 IP IP:10.1.99.102
Mask:255.255.255.0
Gateway:10.1.99.254
interface vlan 99
 ip address 10.1.99.102 255.255.255.0
 no shutdown
exit
ip default-gateway 10.1.99.254
show ip interface brief

Vlan99  10.1.99.102  YES manual  up  up
S2 管理 VLAN 使用 VLAN99,Gateway 同樣指向 R1 的 10.1.99.254。
終端設備 Mgmt Server IP:10.1.99.100
Mask:255.255.255.0
Gateway:10.1.99.254
Desktop > IP Configuration

IP Address: 10.1.99.100
Subnet Mask: 255.255.255.0
Default Gateway: 10.1.99.254
ping 10.1.99.254

Reply from 10.1.99.254
Mgmt Server 放在 VLAN99,用來測試交換器管理 VLAN 與 R1 單臂路由。
終端設備 VLAN12-RD1 IP:10.1.12.17
Mask:255.255.255.240
Gateway:10.1.12.30
Desktop > IP Configuration

IP Address: 10.1.12.17
Subnet Mask: 255.255.255.240
Default Gateway: 10.1.12.30
ping 10.1.12.30

Reply from 10.1.12.30
VLAN12-RD1 接在 S1 Fa0/11,屬於 RD 部門 VLAN12。
終端設備 VLAN12-RD2 IP:10.1.12.18
Mask:255.255.255.240
Gateway:10.1.12.30
Desktop > IP Configuration

IP Address: 10.1.12.18
Subnet Mask: 255.255.255.240
Default Gateway: 10.1.12.30
ping 10.1.12.30

Reply from 10.1.12.30
VLAN12-RD2 接在 S2 Fa0/11,屬於 RD 部門 VLAN12。
終端設備 VLAN13-Sales1 IP:10.1.13.25
Mask:255.255.255.248
Gateway:10.1.13.30
Desktop > IP Configuration

IP Address: 10.1.13.25
Subnet Mask: 255.255.255.248
Default Gateway: 10.1.13.30
ping 10.1.13.30

Reply from 10.1.13.30
VLAN13-Sales1 接在 S1 Fa0/15,屬於 Sales 部門 VLAN13。
終端設備 VLAN13-Sales2 IP:10.1.13.26
Mask:255.255.255.248
Gateway:10.1.13.30
Desktop > IP Configuration

IP Address: 10.1.13.26
Subnet Mask: 255.255.255.248
Default Gateway: 10.1.13.30
ping 10.1.13.30

Reply from 10.1.13.30
VLAN13-Sales2 接在 S2 Fa0/15,後續 Dynamic NAT 測試使用此主機。
終端設備 VLAN14-IT IP:10.1.14.65
Mask:255.255.255.224
Gateway:10.1.14.94
Desktop > IP Configuration

IP Address: 10.1.14.65
Subnet Mask: 255.255.255.224
Default Gateway: 10.1.14.94
ping 10.1.14.94

Reply from 10.1.14.94
VLAN14-IT 接在 S2 Fa0/19,後續也用於 SSH ACL 測試。
終端設備 R2-Private / R2-Server1 IP:172.16.100.101
Mask:255.255.255.0
Gateway:172.16.100.254
Desktop > IP Configuration

IP Address: 172.16.100.101
Subnet Mask: 255.255.255.0
Default Gateway: 172.16.100.254
VLAN12-RD1 ftp 172.16.100.101

Connected to 172.16.100.101
230 Logged in
R2-Private 伺服器,ACL 要求只允許 VLAN12 使用 FTP 存取。
終端設備 R2-DMZ / R2-Server2 IP:172.16.100.102
Mask:255.255.255.0
Gateway:172.16.100.254
Desktop > IP Configuration

IP Address: 172.16.100.102
Subnet Mask: 255.255.255.0
Default Gateway: 172.16.100.254
R3-PC ping 172.16.100.102

Reply from 172.16.100.102
R2-DMZ 伺服器,後續 Static NAT 對應到 171.69.233.209,ACL 只允許 ping / http。
終端設備 R3-PC1 IP:10.3.1.10
Mask:255.255.255.0
Gateway:10.3.1.254
Desktop > IP Configuration

IP Address: 10.3.1.10
Subnet Mask: 255.255.255.0
Default Gateway: 10.3.1.254
R6-PC6 ping 10.3.1.10

Reply from 10.3.1.10
R3-PC1 是 IPSec VPN 的遠端內網目的端。
終端設備 R3-PC2 IP:10.3.2.10
Mask:255.255.255.0
Gateway:10.3.2.254
Desktop > IP Configuration

IP Address: 10.3.2.10
Subnet Mask: 255.255.255.0
Default Gateway: 10.3.2.254
ping 10.3.2.254

Reply from 10.3.2.254
10.3.2.0/24 為 R3 第二內網,曾用於 Static Route / Floating Static Route 測試。
終端設備 R6-PC5 IP:10.5.0.10
Mask:255.255.255.0
Gateway:10.5.0.254
Desktop > IP Configuration

IP Address: 10.5.0.10
Subnet Mask: 255.255.255.0
Default Gateway: 10.5.0.254
ping 200.200.200.200

Reply from 200.200.200.200
R6-PC5 使用 R6 PAT 連到 Internet。
終端設備 R6-PC6 IP:10.6.0.10
Mask:255.255.255.0
Gateway:10.6.0.254
Desktop > IP Configuration

IP Address: 10.6.0.10
Subnet Mask: 255.255.255.0
Default Gateway: 10.6.0.254
ping 10.3.1.10

Sent = 4, Received = 4, Lost = 0
R6-PC6 是 IPSec VPN 的本端內網來源。
終端設備 Internet WWW IP:200.200.200.200
Mask:255.255.255.0
Gateway:200.200.200.254
Desktop > IP Configuration

IP Address: 200.200.200.200
Subnet Mask: 255.255.255.0
Default Gateway: 200.200.200.254
VLAN12-RD1 ping 200.200.200.200

Reply from 200.200.200.200
Internet WWW 是 NAT / PAT 連外測試目的端。
終端設備 Internet User IP:201.201.201.201
Mask:255.255.255.0
Gateway:201.201.201.254
Desktop > IP Configuration

IP Address: 201.201.201.201
Subnet Mask: 255.255.255.0
Default Gateway: 201.201.201.254
ping 171.69.233.209

Reply from 171.69.233.209
Internet User 用於測試 R2-DMZ Static NAT 公有 IP 171.69.233.209。
Switch VLAN S1 建立 VLAN VLAN12:RD
VLAN13:Sales
VLAN14:IT
VLAN99:MGMT
conf t
vlan 12
 name RD
vlan 13
 name sales
vlan 14
 name IT
vlan 99
 name MGMT


show vlan brief

12  RD
13  sales
14  IT
99  MGMT
S1 建立全部 VLAN,供 access port 與 trunk 使用。
Switch VLAN S2 建立 VLAN VLAN12:RD
VLAN13:Sales
VLAN14:IT
VLAN99:MGMT
conf t
vlan 12
 name RD
vlan 13
 name sales
vlan 14
 name IT
vlan 99
 name MGMT


show vlan brief

12  RD
13  sales
14  IT
99  MGMT
S2 建立與 S1 相同的 VLAN。
Switch Access Port S1 Access Port Fa0/11:VLAN12
Fa0/15:VLAN13
Fa0/21:VLAN99
conf t

interface fa0/11
 switchport mode access
 switchport access vlan 12
 no shutdown
exit

interface fa0/15
 switchport mode access
 switchport access vlan 13
 no shutdown
exit

interface fa0/21
 switchport mode access
 switchport access vlan 99
 no shutdown
exit



show vlan brief

Fa0/11 在 VLAN12
Fa0/15 在 VLAN13
Fa0/21 在 VLAN99
S1 上的終端設備分別放入對應 VLAN。
Switch Access Port S2 Access Port Fa0/11:VLAN12
Fa0/15:VLAN13
Fa0/19:VLAN14
conf t

interface fa0/11
 switchport mode access
 switchport access vlan 12
 no shutdown
exit

interface fa0/15
 switchport mode access
 switchport access vlan 13
 no shutdown
exit

interface fa0/19
 switchport mode access
 switchport access vlan 14
 no shutdown
exit



show vlan brief

Fa0/11 在 VLAN12
Fa0/15 在 VLAN13
Fa0/19 在 VLAN14
S2 上的 RD、Sales、IT 主機分別放入 VLAN12、VLAN13、VLAN14。
Switch Trunk S1 連接 S2 的 Trunk Trunk Port:Fa0/23 - 24
Allowed VLAN:12,13,14,99
conf t

interface range fa0/23 - 24
 switchport mode trunk
 switchport trunk allowed vlan 12,13,14,99
 no shutdown



show interfaces trunk

Port        Mode     Status
Fa0/23      on       trunking
Fa0/24      on       trunking

Vlans allowed on trunk: 12,13,14,99
S1 與 S2 之間使用 trunk 傳送多個 VLAN。
Switch Trunk S2 連接 S1 的 Trunk Trunk Port:Fa0/23 - 24
Allowed VLAN:12,13,14,99
conf t

interface range fa0/23 - 24
 switchport mode trunk
 switchport trunk allowed vlan 12,13,14,99
 no shutdown



show interfaces trunk

Port        Mode     Status
Fa0/23      on       trunking
Fa0/24      on       trunking

Vlans allowed on trunk: 12,13,14,99
S2 與 S1 之間使用 trunk 傳送多個 VLAN。
Switch Trunk S1 連接 R1 的 Trunk S1 Fa0/5 → R1 Fa0/0
Allowed VLAN:12,13,14,99
conf t

interface fa0/5
 switchport mode trunk
 switchport trunk allowed vlan 12,13,14,99
 no shutdown



show interfaces trunk

Fa0/5 trunking
Vlans allowed on trunk: 12,13,14,99
S1 Fa0/5 連接 R1 Fa0/0,提供 Router-on-a-stick 單臂路由。
Router-on-a-stick R1 啟用實體 Fa0/0 R1 Fa0/0 不設 IP,只作為子介面承載 trunk
conf t

interface fa0/0
 no shutdown



show ip interface brief

FastEthernet0/0  unassigned  up  up
R1 Fa0/0 為 trunk 母介面,實際閘道 IP 設在子介面。
Router-on-a-stick R1 Fa0/0.2 VLAN12 Gateway:10.1.12.30/28
conf t

interface fa0/0.2
 encapsulation dot1Q 12
 ip address 10.1.12.30 255.255.255.240



show ip interface brief

FastEthernet0/0.2  10.1.12.30  up  up
VLAN12 的 Default Gateway。
Router-on-a-stick R1 Fa0/0.3 VLAN13 Gateway:10.1.13.30/29
conf t

interface fa0/0.3
 encapsulation dot1Q 13
 ip address 10.1.13.30 255.255.255.248



show ip interface brief

FastEthernet0/0.3  10.1.13.30  up  up
VLAN13 的 Default Gateway。
Router-on-a-stick R1 Fa0/0.4 VLAN14 Gateway:10.1.14.94/27
conf t

interface fa0/0.4
 encapsulation dot1Q 14
 ip address 10.1.14.94 255.255.255.224



show ip interface brief

FastEthernet0/0.4  10.1.14.94  up  up
VLAN14 的 Default Gateway。
Router-on-a-stick R1 Fa0/0.99 VLAN99 Gateway:10.1.99.254/24
conf t

interface fa0/0.99
 encapsulation dot1Q 99
 ip address 10.1.99.254 255.255.255.0



show ip interface brief

FastEthernet0/0.99  10.1.99.254  up  up
VLAN99 管理網段的 Default Gateway。
R1 介面 R1 to R2 Serial0/0/0:192.168.123.1/30
Bandwidth:128
conf t

interface serial0/0/0
 ip address 192.168.123.1 255.255.255.252
 bandwidth 128
 no shutdown



show ip interface brief

Serial0/0/0  192.168.123.1  up  up
R1 與 R2 的 Serial link。
R1 介面 R1 to R3 Serial0/0/1:192.168.123.5/30
Bandwidth:64
Clock rate:64000
conf t

interface serial0/0/1
 ip address 192.168.123.5 255.255.255.252
 bandwidth 64
 clock rate 64000
 no shutdown



show ip interface brief

Serial0/0/1  192.168.123.5  up  up
R1 與 R3 的 Serial link,成本較高,用於 OSPF cost / ECMP 設計。
R1 介面 R1 to Internet Serial0/1/1:193.16.1.254/30
conf t

interface serial0/1/1
 ip address 193.16.1.254 255.255.255.252
 no shutdown



show ip interface brief

Serial0/1/1  193.16.1.254  up  up
R1 對接 Internet Router,後續 NAT outside 與 VPN peer 都使用此介面。
R2 介面 R2 to R1 Serial0/0/0:192.168.123.2/30
Bandwidth:128
conf t

interface serial0/0/0
 ip address 192.168.123.2 255.255.255.252
 bandwidth 128
 no shutdown



show ip interface brief

Serial0/0/0  192.168.123.2  up  up
R2 與 R1 的 Serial link。
R2 介面 R2 to R3 Serial0/0/1:192.168.123.9/30
Bandwidth:128
Clock rate:128000
conf t

interface serial0/0/1
 ip address 192.168.123.9 255.255.255.252
 bandwidth 128
 clock rate 128000
 no shutdown



show ip interface brief

Serial0/0/1  192.168.123.9  up  up
R2 與 R3 的 Serial link。
R2 介面 R2 Server 區 Fa0/0:172.16.100.254/24
conf t

interface fa0/0
 ip address 172.16.100.254 255.255.255.0
 no shutdown



show ip interface brief

FastEthernet0/0  172.16.100.254  up  up
R2 Server / DMZ 區 gateway,後續 ACL 100 套用於此介面 outbound。
R3 介面 R3 Fa0/0 10.3.1.254/24
conf t

interface fa0/0
 ip address 10.3.1.254 255.255.255.0
 no shutdown



show ip interface brief

FastEthernet0/0  10.3.1.254  up  up
R3-PC1 所在網段 gateway,也是 VPN 遠端內網。
R3 介面 R3 Fa0/1 10.3.2.254/24
conf t

interface fa0/1
 ip address 10.3.2.254 255.255.255.0
 no shutdown



show ip interface brief

FastEthernet0/1  10.3.2.254  up  up
R3 第二內網。
R3 介面 R3 to R1 Serial0/0/0:192.168.123.6/30
Bandwidth:64
conf t

interface serial0/0/0
 ip address 192.168.123.6 255.255.255.252
 bandwidth 64
 no shutdown



show ip interface brief

Serial0/0/0  192.168.123.6  up  up
R3 與 R1 的 Serial link。
R3 介面 R3 to R2 Serial0/0/1:192.168.123.10/30
Bandwidth:128
conf t

interface serial0/0/1
 ip address 192.168.123.10 255.255.255.252
 bandwidth 128
 no shutdown



show ip interface brief

Serial0/0/1  192.168.123.10  up  up
R3 與 R2 的 Serial link。
R6 介面 R6 Fa0/1 10.5.0.254/24
conf t

interface fastEthernet0/1
 ip address 10.5.0.254 255.255.255.0
 no shutdown



show ip interface brief

FastEthernet0/1  10.5.0.254  up  up
R6-PC5 所在網段 gateway,後續 R6 PAT inside。
R6 介面 R6 Fa0/0 10.6.0.254/24
conf t

interface fastEthernet0/0
 ip address 10.6.0.254 255.255.255.0
 no shutdown



show ip interface brief

FastEthernet0/0  10.6.0.254  up  up
R6-PC6 所在網段 gateway,後續 VPN protected LAN。
R6 介面 R6 to Internet Serial0/0/0:193.16.6.254/30
conf t

interface serial0/0/0
 ip address 193.16.6.254 255.255.255.252
 no shutdown



show ip interface brief

Serial0/0/0  193.16.6.254  up  up
R6 對接 Internet Router,後續 NAT outside 與 VPN peer 都使用此介面。
Internet 介面 Internet to R1 Serial0/0/0:193.16.1.253/30
Clock rate:64000
conf t

interface serial0/0/0
 ip address 193.16.1.253 255.255.255.252
 clock rate 64000
 no shutdown



show ip interface brief

Serial0/0/0  193.16.1.253  up  up
Internet Router 對接 R1。
Internet 介面 Internet to R6 Serial0/0/1:193.16.6.253/30
Clock rate:64000
conf t

interface serial0/0/1
 ip address 193.16.6.253 255.255.255.252
 clock rate 64000
 no shutdown



show ip interface brief

Serial0/0/1  193.16.6.253  up  up
Internet Router 對接 R6。
Internet 介面 Internet WWW Fa0/0:200.200.200.254/24
conf t

interface fastEthernet0/0
 ip address 200.200.200.254 255.255.255.0
 no shutdown



show ip interface brief

FastEthernet0/0  200.200.200.254  up  up
Internet WWW Server 的 gateway。
Internet 介面 Internet User Fa0/1:201.201.201.254/24
conf t

interface fastEthernet0/1
 ip address 201.201.201.254 255.255.255.0
 no shutdown



show ip interface brief

FastEthernet0/1  201.201.201.254  up  up
Internet User 的 gateway。
Static Route R1 到 R3 10.3.2.0/24 主路由 目的:10.3.2.0/24
Next-hop:192.168.123.6
conf t

ip route 10.3.2.0 255.255.255.0 192.168.123.6



show ip route 10.3.2.0

S 10.3.2.0/24 via 192.168.123.6
R1 到 R3 Fa0/1 網段的主要靜態路由。
Floating Static Route R1 到 R3 10.3.2.0/24 備援路由 目的:10.3.2.0/24
Next-hop:192.168.123.2
AD:2
conf t

ip route 10.3.2.0 255.255.255.0 192.168.123.2 2



show running-config

ip route 10.3.2.0 255.255.255.0 192.168.123.2 2
Floating Static Route 的 AD 為 2,正常狀況下不會優先於 AD 1 的主靜態路由。
Static Route R2 到 R3 10.3.2.0/24 目的:10.3.2.0/24
Next-hop:192.168.123.10
conf t

ip route 10.3.2.0 255.255.255.0 192.168.123.10



show ip route 10.3.2.0

S 10.3.2.0/24 via 192.168.123.10
R2 到 R3 Fa0/1 網段的靜態路由。
Static Route R2 到 VLAN14 目的:10.1.14.64/27
Next-hop:192.168.123.1
conf t

ip route 10.1.14.64 255.255.255.224 192.168.123.1



show ip route 10.1.14.64

S 10.1.14.64/27 via 192.168.123.1
R2 前往 VLAN14 的靜態路由。
Static Route R3 到 VLAN14 主路由 目的:10.1.14.64/27
Next-hop:192.168.123.5
conf t

ip route 10.1.14.64 255.255.255.224 192.168.123.5



show ip route 10.1.14.64

S 10.1.14.64/27 via 192.168.123.5
R3 到 VLAN14 的主靜態路由。
Floating Static Route R3 到 VLAN14 備援路由 目的:10.1.14.64/27
Next-hop:192.168.123.9
AD:2
conf t

ip route 10.1.14.64 255.255.255.224 192.168.123.9 2



show running-config

ip route 10.1.14.64 255.255.255.224 192.168.123.9 2
Floating Static Route 的 AD 為 2,作為備援路徑。
OSPF R1 OSPF Process ID:1
Router ID:192.168.99.1
Area:0
conf t

interface loopback0
 ip address 192.168.99.1 255.255.255.255
exit

router ospf 1
 router-id 192.168.99.1
 passive-interface default
 no passive-interface serial0/0/0
 no passive-interface serial0/0/1
 network 192.168.123.0 0.0.0.3 area 0
 network 192.168.123.4 0.0.0.3 area 0
 network 10.1.12.16 0.0.0.15 area 0
 network 10.1.13.24 0.0.0.7 area 0
 network 10.1.99.0 0.0.0.255 area 0
 network 192.168.99.1 0.0.0.0 area 0



show ip ospf neighbor
show ip route ospf

R1 與 R2 / R3 建立 OSPF 鄰居
R1 使用 network subnet method 宣告 OSPF,並將 VLAN12、VLAN13、VLAN99 納入 OSPF。
OSPF R2 OSPF Process ID:2
Router ID:192.168.99.2
Area 0 / Area 2
conf t

interface loopback0
 ip address 192.168.99.2 255.255.255.255
exit

router ospf 2
 router-id 192.168.99.2
 network 192.168.123.2 0.0.0.0 area 0
 network 192.168.123.9 0.0.0.0 area 0
 network 172.16.100.254 0.0.0.0 area 2
 network 192.168.99.2 0.0.0.0 area 2
 passive-interface fa0/0
 no passive-interface serial0/0/1



show ip ospf neighbor
show ip route ospf

R2 與 R1 / R3 建立 OSPF 鄰居
R2 Fa0/0 被 passive-interface 保護
R2 使用 interface IP 精準宣告方式,Server 區在 Area 2,Serial links 在 Area 0。
OSPF R3 OSPF Process ID:3
Router ID:192.168.99.3
Area 0 / Area 3
conf t

interface loopback0
 ip address 192.168.99.3 255.255.255.255
 ip ospf 3 area 3
exit

interface fa0/0
 ip ospf 3 area 0
exit

interface serial0/0/0
 ip ospf 3 area 0
exit

interface serial0/0/1
 ip ospf 3 area 0
exit

router ospf 3
 router-id 192.168.99.3
 passive-interface fa0/0



show ip ospf neighbor
show ip route ospf

R3 與 R1 / R2 建立 OSPF 鄰居
R3 Fa0/0 可被宣告但不送 Hello
R3 使用 interface mode 的 ip ospf process area 方式啟用 OSPF。
OSPF Cost Serial bandwidth 調整 R1-R2:128K
R2-R3:128K
R1-R3:64K
R1:
interface serial0/0/0
 bandwidth 128
interface serial0/0/1
 bandwidth 64

R2:
interface serial0/0/0
 bandwidth 128
interface serial0/0/1
 bandwidth 128

R3:
interface serial0/0/0
 bandwidth 64
interface serial0/0/1
 bandwidth 128
show ip route ospf
show interfaces serial0/0/0
show interfaces serial0/0/1

可看到依 bandwidth 產生不同 OSPF cost
用 bandwidth 調整 OSPF cost,產生預期的等值路由或指定路徑。
Default Route R1 對 Internet Default route:0.0.0.0/0
Next-hop:193.16.1.253
conf t

ip route 0.0.0.0 0.0.0.0 193.16.1.253



show ip route

S* 0.0.0.0/0 via 193.16.1.253
R1 是總公司對 Internet 出口。
OSPF Default R1 宣告 default route OSPF default-information originate
conf t

router ospf 1
 default-information originate



R2 / R3 show ip route

O*E2 0.0.0.0/0
R2 / R3 透過 OSPF 學到預設路由。
Default Route R6 對 Internet Default route:0.0.0.0/0
Next-hop:193.16.6.253
conf t

ip route 0.0.0.0 0.0.0.0 193.16.6.253



show ip route

S* 0.0.0.0/0 via 193.16.6.253
R6 是分公司對 Internet 出口。
NAT / PAT R1 VLAN12 PAT Inside:Fa0/0.2
Outside:Serial0/1/1
ACL:10
VLAN12:10.1.12.16/28
conf t

interface fa0/0.2
 ip nat inside
exit

interface serial0/1/1
 ip nat outside
exit

access-list 10 permit 10.1.12.16 0.0.0.15

ip nat inside source list 10 interface serial0/1/1 overload



VLAN12-RD1:
ping 200.200.200.200

R1:
show ip nat translations

可看到 PAT translation
VLAN12 使用 R1 Serial0/1/1 的公有 IP 做 overload PAT。
NAT / PAT R6-PC5 PAT Inside:Fa0/1
Outside:Serial0/0/0
ACL:10
R6-PC5 網段:10.5.0.0/24
conf t

interface fa0/1
 ip nat inside
exit

interface serial0/0/0
 ip nat outside
exit

access-list 10 permit 10.5.0.0 0.0.0.255

ip nat inside source list 10 interface serial0/0/0 overload



R6-PC5:
ping 200.200.200.200

R6:
show ip nat translations

可看到 PAT translation
R6-PC5 使用 R6 Serial0/0/0 的公有 IP 做 overload PAT。
Dynamic NAT R1 VLAN13 Dynamic NAT Inside:Fa0/0.3
Outside:Serial0/1/1
ACL:20
Pool:171.69.233.210 - 171.69.233.222
conf t

interface fa0/0.3
 ip nat inside
exit

interface serial0/1/1
 ip nat outside
exit

no access-list 20
no ip nat inside source list 20 pool netpool
no ip nat pool netpool 171.69.233.210 171.69.233.222 netmask 255.255.255.240

access-list 20 permit 10.1.13.24 0.0.0.7

ip nat pool natpool 171.69.233.210 171.69.233.222 netmask 255.255.255.240

ip nat inside source list 20 pool natpool



VLAN13-Sales2:
ping 200.200.200.200

R1:
show ip nat translations

可看到 10.1.13.26 轉成 171.69.233.210
VLAN13 使用 Dynamic NAT,公有 IP 池從 171.69.233.210 到 171.69.233.222。
NAT 回程路由 Internet Router 回指公有 IP 池 Public Pool:171.69.233.208/28
Next-hop:193.16.1.254
conf t

ip route 171.69.233.208 255.255.255.240 193.16.1.254



show ip route

S 171.69.233.208/28 via 193.16.1.254
Internet Router 必須知道 NAT 公有 IP 池要回到 R1。
Static NAT R2-DMZ Static NAT Inside local:172.16.100.102
Inside global:171.69.233.209
conf t

interface serial0/0/0
 ip nat inside
exit

interface serial0/1/1
 ip nat outside
exit

no ip nat inside source static 172.16.100.103 171.69.233.209

ip nat inside source static 172.16.100.102 171.69.233.209



R1:
show ip nat translations

--- 171.69.233.209  172.16.100.102  ---  ---

Internet User:
ping 171.69.233.209

Reply from 171.69.233.209
R2-DMZ 伺服器 172.16.100.102 固定對應到公有 IP 171.69.233.209。
IPSec VPN R1 Phase 1 PSK:SeCrEt
Encryption:3DES
Hash:SHA
DH Group:2
Lifetime:86400
conf t

crypto isakmp policy 10
 encr 3des
 hash sha
 authentication pre-share
 group 2
 lifetime 86400
exit

crypto isakmp key SeCrEt address 193.16.6.254



show crypto isakmp policy

encryption algorithm: Three key triple DES
hash algorithm: Secure Hash Standard
authentication method: Pre-Shared Key
Diffie-Hellman group: #2
lifetime: 86400 seconds
R1 的 IKE Phase 1 參數。
IPSec VPN R1 Phase 2 / Crypto Map Transform-set:ts16
ESP AES / MD5
Peer:193.16.6.254
Crypto ACL:110
conf t

crypto ipsec transform-set ts16 esp-aes esp-md5-hmac

no access-list 110
access-list 110 permit ip 10.3.1.0 0.0.0.255 10.6.0.0 0.0.0.255

crypto map map16 10 ipsec-isakmp
 set peer 193.16.6.254
 set transform-set ts16
 match address 110
exit

interface serial0/1/1
 crypto map map16



show crypto ipsec sa

local ident: 10.3.1.0/24
remote ident: 10.6.0.0/24
encaps / decaps 有數字
R1 crypto ACL 與 R6 必須鏡像對稱。
IPSec VPN R6 Phase 1 PSK:SeCrEt
Encryption:3DES
Hash:SHA
DH Group:2
Lifetime:86400
conf t

crypto isakmp policy 10
 encr 3des
 hash sha
 authentication pre-share
 group 2
 lifetime 86400
exit

crypto isakmp key SeCrEt address 193.16.1.254



show crypto isakmp policy

encryption algorithm: Three key triple DES
hash algorithm: Secure Hash Standard
authentication method: Pre-Shared Key
Diffie-Hellman group: #2
lifetime: 86400 seconds
R6 的 IKE Phase 1 參數。
IPSec VPN R6 Phase 2 / Crypto Map Transform-set:ts61
ESP AES / MD5
Peer:193.16.1.254
Crypto ACL:110
conf t

crypto ipsec transform-set ts61 esp-aes esp-md5-hmac

no access-list 110
access-list 110 permit ip 10.6.0.0 0.0.0.255 10.3.1.0 0.0.0.255

crypto map map61 10 ipsec-isakmp
 set peer 193.16.1.254
 set transform-set ts61
 match address 110
exit

interface serial0/0/0
 crypto map map61



show crypto ipsec sa

local ident: 10.6.0.0/24
remote ident: 10.3.1.0/24
encaps / decaps 有數字
R6 crypto ACL 與 R1 必須鏡像對稱。
IPSec VPN 驗證 R6-PC6 到 R3-PC1 Source:10.6.0.10
Destination:10.3.1.10
R6-PC6:
ping 10.3.1.10
Reply from 10.3.1.10
Sent = 4, Received = 4, Lost = 0
VPN 端到端通訊成功。
IPSec VPN 驗證 R6 ISAKMP SA Phase 1 狀態
show crypto isakmp sa
IPv4 Crypto ISAKMP SA
dst           src           state     conn-id  slot  status
193.16.1.254  193.16.6.254  QM_IDLE   1024     0     ACTIVE
QM_IDLE / ACTIVE 代表 Phase 1 成功。
IPSec VPN 驗證 R6 IPSec SA Phase 2 封包計數
show crypto ipsec sa
#pkts encaps: 7
#pkts encrypt: 7
#pkts decaps: 6
#pkts decrypt: 6

inbound esp sas:
 Status: ACTIVE

outbound esp sas:
 Status: ACTIVE
encaps / decaps 有增加,代表 Phase 2 成功加密與解密。
ACL R2 Exted ACL 100 套用介面:R2 Fa0/0
方向:out
控制 172.16.100.101 / 172.16.100.102
conf t

no access-list 100

access-list 100 permit tcp 10.1.12.16 0.0.0.15 172.16.100.101 0.0.0.0 eq 20
access-list 100 permit tcp 10.1.12.16 0.0.0.15 172.16.100.101 0.0.0.0 eq 21
access-list 100 deny ip 10.1.12.16 0.0.0.15 172.16.100.101 0.0.0.0
access-list 100 deny ip 10.0.0.0 0.255.255.255 172.16.100.101 0.0.0.0

access-list 100 permit tcp any 172.16.100.102 0.0.0.0 eq 80
access-list 100 permit icmp any 172.16.100.102 0.0.0.0
access-list 100 deny ip any 172.16.100.102 0.0.0.0

interface fa0/0
 ip access-group 100 out



show running-config interface fa0/0

interface FastEthernet0/0
 ip access-group 100 out
ACL 100 套在 R2 Fa0/0 outbound,控制往 Server 區的流量。
ACL 驗證 清除 ACL 計數器 ACL 100
clear access-list counters 100
沒有錯誤訊息即代表完成
測試前先清除計數器,方便確認 permit / deny 是否被命中。
ACL 驗證 VLAN12-RD1 FTP R2-Private Source:10.1.12.17
Destination:172.16.100.101
Service:FTP
ftp 172.16.100.101
Connected to 172.16.100.101
230 Logged in
符合 ACL 要求:VLAN12 可使用 FTP 存取 R2-Private。
ACL 驗證 VLAN12-RD1 ping R2-Private Source:10.1.12.17
Destination:172.16.100.101
Service:ICMP
ping 172.16.100.101
Destination host unreachable
Sent = 4, Received = 0, Lost = 4
符合 ACL 要求:VLAN12 除 FTP 以外不可存取 R2-Private。
ACL 驗證 R3-PC ping R2-Private Source:10.3.2.10
Destination:172.16.100.101
Service:ICMP
ping 172.16.100.101
Destination host unreachable
Sent = 4, Received = 0, Lost = 4
符合 ACL 要求:總公司其他 VLAN / R3 內網不可存取 R2-Private。
ACL 驗證 R3-PC ping R2-DMZ Source:10.3.2.10
Destination:172.16.100.102
Service:ICMP
ping 172.16.100.102
Reply from 172.16.100.102
Sent = 4, Received = 4, Lost = 0
符合 ACL 要求:Any-PC 可 ping R2-DMZ。
ACL 驗證 R3-PC http R2-DMZ Source:10.3.2.10
Destination:172.16.100.102
Service:HTTP
Web Browser:
http://172.16.100.102
Cisco Packet Tracer 網頁成功開啟
符合 ACL 要求:Any-PC 可使用 HTTP 存取 R2-DMZ。
ACL 驗證 R3-PC ftp R2-DMZ Source:10.3.2.10
Destination:172.16.100.102
Service:FTP
ftp 172.16.100.102
Error opening ftp://172.16.100.102/
Timed out
符合 ACL 要求:R2-DMZ 不允許 FTP 等其他服務。
ACL 驗證 R2 show access-lists 100 ACL match 結果
show access-lists 100
permit tcp 10.1.12.16 0.0.0.15 host 172.16.100.101 eq ftp (11 match(es))
deny ip 10.1.12.16 0.0.0.15 host 172.16.100.101 (4 match(es))
deny ip 10.0.0.0 0.255.255.255 host 172.16.100.101 (101 match(es))
permit tcp any host 172.16.100.102 eq www (5 match(es))
permit icmp any host 172.16.100.102 (4 match(es))
deny ip any host 172.16.100.102 (12 match(es))
permit / deny 規則皆有 match,ACL 驗證完成。
SSH ACL R3 只允許 VLAN14 IT SSH Username:user
Password:123
Domain:ckc.com
RSA:1024
ACL:12
conf t

username user password 123
ip domain-name ckc.com
crypto key generate rsa
1024
ip ssh version 2

access-list 12 permit 10.1.14.64 0.0.0.31

line vty 0 5
 login local
 transport input ssh
 access-class 12 in
exit

line vty 6 15
 transport input none
exit



VLAN14-IT ssh 到 R3:OK
其他 VLAN ssh 到 R3:Not OK
只允許 VLAN14 IT 網段使用 SSH 管理 R3,最多開放 vty 0 到 5 共 6 條 sessions。
最終驗證 NAT / PAT VLAN12、VLAN13、R6-PC5
VLAN12-RD1:
ping 200.200.200.200

VLAN13-Sales2:
ping 200.200.200.200

R6-PC5:
ping 200.200.200.200

R1 / R6:
show ip nat translations
VLAN12 PAT:OK
VLAN13 Dynamic NAT:OK
R6-PC5 PAT:OK
NAT translation 有產生
NAT / PAT 完成。
最終驗證 Static NAT 172.16.100.102 ↔ 171.69.233.209
Internet User:
ping 171.69.233.209
http://171.69.233.209

R1:
show ip nat translations
Internet User ping R2-DMZ 公有 IP:OK
Internet User http R2-DMZ 公有 IP:OK
Static NAT translation 存在
Static NAT 完成。
最終驗證 IPSec VPN R6-PC6 ↔ R3-PC1
R6-PC6:
ping 10.3.1.10

R6:
show crypto isakmp sa
show crypto ipsec sa
R6-PC6 ping 10.3.1.10:OK
QM_IDLE / ACTIVE
encaps / decaps 有增加
IPSec VPN 完成。
最終驗證 ACL 100 R2 Fa0/0 outbound
R2:
show access-lists 100
permit 規則有 match
deny 規則有 match
ACL 測試全部符合預期
Exted ACL 100 完成。