Professional Documents
Culture Documents
Àdzdss
Àdzdss
Mục tiêu: Sau khi hoàn thành bài thực hành này, sinh viên có thể
- Biết được một số tiện ích về TCP/IP trên môi trường Windows.
- Sử dụng các tiện ích về TCP/IP một cách thành thạo.
- Vận dụng các tiện ích này vào việc tìm và khắc phục các lỗi về TCP/IP.
Mục đích: Người quản trị sử dụng lệnh này để xem thông tin TCP/IP trên các giao tiếp
mạng và tất nhiên cũng có thể dùng để cấu hình TCP/IP cho các giao tiếp mạng.
Cú pháp:
C:\Windows\System32\ipconfig.exe
ipconfig [/? | /all | /release [adapter] | /renew [adapter] | /flushdns | /displaydns |
/registerdns | /showclassid adapter | /setclassid adapter [classid] ]
STT LỆNH MÔ TẢ
1 > ipconfig /? Hiển thị sự trợ giúp
2 > ipconfig /all Hiển thị tất cả thông tin cấu hình TCP/IP
3 > ipconfig /release Hủy bỏ cấu hình IP hiện tại
Dùng lệnh này khi thông tin TCP/IP trên
DHCP server đã bị thay đổi nhưng thời gian
Lease Duration cấp cho host vẫn chưa hết hạn.
4 > ipconfig /renew Thay địa chỉ IP mới cho card mạng
Dùng lệnh này yêu cầu mới thông tin TCP/IP
khi host chưa nhân IP hay trước đó đã release
Ví dụ: Sử dụng lệnh ipconfig /all
C:\Users\Sori>ipconfig /all
Windows IP Configuration
Trang 13
DNS Suffix Search List. . . . . . : dtu.vn
C:\Users\Sori>
2.2. Ping
Mục đích: Lệnh PING dùng kiểm tra kết nối mạng đến các host khác sử dụng giao thức
ICMP.
Cú pháp: PING [options] destination_host
C:\Windows\System32\PING.EXE
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] target_name
Options:
Trang 14
Ví dụ 1:
ping 203.113.131.1 -t // Kiểm tra kết nối đến host “dns1.viettel.com.vn” lặp
vô hạn kết nối (mặc định chỉ gởi 4 ICMP packets)
Pinging 203.113.131.1 with 32 bytes of data:
Hardware error.
Hardware error.
Card mạng ở trạng thái Disable hoặc chưa lắp Card.
Pinging 203.113.131.1 with 32 bytes of data:
2.3. Tracert
Mục đích: Người quản trị sử dụng lệnh này để dò tìm đường đi đến một hệ thống khác,
dùng xác định được lỗi xảy ra khi không thực hiện được kết nối.
Trang 15
Cú pháp:
C:\Windows\System32\TRACERT.EXE
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.
Ví dụ:
tracert www.dtu.edu.vn // Dò đường đi đến máy chủ web dtu.edu.vn
Tracing route to www.dtu.edu.vn [10.0.0.13]
2 82 ms 3 ms 4 ms 172.16.0.1
3 82 ms 34 ms * 192.168.2.1
4 35 ms 2 ms 4 ms localhost [10.0.0.13]
Trace complete.
2.4. Netstat
Mục đích: Người quản trị sử dụng lệnh này để xem xét toàn diện thông tin về hệ thống
cục bộ và bộ giao thức TCP/IP.
Cú pháp:
C:\Windows\System32\NETSTAT.EXE
Usage:
NETSTAT [options] [-p protocol] [interval]
Options:
-a Display All connections and listening ports.
-e Display Ethernet statistics. (may be combined with -s)
-n Display addresses and port numbers in Numerical form.
-r Display the Routing table.
-o Display the Owning process ID associated with each connection.
-b Display the exe involved in creating each connection or listening port.*
-v Verbose - use in conjunction with -b, to display the sequence of
components involved for all executables.
-p protocol
Show only connections for the protocol specified;
may be any of: TCP, UDP, TCPv6 or UDPv6.
If used with the -s option then the following protocols
may also be specified: IP, IPv6, ICMP,or ICMPv6.
Trang 16
-s Display per-protocol statistics. By default, statistics are
shown for IP, IPv6, ICMP, ICMPv6, TCP, TCPv6, UDP, and UDPv6;
(The v6 protocols are not available under 2k and NT4)
The -p option may be used to display just a subset of these.
Ví dụ:
netstat –a // Xem tất cả các kết nối
Active Connections
Trang 17
2.5. Nslookup (Name server lookup)
Mục đích: Người quản trị sử dụng công cụ này để kiểm tra hoạt động của hệ thống hỏi
đáp tên miền (Domain Name System).
Cú pháp:
C:\Windows\System32\nslookup.EXE
Syntax
Lookup the ip address of MyHost:
NSLOOKUP
Trang 18
-d - list all records
-t TYPE - list records of the given Type (for example, A, CNAME,
MX, NS, PTR, and so on)
-a - list Aliases and canonical names.
Ví dụ 1:
nslookup google.com // Tra cứu địa chỉ IP của google.com
Server: DD-WRT
Address: 192.168.100.17
Name: google.com
Addresses: 74.125.127.100, 74.125.67.100, 74.125.45.100
Ví dụ 2:
nslookup –type=MX google.com // Tra cứu thông tin Mail Server của Google
Server: DD-WRT
Address: 192.168.100.17
Mục đích: Người quản trị sử dụng công cụ này để xem và chỉnh sửa bảng ARP.
Cú pháp:
Lệnh ARP trên máy Windows: “C:\Windows\System32\ARP.EXE”
C:\Users\Sori>arp /?
Displays and modifies the IP-to-Physical address translation
tables used by address resolution protocol (ARP).
ARP -s inet_addr eth_addr [if_addr]
ARP -d inet_addr [if_addr]
ARP -a [inet_addr] [-N if_addr] [-v]
-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.
-v Displays current ARP entries in verbose mode. All
invalid entries and entries on the loop-back interface
will be shown.
inet_addr Specifies an internet address.
Trang 19
-N if_addr Displays the ARP entries for the network interface
specified by if_addr.
-d Deletes the host specified by inet_addr. inet_addr may
be wildcarded with * to delete all hosts.
-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.
Example:
> arp -s 157.55.85.212 00-aa-00-62-c6-09 //Adds a static entry.
> arp –a //Displays the arp table.
C:\Users\Sori>
Trang 20
Ví dụ:
Hiển thị bảng ARP của tất cả các interfaces:
C:\> arp -a
Hiển thị bảng ARP trên interface có địa chỉ IP là 10.7.3.36:
C:\> arp -a -N 10.7.3.26
Gán tĩnh 1 dòng vào bảng ARP, gắn IP 10.1.4.77 và MAC 00-AA-21-4A-2F-9A:
C:\> arp -s 10.1.4.77 00-AA-21-4A-2F-9A
Trang 21