# 電腦網路實驗 :::success NTPU_CSIE 2-2 1132_電腦網路實驗_Computer Networks Lab.(U2355) Lab1 ~ Lab3 ::: ## Lab1 : Switch ### 1. Setup privileged mode password. 10% ```= enable config terminal enable secret ntpu ``` ### 2. Setup a new VLAN and add an interface to the new VLAN 20% ```= vlan 2 exit interface fastEthernet 0/2 switchport access vlan 2 exit ``` ### 3. Setup VLAN with IP address 20% ```= int vlan 1 ip address 192.168.4.1 255.255.255.0 no shutdown exit ``` ### 4. Setup port security on switch at the new Vlan 50% ```= interface fastEthernet 0/2 switchport mode access switchport port-security switchport port-security mac-address sticky end ``` :::danger ### 檢查 ```= show running-config show vlan show port—security interface fastEthernet 0/2 ``` ::: --- --- ## Lab2 : Router ### 1. Setup IP addresses on all routers. 30% **A-B: 192.168.1.0** * Router0 ```= enable conf terminal interface fa0/0 ip address 192.168.1.1 255.255.255.0 no shutdown ``` * Router1 ```= enable conf terminal interface fa0/0 ip address 192.168.1.2 255.255.255.0 no shutdown ``` **B-C: 192.168.2.0** * Router1 ```= enable conf terminal interface fa0/1 ip address 192.168.2.1 255.255.255.0 no shutdown ``` * Router2 ```= enable conf terminal interface fa0/0 ip address 192.168.2.2 255.255.255.0 no shutdown ``` **C-D: 192.168.3.0** * Router2 ```= enable conf terminal interface fa0/1 ip address 192.168.3.1 255.255.255.0 no shutdown ``` * Router3 ```= enable conf terminal interface fa0/0 ip address 192.168.3.2 255.255.255.0 no shutdown ``` :::warning #### 測試 * 綠燈 * `show ip ro` 顯示連接幾個 router` C ...` ::: --- ### 2. Setup RIP at B,C. 30% * Router1 原本在 config-if -> 到 config 層,輸入`exit` ```= router rip network 192.168.1.0 network 192.168.2.0 ``` * Router2 原本在 config-if -> 到 config 層,輸入`exit` ```= router rip network 192.168.2.0 network 192.168.3.0 ``` :::warning #### 測試 ```= end sh ip ro ``` * 顯示 `R` ::: --- ### 3. Setup a static route at A to 192.168.3.0, and ping it at A. 20% * Router0 原本在 config-if -> 到 config 層,輸入`exit` ```= ip route 192.168.3.0 255.255.255.0 192.168.1.2 end ``` :::info `192.168.1.2` 是隔壁的 ip ::: :::warning #### 測試 ```= ping 192.168.3.0 ``` 第一次顯示`.!!!!` (第一次失敗) 之後顯示 `!!!!!`(全部都成功) * 顯示 success ::: --- ### 4. Setup a default route at router D, ping 192.168.1.0 at D. 20% * Router3 原本在 config-if -> 到 config 層,輸入`exit` ```= ip route 0.0.0.0 0.0.0.0 192.168.3.1 end ``` :::warning #### 測試 ```= ping 192.168.1.0 ``` * 顯示 success 可連接到最遠的 router ::: --- :::danger ### 檢查: 主要 Router0, Router3 ```= show ip route ``` 顯示 `S*` 可以透過鄰居連到最遠的 router Router1, Router2 顯示 ``` R ... C ... C ... ``` and ``` C ... C ... R ... ``` ::: --- --- ## Lab3 : Setup VLSM, RIP setup topology S1 - S3 - S5 |---------|-------| R1 - R2 - R3 - S7-R100(WAN) |---------|-------| S2 - S4 - S6 ### 1. VLSM: 80% ### Given a subnet 192.168.1.0/24, R100 IP is 172.168.1.254, R3's IP is 172.168.1.1, WAN: 172.168.1.0/24 * CopyRouter0(1) ``` en conf t int fa6/0 ip addr 172.168.1.1 255.255.255.0 no sh ``` * Router1 ``` en conf t int fa0/0 ip addr 172.168.1.254 255.255.255.0 no sh ``` ### Setup VLSM for LANs of S1~S6 for the following numbers of users: S1: 60, S2: 30, S3: 6, S4: 12, S5: 12, S6: 12 show these subnet routes * Router0 ``` en conf t int fa0/0 ip addr 192.168.1.1 255.255.255.192 no sh do sh ip ro ``` :::warning 192.168.1.0/26 is subnetted, 1 subnets C... ... ::: * Router0 繼續 ``` int fa1/0 ip addr 192.168.1.65 255.255.255.224 no sh do sh ip ro ``` :::warning 192.168.1.0/24 is varibaly subnetted, 2 subnets, 2 masks C 192.168.1.0/26 is directly connected, FastEthernet0/0 C... ::: * Router0 繼續 ``` int fa4/0 ip addr 192.168.1.105 255.255.255.252 no sh do sh ip ro ``` * CopyRouter0 ``` en conf t int fa4/0 ip addr 192.168.1.106 255.255.255.252 no sh ``` ``` int fa0/0 ip addr 192.168.1.97 255.255.255.248 no sh ``` ``` int fa1/0 ip addr 192.168.1.113 255.255.255.240 no sh ``` ``` int fa5/0 ip addr 192.168.1.109 255.255.255.252 no sh ``` * CopyRouter0(1) ``` int fa4/0 ip addr 192.168.1.110 255.255.255.252 no sh ``` ``` int fa0/0 ip addr 192.168.1.129 255.255.255.240 no sh ``` ``` int fa1/0 ip addr 192.168.1.145 255.255.255.240 no sh ``` ### 2. RIP 20% ### setup RIP-2 ### show RIP routes ### R100 ping R1's subnet * Router0 (config-if -> config) ``` exit do sh ip ro ``` :::success 這裡顯示 connect 的 ip,rip 這些 ip ::: ``` router rip version 2 network 192.168.1.0 network 192.168.1.64 network 192.168.1.104 ``` * CopyRouter0 (config-if -> config) ``` exit do sh ip ro ``` :::success 這裡顯示 connect 的 ip,rip 這些 ip ::: ``` router rip version 2 network 192.168.1.96 network 192.168.1.104 network 192.168.1.108 network 192.168.1.112 ``` * CopyRouter0(1) (config-if -> config) ``` exit do sh ip ro ``` :::success 這裡顯示 connect 的 ip,rip 這些 ip ::: ``` router rip version 2 network 192.168.1.108 network 192.168.1.128 network 192.168.1.144 network 172.168.1.0 ``` * Router1 (config-if -> config) ``` exit router rip version 2 network 172.168.1.0 ``` :::warning ### 檢查 * Router0 ``` end sh ip ro ``` 顯示 ``` R... ... C... C... R... C... R... R... R... R... ``` * CopyRouter0 ``` end sh ip ro ``` 顯示 ``` R... ... R... R... C... C... C... C... R... R... ``` * CopyRouter0(1) ``` end sh ip ro ``` 顯示 ``` C... ... R... R... R... R... C... R... C... C... ``` * Router1 ``` end sh ip ro ``` 顯示 ``` C... R... ``` ::: ## review question ### rq1 :::spoiler 1. How do you enter privileged mode? ```= enable ``` ::: Once you enter privileged mode, :::spoiler 2. How do you enter configuration mode? ```= config terminal ``` ::: Once you enter configuration mode, :::spoiler 3. How do you setup privileged mode password? a. do not encrypt the password, ```= enable password <password> ``` ::: :::spoiler 3. How do you setup privileged mode password? b encrypt the password ```= enable secret <password> ``` ::: :::spoiler 4. How do you setup console password? ```= line console 0 password <pwd> login ``` ::: :::spoiler 5. How do you setup switch name? ```= hostname <name> ``` ::: :::spoiler 6. How do you enable an interface and setup its IP address? ```= no shutdown ip address <ip> <mask> ``` ::: :::spoiler 7. How do you leave a sub-configuration mode? ```= exit ``` ::: :::spoiler 8. How do you leave configuration mode directly to privileged mode? ```= end ``` ::: When you return privileged mode, :::spoiler 9. How do you save the current configuration? ```= write memory copy running-config startup-config ``` ::: :::spoiler 10. How do you display the current configuration and starting-up configuration? ```= show running-config show startup-config ``` ::: ### rq2 :::spoiler 1. How do you setup SSH and its password? ```= ip domain-name <domain name> username <user> password <password> crypto key generate rsa line vty 0 15 login local transport input ssh ``` ::: :::spoiler 2. How do you configure several interfaces at a time? ```= interface range fastEthernet 0/ 1 - 15 ``` ::: :::spoiler 3. How do you setup port security? a. static mac address, ```= switchport mode access switchport port-security ``` ```= switchport port-security mac-address 0000.0001.1234 ``` ::: :::spoiler 3. How do you setup port security? b. dynamically learn mac address of first neighbor ```= switchport mode access switchport port-security ``` ```= switchport port-security mac-address sticky ``` ::: :::spoiler 4. How do you setup port security violation policy? ```= switchport port-security violation <protect | restrict | shutdown> ``` ::: :::spoiler 5. How do you setup a vlan? ```= vlan 2 ``` ::: :::spoiler 6. How do you setup the speed and duplex mode of an interface? ```= speed 100 duplex full ``` ::: :::spoiler 7. How do you setup dhcp and default gateway? ```= ip address dhcp ip default-gateway <ip-address> ``` ::: :::spoiler 8. How do you show interface information? ```= show interfaces ``` ::: :::spoiler 9. How do you show vlan information? ```= show vlan ``` ::: :::spoiler 10. How do you show port security information for an interface? ```= show port-security interface fastEthernet 0/2 ``` ::: ### rq3 :::spoiler 1. How do you setup a static route? ```= ip route <destination> <mask> <next> ``` ::: :::spoiler 2. How do you setup the default route? ```= ip route 0.0.0.0 0.0.0.0 <next hop ip address> ``` ::: :::spoiler 3. What is the routing algorithm of RIP? ```= Distance Vector ``` ::: :::spoiler 4. What are the four types of IGP routing protocols that Cisco routers support? (not including version number) ```= RIP IGRP EIGRP OSPF ``` ::: :::spoiler 5. How do you setup RIP? (2 commands) ```= router rip network <subnet> ``` ::: :::spoiler 6. What is administrative distance? ```= Define the priority of routing sources. The smaller the number, the higher the priority. ``` Administrative Distance(AD)用來評估「哪一個路由來源比較可靠」。 當路由器同時從多個協定學習到相同目的地的路由時,會選擇 AD 較小的那條。 ::: :::spoiler 7. How do you show the routes? ```= show ip route ``` ::: :::spoiler 8. How do you test the route? ```= ping <subnet> ``` :::