פקודות רשת נפוצות
תיבת הפקודה הוכיחה עצמה ככלי הטוב ביותר להרצת פקודות בסיסיות לטיפול בקבצים ותיקיות אך גם לשליפת מידע. למרות הכל, יש כמה פקודות רשת מתקדמות שאיתם אפשר להשיג יותר.
תוכן העניינים
בדיקת חיבור האינטרנט
על מנת לבדוק אם תשתית האינטרנט שלך עובדת באופן תקין, תוכל לבצע זאת באמצעות הפקודה Ping אשר תציג כתובת IP, זמן תגובה ב-milliseconds, ו-TTL=Time To Leave:
כך נראית פקודה כזו שמציגה כתובת IP בבדיקת שם מתחם:
C:\Users\user>ping www.google.com Pinging www.google.com [216.58.207.68] with 32 bytes of data: Reply from 216.58.207.68: bytes=32 time=53ms TTL=115 Reply from 216.58.207.68: bytes=32 time=53ms TTL=115 Reply from 216.58.207.68: bytes=32 time=53ms TTL=115 Reply from 216.58.207.68: bytes=32 time=53ms TTL=115 Ping statistics for 216.58.207.68: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 53ms, Maximum = 53ms, Average = 53ms
כדי להריץ פקודת CMD ישירות מה-Run (ללא שהחלון ייעלם בסיום הפעולה) יש להקליד בשורת ה-Run:
cmd /k ping www.google.com
במידה ורוצים להציג Ping באופן רציף יש להוסיף -t בסיום השורה כך שהתוצאה תיראה כך:
C:\Users\user>ping www.google.com -t
כדי להשהות את הפינג ולקבל נתונים סטטיסטיים באמצע פינג, לוחצים על Ctrl + Pause – מופיע בקונסולה כ-Control-Break
כדי להפסיק את הפעולה באמצע לוחצים על Ctrl + C (מופיע כ-Control-C)
זה נראה כך:
C:\Users\user>ping google.com -t Pinging google.com [216.58.207.46] with 32 bytes of data: Reply from 216.58.207.46: bytes=32 time=57ms TTL=115 Reply from 216.58.207.46: bytes=32 time=57ms TTL=115 Reply from 216.58.207.46: bytes=32 time=57ms TTL=115 Reply from 216.58.207.46: bytes=32 time=57ms TTL=115 Ping statistics for 216.58.207.46: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 57ms, Maximum = 57ms, Average = 57ms Control-Break Reply from 216.58.207.46: bytes=32 time=57ms TTL=115 Reply from 216.58.207.46: bytes=32 time=57ms TTL=115 Reply from 216.58.207.46: bytes=32 time=57ms TTL=115 Reply from 216.58.207.46: bytes=32 time=57ms TTL=115 Ping statistics for 216.58.207.46: Packets: Sent = 8, Received = 8, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 57ms, Maximum = 57ms, Average = 57ms Control-C ^C
את ipconfig כולנו מכירים, אך מה לגבי הפקודה שמציגה לנו פירוט של כל מתאמי הרשת ipconfig /all
C:\Users\user>ipconfig /all Windows IP Configuration Host Name . . . . . . . . . . . . : Pc Primary Dns Suffix . . . . . . . : kd.local Node Type . . . . . . . . . . . . : Hybrid IP Routing Enabled. . . . . . . . : No WINS Proxy Enabled. . . . . . . . : No DNS Suffix Search List. . . . . . : kd.local Wireless LAN adapter Wi-Fi: Media State . . . . . . . . . . . : Media disconnected Connection-specific DNS Suffix . : Description . . . . . . . . . . . : Realtek RTL8821CE 802.11ac PCIe Adapter Physical Address. . . . . . . . . : 00-00-00-00-00-00 DHCP Enabled. . . . . . . . . . . : Yes Autoconfiguration Enabled . . . . : Yes Wireless LAN adapter Local Area Connection* 1: Media State . . . . . . . . . . . : Media disconnected Connection-specific DNS Suffix . : Description . . . . . . . . . . . : Microsoft Wi-Fi Direct Virtual Adapter Physical Address. . . . . . . . . : 00-00-00-00-00-00 DHCP Enabled. . . . . . . . . . . : Yes Autoconfiguration Enabled . . . . : Yes Wireless LAN adapter Local Area Connection* 10: Media State . . . . . . . . . . . : Media disconnected Connection-specific DNS Suffix . : Description . . . . . . . . . . . : Microsoft Wi-Fi Direct Virtual Adapter #2 Physical Address. . . . . . . . . : 00-00-00-00-00-00 DHCP Enabled. . . . . . . . . . . : No Autoconfiguration Enabled . . . . : Yes Ethernet adapter Ethernet: Connection-specific DNS Suffix . : Description . . . . . . . . . . . : Realtek PCIe GbE Family Controller Physical Address. . . . . . . . . : 00-00-00-00-00-00 DHCP Enabled. . . . . . . . . . . : No Autoconfiguration Enabled . . . . : Yes Link-local IPv6 Address . . . . . : 0000::000:000:0000:0000%00(Preferred) IPv4 Address. . . . . . . . . . . : 10.0.0.10(Preferred) Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : 10.0.0.11 DHCPv6 IAID . . . . . . . . . . . : 104000700 DHCPv6 Client DUID. . . . . . . . : 00-00-00-00-00-00-00-00-00-00-00-00-00-00 DNS Servers . . . . . . . . . . . : 10.0.0.12 8.8.8.8 NetBIOS over Tcpip. . . . . . . . : Enabled
בדוגמה דלעיל, על מנת לבדוק למשל אם יש תקשורת אל מול ה-Gateway (שיכול להיות שרת, פיירוול) יש לבצע פינג אל הכתובת 10.0.0.11:
C:\Users\user>ping 10.0.0.11 Pinging 10.0.0.11 with 32 bytes of data: Reply from 10.0.0.11: bytes=32 time<1ms TTL=64 Reply from 10.0.0.11: bytes=32 time<1ms TTL=64 Reply from 10.0.0.11: bytes=32 time=1ms TTL=64 Reply from 10.0.0.11: bytes=32 time<1ms TTL=64 Ping statistics for 10.0.0.11: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 0ms, Maximum = 1ms, Average = 0ms
מעבר תקשורת דרך מכשירים ברשת
על מנת לצפות במעבר תקשורת מהמחשב/שרת דרך ראוטר פיירוול או כל מכשיר אחר,יש את פקודת tracert
האפשרויות בפקודה הן:
-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 (IPv4-only). -w timeout Wait timeout milliseconds for each reply. -R Trace round-trip path (IPv6-only). -S srcaddr Source address to use (IPv6-only). -4 Force using IPv4. -6 Force using IPv6.
C:\Users\users>tracert 8.8.8.8 Tracing route to dns.google [8.8.8.8] over a maximum of 30 hops: 1 8 ms 2 ms 5 ms 10.0.0.3 2 * * * Request timed out. 3 30 ms 26 ms 28 ms 10.0.0.1 4 56 ms 38 ms 35 ms 10.0.0.146 5 52 ms 36 ms 78 ms 10.0.0.149 6 39 ms 48 ms 38 ms 10.0.0.126 7 * 51 ms * 192.168.255.250 8 28 ms 46 ms 38 ms 0.0.0.138 9 30 ms 141 ms 24 ms 0.0.0.97 10 * * * Request timed out. 11 * * * Request timed out. 12 * * * Request timed out. 13 34 ms 42 ms 40 ms dns.google [8.8.8.8] 14 71 ms 78 ms 79 ms dns.google [8.8.8.8] 15 66 ms 77 ms 78 ms dns.google [8.8.8.8] 16 107 ms 78 ms 79 ms dns.google [8.8.8.8] 17 72 ms 74 ms 77 ms dns.google [8.8.8.8] 18 65 ms 75 ms 77 ms dns.google [8.8.8.8] 19 66 ms 73 ms 82 ms dns.google [8.8.8.8] Trace complete.
בדוגמה הבאה נקבל תוצאת tracert של 3 hops של הכתובת google.com והיא תופיע בקובץ בנתיב c:\tracert
tracert -h 3 google.com > c:\tracert
קבלת רשימה של ניתובים
הפקודה Route print
מאפשרת לנו לקבל סקירה של כל ה-Interface אך גם טבלת ניתובים. להלן:
C:\Users\user>route print =============================================== Interface List 40...a4 00 6d 26 ac d4 ......Realtek PCIe GbE Family Controller 11...5c 00 b6 00 b7 10 ......Microsoft Wi-Fi Direct Virtual Adapter 9...5e 00 b6 00 b7 0f ......Microsoft Wi-Fi Direct Virtual Adapter #2 2...5c 00 b6 00 b7 0f ......Intel(R) Wireless-AC 9462 3...5c 00 b6 00 b7 13 ......Bluetooth Device (Personal Area Network) 0...........................Software Loopback Interface 1 =============================================== IPv4 Route Table ============================================== Active Routes: Network Destination Netmask Gateway Interface Metric 0.0.0.0 0.0.0.0 10.0.0.1 10.0.0.164 55 127.0.0.0 255.0.0.0 On-link 127.0.0.1 331 127.0.0.1 255.255.255.255 On-link 127.0.0.1 331 127.255.255.255 255.255.255.255 On-link 127.0.0.1 331 10.0.0.0 255.255.255.0 On-link 10.0.0.164 311 10.0.0.164 255.255.255.255 On-link 10.0.0.164 311 10.0.0.255 255.255.255.255 On-link 10.0.0.164 311 10.0.0.0 255.255.255.0 On-link 10.0.0.1 291 10.0.0.1 255.255.255.255 On-link 10.0.0.1 291 10.0.0.255 255.255.255.255 On-link 10.0.0.1 291 10.0.242.0 255.255.255.0 On-link 10.0.242.1 291 10.0.242.1 255.255.255.255 On-link 10.0.242.1 291 10.0.242.255 255.255.255.255 On-link 10.0.242.1 291 224.0.0.0 240.0.0.0 On-link 127.0.0.1 331 224.0.0.0 240.0.0.0 On-link 10.0.0.164 311 224.0.0.0 240.0.0.0 On-link 10.0.242.1 291 224.0.0.0 240.0.0.0 On-link 10.0.0.1 291 255.255.255.255 255.255.255.255 On-link 127.0.0.1 331 255.255.255.255 255.255.255.255 On-link 10.0.0.164 311 255.255.255.255 255.255.255.255 On-link 10.0.242.1 291 255.255.255.255 255.255.255.255 On-link 10.0.0.1 291 =============================================== Persistent Routes: None IPv6 Route Table =============================================== Active Routes: If Metric Network Destination Gateway 1 331 ::1/128 On-link 8 311 ff00::/64 On-link 7 291 ff00::/64 On-link 16 291 ff00::/64 On-link 8 311 0000::0000:0000:0000:000e/128 On-link 16 291 0000::0000:0000:1e9:0000/128 On-link 7 291 ff00::0000:0000:0000:db44/128 On-link 1 331 ff00::/8 On-link 8 311 ff00::/8 On-link 7 291 ff00::/8 On-link 16 291 ff00::/8 On-link ============================================== Persistent Routes: None
קבלת רשימת כתובות Mac
פקודת getmac מציגה את כל כתובות ה-getmac במחשב
C:\Users\user>getmac Physical Address Transport Name =================== ================================ 00-00-6D-00-00-00 Media disconnected 00-00-00-00-B7-0F \Device\Tcpip_{000000-0000-470E-0000-01000000709} 00-00-00-00-B7-00 Media disconnected 00-0E-00-00-00-0E Disconnected 00-00-00-C0-00-01 \Device\Tcpip_{000000000-3700-0000-B000-AF000000000A8} 00-00-00-C0-00-00 \Device\Tcpip_{000000000-FC00-0000-8F00-D000900ABDE9}
צפייה ברשימת מחשבים המחוברים לרשת
לקבלת רשימת מחשבים ומכשירים המחוברים לרשת הנוכחית בה אנו גולשים נשתמש ב-net view
C:\>net view Server Name Remark -------------------------------------------- \\kds \\kdAV \\kdDC \\kdDC02 \\kdFS \\kd \\VEEAM The command completed successfully.
צפייה בכל במכשירים המחוברים לרשת שלך
פקודת arp מציגה את מה שנמצא ב brodcast domain ברשת השטוחה שבה אתה (המארח שמריץ את הפקודה) נמצא.
לרשימה מפורטת של כל המכשירים נשתמש בפקודת arp -a
C:\Users\user>arp -a Interface: 10.0.0.1 --- 0x7 Internet Address Physical Address Type 10.0.0.254 00-50-00-fe-00-24 dynamic 10.0.0.255 00-00-00-00-00-00 static 10.0.0.22 01-00-00-00-00-16 static 10.0.0.251 01-00-00-00-00-fb static 10.0.0.252 01-00-00-00-00-fc static 10.0.0.250 01-00-00-7f-00-fa static 255.255.255.255 00-00-00-00-00-00 static Interface: 10.0.0.164 --- 0x8 Internet Address Physical Address Type 10.0.43.1 08-00-00-ed-00-0c dynamic 10.0.43.255 00-00-00-00-00-00 static 10.0.0.22 01-00-00-00-00-16 static 10.0.0.251 01-00-00-00-00-fb static 10.0.0.252 01-00-00-00-00-fc static 10.0.0.250 01-00-00-7f-00-fa static 255.255.255.255 00-00-00-00-00-00 static
בדיקת חיבור לרשת ופורטים פתוחים
בפקודה netstat משתמשים כדי לקבל מושג על חיבור לרשת ופורטים פתוחים. שימוש בפקודה netstat -a תציג בפנינו בנוסף גם פורטים פתוחים/בהאזנה.
C:\Users\user>netstat Active Connections Proto Local Address Foreign Address State TCP 0.0.0.0:49673 activation:0 LISTENING TCP 127.0.0.1:2002 serius:63754 ESTABLISHED TCP 127.0.0.1:7778 serius:49686 ESTABLISHED TCP 127.0.0.1:49671 serius:49672 ESTABLISHED TCP 127.0.0.1:49672 serius:49671 ESTABLISHED TCP 127.0.0.1:8307 activation:0 LISTENING TCP 127.0.0.1:49674 serius:49675 ESTABLISHED TCP 127.0.0.1:49675 serius:49674 ESTABLISHED TCP 127.0.0.1:49684 serius:49685 ESTABLISHED TCP 127.0.0.1:49685 serius:49684 ESTABLISHED TCP 127.0.0.1:49686 serius:7778 ESTABLISHED TCP 127.0.0.1:49687 serius:49688 ESTABLISHED TCP 127.0.0.1:49688 serius:49687 ESTABLISHED TCP 127.0.0.1:63754 serius:2002 ESTABLISHED TCP 127.0.0.1:49681 activation:0 LISTENING TCP 10.0.0.164:49463 10.0.0.019:https ESTABLISHED TCP 10.0.0.164:51441 10.0.0.145:https ESTABLISHED TCP 10.0.0.164:51883 000-000-00-67-00:https ESTABLISHED TCP 10.0.0.164:51888 000-1-000-000-000:https ESTABLISHED TCP 10.0.0.164:51890 000-1-000-225-000:https ESTABLISHED TCP 10.0.0.164:51896 000-1-000-000-000:https ESTABLISHED TCP 10.0.0.164:51907 000-1-000-106-000:https ESTABLISHED TCP 10.0.0.164:51908 000-1-000-106-000:https ESTABLISHED TCP 10.0.0.164:51929 00-in-0000:5228 ESTABLISHED TCP 10.0.0.164:51974 0-00000-il:https ESTABLISHED TCP 10.0.0.164:51992 10.0.0.103:https ESTABLISHED
כיצד לבצע חידוש של כתובת IP
הפקודות ipconfig /release ו-ipconfig /renew בטוח מוכרות לכם, אך האם ידעתם שאפשרי לשלב את שניהם כפקודה אחת?
C:\Users\user>ipconfig /release & ipconfig /renew
כמו כן יש את הפקודות הנפוצות:
ipconfig /flushdns ipconfig /registerdns
בהצלחה!