Download presentation
Presentation is loading. Please wait.
1
1 實驗二 基本網路命令的使用 ping 、 traceroute 、 ipconfig 、 arp 與 netstat 的使用
2
2 大綱 學習目標 實驗設備與材料 背景知識 實驗步驟 實驗報告 成績計算
3
3 學習目標 認識網路上常用的工具程式。 學習 ipconfig 、 ping 、 traceroute 、 natstat 、 arp 等網路工具程式。 Windows 提供線上查詢服務,例如想得 到更多關於 ping 的使用方式,可以鍵入 下面命令,便可獲得更多的操作方式。
4
4 實驗設備與材料 Cisco2620 1 台 +Cisco 1700 2 台 1 台 telnet server 四人一組為原則,以小組為單位進行實 驗與繳交實驗報告。 2-4 人 PC 1 台
5
5 Topology of Lab Network R3 R5R4 s0/3s0/1 e0/0 s0/2s0/0 e0/0 Telnet server
6
6 3 個區域網路 192.168.1.x/24 三台電腦的 IP address 請設為 192.168.1.1,192.168.1.2,192.168.1.3 192.168.2.x/24 192.168.2.1,192.168.2.2,192.168.2.3 192.168.7.x/24 192.168.7.1,192.168.7.2,192.168.7.3
7
7 指令 ping 用於詢問對方的主機是否存在 ipconfig 用於詢問本機所有的網路介面的 設定資訊 tracert 用於詢問到對方主機的路徑 arp 用於查表獲得同一網路上對方的主機 的 MAC address netstat 用於詢問本機所有的網路介面的 使用狀態
8
8 指令使用方式的 On-line Help ping.txt 與 ipconfig.txt (在 command mode 下以 ipconfig /? 命令尋求 online help ) 可用下面 I/O 轉向的方式記錄下 ping 等軟 體的使用過程 ping 192.168.1.4 > aaa type aaa
9
9 ping 的範例 C:\>ping 140.138.137.224 Pinging 140.138.137.224 with 32 bytes of data: Reply from 140.138.137.224: bytes=32 time=160ms TTL=245 Reply from 140.138.137.224: bytes=32 time=60ms TTL=245 Reply from 140.138.137.224: bytes=32 time=240ms TTL=245 Reply from 140.138.137.224: bytes=32 time=80ms TTL=245 Ping statistics for 140.138.137.224: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 60ms, Maximum = 240ms, Average = 135ms
10
10 ping 的用法 (1/2) Usage: ping [-t] [-a] [-n count] [-l size] [-f] [-i TTL] [-v TOS] [-r count] [-s count] [[-j host-list] | [-k host-list]] [-w timeout] destination-list Options: -t Ping the specified host until stopped. To see statistics and continue - type Control-Break; To stop - type Control-C. -a Resolve addresses to hostnames. -n count Number of echo requests to send. -l size Send buffer size. -f Set Don't Fragment flag in packet.
11
11 ping 的用法 (2/2) Usage: ping [-t] [-a] [-n count] [-l size] [-f] [-i TTL] [-v TOS] [-r count] [-s count] [[-j host-list] | [-k host-list]] [-w timeout] destination-list Options: -i TTL Time To Live. -v TOS Type Of Service. -r count Record route for count hops. -s count Timestamp for count hops. -j host-list Loose source route along host-list. -k host-list Strict source route along host-list. -w timeout Timeout in milliseconds to wait for each reply.
12
12 ipconfig 的範例 (1/2) C:\>ipconfig Windows 2000 IP Configuration Ethernet adapter Wireless LAN: Connection-specific DNS Suffix. : IP Address............ : 192.168.1.4 Subnet Mask........... : 255.255.255.0 Default Gateway......... : 192.168.1.1 Ethernet adapter 區域連線 : Media State........... : Cable Disconnected
13
13 ipconfig 的範例 (2/2) 在 DHCP 的環境下,先使用 ipconfig /release 後, 觀察 ipconfig /all. 再用 /renew 獲得新的 IP ,以 /all 觀察.
14
14 ipconfig 的用法 (1/4) Windows 2000 IP Configuration USAGE: ipconfig [/? | /all | /release [adapter] | /renew [adapter] | /flushdns | /registerdns | /showclassid adapter | /setclassid adapter [classidtoset] ] adapter Full name or pattern with '*' and '?' to 'match', * matches any character, ? matches one character.
15
15 ipconfig 的用法 (2/4) Options /? Display this help message. /all Display full configuration information. /release Release the IP address for the specified adapter. /renew Renew the IP address for the specified adapter. /flushdns Purges the DNS Resolver cache. /registerdns Refreshes all DHCP leases and re-registers DNS names /displaydns Display the contents of the DNS Resolver Cache. /showclassid Displays all the dhcp class IDs allowed for adapter. /setclassid Modifies the dhcp class id.
16
16 ipconfig 的用法 (3/4) The default is to display only the IP address, subnet mask and default gateway for each adapter bound to TCP/IP. For Release and Renew, if no adapter name is specified, then the IP address leases for all adapters bound to TCP/IP will be released or renewed. For SetClassID, if no class id is specified, then the classid is removed.
17
17 ipconfig 的用法 (4/4) Examples: > ipconfig... Show information. > ipconfig /all... Show detailed information > ipconfig /renew... renew all adapaters > ipconfig /renew EL*... renew adapters named EL.... > ipconfig /release *ELINK?21*... release all matching adapters, eg. ELINK-21, myELELINKi21adapter.
18
18 tracert 的範例 C:\>tracert 140.138.137.224 Tracing route to 140.138.137.224 over a maximum of 30 hops 1 <10 ms 10 ms <10 ms 192.168.1.1 2 <10 ms 10 ms <10 ms h222-210-66-38.seed.net.tw [210.66.38.222] 3 70 ms 70 ms 70 ms 172.28.12.89 4 70 ms 70 ms 70 ms R37-125.seed.net.tw [139.175.37.125] 5 70 ms 70 ms 70 ms R58-97.seed.net.tw [139.175.58.97] 6 71 ms 80 ms 70 ms R58-150.seed.net.tw [139.175.58.150] 7 70 ms 70 ms 71 ms R56-126.seed.net.tw [139.175.56.126] 8 70 ms 70 ms 80 ms 203.71.2.237 9 70 ms 80 ms 81 ms 140.138.7.2 10 70 ms 81 ms 80 ms 140.138.7.10 11 70 ms 70 ms 80 ms 140.138.191.18 12 190 ms 280 ms 171 ms 140.138.137.224 Trace complete.
19
19 tracert 的用法 Usage: tracert [-d] [-h maximum_hops] [-j host-list] [-w timeout] target_name Options: -d Do not resolve addresses to hostnames. -h maximum_hops Maximum number of hops to search for target. -j host-list Loose source route along host-list. -w timeout Wait timeout milliseconds for each reply.
20
20 arp 的範例 Address Resolution Protocol Interface: 192.168.2.112 on Interface 0x1000003 Internet Address Physical Address Type 192.168.2.1 00-d0-b7-23-eb-2f dynamic 192.168.2.254 00-90-fb-a1-45-79 dynamic 使用 arp –d 先刪除所有 table 中的資訊, 在用 ping 找任何一台機器, 之後再觀察 arp –a 。
21
21 arp 的用法 (1/2) Usage: ARP -s inet_addr eth_addr [if_addr] ARP -d inet_addr [if_addr] ARP -a [inet_addr] [-N if_addr] Options: -a Displays current ARP entries by interrogating the current protocol data. If inet_addr is specified , the IP and Physical addresses for only the specified computer are displayed. If more than one network interface uses ARP , entries for each ARP table are displayed. -g Same as -a. inet_addr Specifies an internet address. -N if_addr Displays the ARP entries for the network interface specified by if_addr.
22
22 arp 的用法 (2/2) -D Deletes the host specified by inet_addr. -S Adds the host and associates the Internet address inet_addr with the Physical address eth_addr. The Physical address is given as 6 hexadecimal bytes separated by hyphens. The entry is permanent. Eth_addr Specifies a physical address. If_addr If present , this specifies the Internet address of the interface whose address translation table should be modified. If not present , the first applicable interface will be used.
23
23 netstat 的範例 (1/2) C:\>netstat -e Interface Statistics Received Sent Bytes 1670417 2298060 Unicast packets 6553 6724 Non-unicast packets 116 68 Discards 0 0 Errors 0 0 Unknown protocols 0
24
24 netstat 的範例 (2/2) 使用 netstat –a –n | more 看 active connections 資料, | more 代表一次看一 頁, -n 代表用數字表示。 1. 看 netstat –e 各個 options 2. 嘗試建立新連線. 可以使用 telnet 127.0.0.1 135 (note: 135 是網路芳臨 ) 。 3. 看 netstat 會發現多兩筆資料, one output , one input 。
25
25 netstat 的用法 (1/2) Usage: NETSTAT [-a] [-e] [-n] [-s] [-p proto] [-r] [interval] Options: -a Displays all connections and listening ports.(Server-side connections are normally not shown). -e Displays Ethernet statistics. This may be combined with the -s option. -n Displays addresses and port numbers in numerical form. -p proto Shows connections for the protocol specified by proto; proto may be tcp or udp. If used with the -s option to display per-protocol statistics , proto may be tcp , udp , or ip. -r Displays the contents of the routing table.
26
26 netstat 的用法 (2/2) -s Displays per-protocol statistics. By default , statistics are shown for TCP , UDP and IP; the -p option may be used to specify a subset of the default. Interval Redisplays selected statistics , pausing interval seconds between each display. Press CTRL+C to stop redisplaying statistics. If omitted , netstat will print the current configuration information once.
27
27 個人實驗步驟 (1/2) 1. 設定 your PC ,並繪製出實驗室架構。 Ex: IP address 、 Network Mask 、 Default Gateway… 2. 使用 arp 指令,找出其他在同一個 LAN 上的 PC 的 MAC address 。
28
28 個人實驗步驟 (2/2) 3. 使用 netstat 指令,觀察網路使用狀況。 netstat –s –p ICMP ping 140.138.173.34 netstat –s –p ICMP netstat –s –p TCP 使用 putty 連到 140.138.173.34 輸入多次 netstat –s –p TCP 結束 putty 連線 netstat –s –p TCP netstat –s –p UCP telnet pcs.eed.yzu.edu.tw netstat –s –p UCP 4. 使用 tracert ,繪製出實驗室架構。
29
29 分組實驗步驟 1. 請利用 ping 、 traceroute 繪製出學校的 網路架構。並列舉說明繪製網路架構的 指令使用方式。 3. 設計實驗以說明 ping 、 traceroute 、 ipconfig 、 arp 與 netstat 所有 option 的 用法及每個欄位的意義。 Ex: 利用 netstat –s 觀察 IP 、 ICMP 、 TCP 、 UDP 的使用統計數據並說明之。例如 ping 前後的 ICMP 的使用狀況。
30
30 成績計算 個人實驗部分當場交,做為一次實驗成 績。 每組繪製學校網路架構,做為一次實驗 成績。 依完整程度給分 同組同學將有相同的分數。
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.