# 網路規劃期末考 上機實作! 配置如圖 ![image](https://hackmd.io/_uploads/SJ9C_2mNZl.png) # 題目: ## 路由器基本設定 1. 所有router及switch須按照圖上所述名稱命名 2. R0 需保留完整設定 3. 設定R0下列2個密碼(均需加密) 4. 設定console登入的密碼為qwe_123 5. 設定enable登入的密碼為zxc_987 6. 設定DHCP使得PC2可以獲取到IP ## 單臂路由 1. 設定router,使得所有PC可以相互連接 (使用ping及traceroute為驗測工具) ## VLAN 1. SW0設定Vlan 11,22,33 2. SW1設定Vlan 44,55,66 3. SW0及SW1之間透過trunk連接 4. SW1透過trunk連結R0 5. PC0接到Vlan 22 6. PC1接到Vlan 66 ## Windows安裝 1. 帳號設定為ntub2026 2. 密碼設定為imd2026 ## IP分配 | 區塊 | 需求 | 數量 | | -------- | -------- | -------- | | Vlan 11 | R0為第8個可用IP | 需要可用IP 21個 | | Vlan 22 | R0為第1個可用IP,PC0為第10個可用IP | 需要可用IP 24個 | |Vlan 33 | R0為倒數第50個可用IP | 需要可用IP 340個 |Vlan 44 | R0為倒數第1個可用IP | 需要可用IP 4個 |Vlan 55 | R0為倒數第20個可用IP|需要可用IP 90個 |Vlan 66 | R0為最大可用IP ,PC1為最小可用IP|需要可用IP 184個 |PC2 |DHCP配發10.12.0.0/24 # 解 ## IP分配摘要 | VLAN | R0IP | 子網遮罩 |可用範圍| | -------- | -------- | --------|--------| |11|172.54.15.136 | /27| 172.54.15.129-158| |22|172.54.15.161 |/27|172.54.15.161-190| |33|172.54.13.205|/23|172.54.12.1-13.254| |44|172.54.15.198|/29|172.54.15.193-198| |55|172.54.15.107|/25|172.54.15.1-126| |66|172.54.14.254|/24|172.54.14.1-254| |PC2|10.12.0.1|/24|10.12.0.2-254 ## PC設定 PC0 (Vlan 22): > IP Address: 172.54.15.169 > Subnet Mask: 255.255.255.224 > Default Gateway: 172.54.15.161 PC1 (Vlan 66): > IP Address: 172.54.14.1 > Subnet Mask: 255.255.255.0 > Default Gateway: 172.54.14.254 PC2: > 設定為DHCP自動取得IP (會從10.12.0.0/24網段取得) ## 路由器基本設定 ```js= Router> enable Router# configure terminal Router(config)# hostname R0 ! 設定console密碼並加密 R0(config)# line console 0 R0(config-line)# password qwe_123 R0(config-line)# login R0(config-line)# exit ! 設定enable密碼並加密 R0(config)# enable secret zxc_987 ! 啟用密碼加密 R0(config)# service password-encryption ! 設定DHCP給PC2 (10.12.0.0/24網段) R0(config)# ip dhcp pool PC2_POOL R0(dhcp-config)# network 10.12.0.0 255.255.255.0 R0(dhcp-config)# default-router 10.12.0.1 R0(dhcp-config)# dns-server 8.8.8.8 R0(dhcp-config)# exit ! 排除router自己的IP R0(config)# ip dhcp excluded-address 10.12.0.1 ! 儲存設定 R0(config)# exit R0# copy running-config startup-config ``` 此時exit到最外面再進來就會發現需要輸入密碼了! ## 單臂路由 ```js=! 連接SW0的主介面 (Gig0/0) R0(config)# interface GigabitEthernet0/0 R0(config-if)# no shutdown R0(config-if)# exit ! Vlan 11 R0(config)# interface GigabitEthernet0/0.11 R0(config-subif)# encapsulation dot1Q 11 R0(config-subif)# ip address 172.54.15.136 255.255.255.224 R0(config-subif)# exit ! Vlan 22 R0(config)# interface GigabitEthernet0/0.22 R0(config-subif)# encapsulation dot1Q 22 R0(config-subif)# ip address 172.54.15.161 255.255.255.224 R0(config-subif)# exit ! Vlan 33 R0(config)# interface GigabitEthernet0/0.33 R0(config-subif)# encapsulation dot1Q 33 R0(config-subif)# ip address 172.54.13.205 255.255.254.0 R0(config-subif)# exit ! Vlan 44 R0(config)# interface GigabitEthernet0/0.44 R0(config-subif)# encapsulation dot1Q 44 R0(config-subif)# ip address 172.54.15.198 255.255.255.248 R0(config-subif)# exit ! Vlan 55 R0(config)# interface GigabitEthernet0/0.55 R0(config-subif)# encapsulation dot1Q 55 R0(config-subif)# ip address 172.54.15.107 255.255.255.128 R0(config-subif)# exit ! Vlan 66 R0(config)# interface GigabitEthernet0/0.66 R0(config-subif)# encapsulation dot1Q 66 R0(config-subif)# ip address 172.54.14.254 255.255.255.0 R0(config-subif)# exit ! 連接SW2的介面 (Gig0/1) - PC2的DHCP網段 R0(config)# interface GigabitEthernet0/1 R0(config-if)# ip address 10.12.0.1 255.255.255.0 R0(config-if)# no shutdown R0(config-if)# exit ! 儲存設定 R0(config)# exit R0# copy running-config startup-config ``` ## VLAN設定 ### S0 ```js= Switch> enable Switch# configure terminal Switch(config)# hostname SW0 ! 建立VLANs SW0(config)# vlan 11 SW0(config)# vlan 22 SW0(config)# vlan 33 SW0(config)# vlan 44 SW0(config)# vlan 55 SW0(config)# vlan 66 ! 設定PC0連接埠為Vlan 22 (假設連接到FastEthernet0/1) SW0(config)# interface FastEthernet0/1 SW0(config-if)# switchport mode access SW0(config-if)# switchport access vlan 22 SW0(config-if)# exit ! Trunk連接到R0 (假設使用GigabitEthernet0/1) SW0(config)# interface GigabitEthernet0/1 SW0(config-if)# switchport mode trunk SW0(config-if)# switchport trunk allowed vlan 11,22,33,44,55,66 SW0(config-if)# exit ! Trunk連接到SW1 (假設使用GigabitEthernet0/2) SW0(config)# interface GigabitEthernet0/2 SW0(config-if)# switchport mode trunk SW0(config-if)# switchport trunk allowed vlan 11,22,33,44,55,66 SW0(config-if)# exit ! 儲存設定 SW0# copy running-config startup-config ``` 有兩條trunk show int trunk ### SW1 ```js= Switch> enable Switch# configure terminal Switch(config)# hostname SW1 ! 建立VLANs SW1(config)# vlan 44 SW1(config)# vlan 55 SW1(config)# vlan 66 SW1(config)# vlan 11 SW1(config)# vlan 22 SW1(config)# vlan 33 ! 設定PC1連接埠為Vlan 66 (假設連接到FastEthernet0/1) SW1(config)# interface FastEthernet0/1 SW1(config-if)# switchport mode access SW1(config-if)# switchport access vlan 66 SW1(config-if)# exit ! Trunk連接到SW0 (假設使用GigabitEthernet0/1) SW1(config)# interface GigabitEthernet0/1 SW1(config-if)# switchport mode trunk SW1(config-if)# switchport trunk allowed vlan 11,22,33,44,55,66 SW1(config-if)# exit ! 儲存設定 SW1# copy running-config startup-config ``` ## SW2 ```js= Switch> enable Switch# configure terminal Switch(config)# hostname SW2 ! SW2不需要VLAN設定 SW2(config)# interface FastEthernet0/1 SW2(config-if)# switchport mode access SW2(config-if)# exit ! 設定連接到R0的埠 SW2(config)# interface GigabitEthernet0/1 SW2(config-if)# switchport mode access SW2(config-if)# exit ! 儲存設定 SW2# copy running-config startup-config ``` # 破密碼 router重開 ```js= remmon 1> Confreg 0x2142 remmon 2> reset ```