弱电工程师常用的网络命令整理-windows版,还不快收藏起来

科技   2024-11-26 08:30   重庆  

一、ping命

  • 1、ping ping是最常用的实用程序之一,用来确定网络的连通性

ping是个使用频率极高的实用程序,主要用于确定网络的连通性pi,如果ping通一个地址,那么基本可以排除物理层数据链路层的故障等。

ping 的命令格式通常是ping + IP、 地址 ping +域名、 ping+ 主机名,下面来举例一些常用的ping 命令:

ping 127.0.0.1 此命令主要用于验证本机的连通性





ping 192.168.0.1 (内网处于1网段)若处于同一内网之中,使用此命令,可确定与内网内某主机的连通性





ping 域名 想要判断与某些服务器之间的连通性 可直接Ping 其域名





可以看到,ping成功后上面有一个TTL值,TTL值指的是生存时间,TTL值越大,说明应答时间越快。

  • 2、ipconfig实用程序可用于显示当前的TCP/IP配置的设置值,这些信息一般用来检验人工配置的TCP/IP设置是否正确。

例如如果计算机和所在的局域网使用了动态主机配置协议DHCP,使用ipconfig命令可以了解到你的计算机是否成功地租用到了一个IP地址,如果已经租用到,则可以了解它目前得到的是什么地址,包括IP地址、子网掩码和缺省网关等网络配置信息。

二、下面几个命令是ipconfig的一些常见命令

  • 1、ipconfig

当使用不带任何参数选项ipconfig命令时,显示每个已经配置了的接口的IP地址、子网掩码和缺省网关值。

  • 2、ipconfig/all当使用all选项时,ipconfig能显示计算机网络连接情况,包括它的IP地址、DNS、DHCP、MAC地址等信息。





  • 3、ipconfig/release和ipconfig/renew

这两个附加选项是针对进行DHCP服务器租用IP地址的计算机使用,如果输入ipconfig /release,那么所有接口的租用IP地址便重新交付给DHCP服务器(归还IP地址),如果输入ipconfig /renew,那么本地计算机便设法与DHCP服务器取得联系,并租用一个IP地址。

三、arp命令(地址转换协议)

ARP是TCP/IP协议族中的一个IP层协议,用来实现IP地址和MAC地址的映射。

使用arp命令,能够查看本地计算机或另一台计算机的ARP高速缓存中的内容,同时还可以使用ARP实现以DHCP分配的IP地址的静态固定。

举几个栗子:

  • ① arp –a:用于查看高速缓存中的所有项目。

  • ② arp -a IP:如果有多个网卡,那么使用arp -a加上接口的IP地址,就可以只显示与该接口相关的ARP缓存项目。





  • ③ arp -s IP 物理地址:向ARP高速缓存中人工输入一个静态项目。该项目在计算机引导过程中将保持有效状态,或者在出现错误时,人工配置的物理地址将自动更新该项目。

  • ④ arp -d IP:使用本命令能够人工删除一个静态项目。

四、traceroute命令

大家对这个命令肯定不陌生,当我们网路遇到问题时想要排除在哪遇到的问题,就会选择此命令用来显示数据包到达目的主机所经过的路径。

traceroute命令的常见用法:

  1. tracert host_name或tracert ip_address

其中输出有5列:

第一列是描述路径的第n跳的数值,即沿着该路径的路由器序号;
第二列是第一次往返时延;
第三列是第二次往返时延;
第四列是第三次往返时延;
第五列是路由器的名字及其输入端口的IP地址。

使用tracert命令可以用来查看网络在连接站点时经过的步骤或采取哪种路线,如果是网络出现故障,就可以通过这条命令查看出现问题的位置。

五、route命令

用于查看当前项目路由表中的项目,常见使用规则如下:

  1. route print

本命令用于显示路由表中的当前项目,在单个路由器网段上的输出结果如图所示。

  1. route命令的高级用法:route add 使用此命令,可以将路由项目添加进路由表。

  2. route change 使用此命令来修改数据的传输路由

  3. route delete使用此命令可以从路由表中删除路由

六、nslookup命令

命令nslookup的功能是查询任何一台机器的IP地址和其对应的域名,它通常需要一台域名服务器来提供域名。如果用户已经设置好域名服务器,就可以用这个命令查看不同主机的IP地址对应的域名。

  • 1、在本地机上使用nslookup命令查看本机的IP及域名服务器地址。

使用方法举例:

  1. 直接使用nslookup 命令返回本机的服务器名称(带域名的全称)和IP地址。

  2. 在>输入域名/IP查看对应的IP地址或域名并回车即可。

七、nbtstat命令

使用nbtstat命令可以查询本地计算机网络配置的一些信息或者别人计算机上一些私人信息。

举个栗子:如果想查看自己计算机上的网络信息,可以运行nbtstat -n,可以得到你所在的工作组,计算机名以及网卡地址等等。

想查看网络上其他的电脑情况,就运行nbtstat -a IP地址,之后就会返回得到那台主机上的一些信息。

八、netstat命令

使用netstat命令能够显示活动的TCP连接、计算机侦听的端口、以太网统计信息、IP路由表等信息

下面给出netstat的一些常用选项:

  • ① netstat –a:-a选项显示所有的有效连接信息列表,包括已建立的连接(ESTABLISHED),也包括监听连接请求(LISTENING)的那些连接。
C:\Users\Administrator                                                                           
λ netstat -a                                                                                     
                                                                                                 
活动连接                                                                                             
                                                                                                 
  协议  本地地址          外部地址        状态                                                               
  TCP    0.0.0.0:135            DESKTOP-R5RIU58:0      LISTENING                                 
  TCP    0.0.0.0:443            DESKTOP-R5RIU58:0      LISTENING                                 
  TCP    0.0.0.0:445            DESKTOP-R5RIU58:0      LISTENING                                 
  TCP    0.0.0.0:903            DESKTOP-R5RIU58:0      LISTENING                                 
  TCP    0.0.0.0:913            DESKTOP-R5RIU58:0      LISTENING                                 
  TCP    0.0.0.0:5040           DESKTOP-R5RIU58:0      LISTENING                                 
  TCP    0.0.0.0:5357           DESKTOP-R5RIU58:0      LISTENING                                 
  TCP    0.0.0.0:6730           DESKTOP-R5RIU58:0      LISTENING                                 
  TCP    0.0.0.0:7680           DESKTOP-R5RIU58:0      LISTENING                                 
  TCP    0.0.0.0:9128           DESKTOP-R5RIU58:0      LISTENING                                 
  TCP    0.0.0.0:15001          DESKTOP-R5RIU58:0      LISTENING                                 
  TCP    0.0.0.0:19531          DESKTOP-R5RIU58:0      LISTENING                                 
  TCP    0.0.0.0:49664          DESKTOP-R5RIU58:0      LISTENING                                 
  TCP    0.0.0.0:49665          DESKTOP-R5RIU58:0      LISTENING                                 
  TCP    0.0.0.0:49666          DESKTOP-R5RIU58:0      LISTENING                                 
  TCP    0.0.0.0:49667          DESKTOP-R5RIU58:0      LISTENING                                 
  TCP    0.0.0.0:49668          DESKTOP-R5RIU58:0      LISTENING                                 
  TCP    0.0.0.0:49673          DESKTOP-R5RIU58:0      LISTENING                                 
  TCP    0.0.0.0:54322          DESKTOP-R5RIU58:0      LISTENING                                 
  TCP    0.0.0.0:64225          DESKTOP-R5RIU58:0      LISTENING                                 
  TCP    127.0.0.1:443          DESKTOP-R5RIU58:62910  TIME_WAIT                                 
  TCP    127.0.0.1:443          DESKTOP-R5RIU58:62960  ESTABLISHED                               
  TCP    127.0.0.1:2017         DESKTOP-R5RIU58:0      LISTENING                                 
  TCP    127.0.0.1:4000         DESKTOP-R5RIU58:0      LISTENING                                 
  TCP    127.0.0.1:8307         DESKTOP-R5RIU58:0      LISTENING                                 
  TCP    127.0.0.1:10000        DESKTOP-R5RIU58:0      LISTENING                                 
  TCP    127.0.0.1:17223        DESKTOP-R5RIU58:0      LISTENING                                 
  TCP    127.0.0.1:28317        DESKTOP-R5RIU58:0      LISTENING                                 
  TCP    127.0.0.1:59732        DESKTOP-R5RIU58:59733  ESTABLISHED                               
  TCP    127.0.0.1:59733        DESKTOP-R5RIU58:59732  ESTABLISHED                               
  TCP    127.0.0.1:59734        DESKTOP-R5RIU58:59735  ESTABLISHED                               
  TCP    127.0.0.1:59735        DESKTOP-R5RIU58:59734  ESTABLISHED                               
  TCP    127.0.0.1:62546        DESKTOP-R5RIU58:62547  ESTABLISHED                               
  TCP    127.0.0.1:62547        DESKTOP-R5RIU58:62546  ESTABLISHED                               
  TCP    127.0.0.1:62548        DESKTOP-R5RIU58:62549  ESTABLISHED                               
  TCP    127.0.0.1:62549        DESKTOP-R5RIU58:62548  ESTABLISHED                               
  TCP    127.0.0.1:62550        DESKTOP-R5RIU58:62551  ESTABLISHED                               
  TCP    127.0.0.1:62551        DESKTOP-R5RIU58:62550  ESTABLISHED                               
  TCP    127.0.0.1:62910        DESKTOP-R5RIU58:https  TIME_WAIT                                 
  TCP    127.0.0.1:62960        DESKTOP-R5RIU58:https  ESTABLISHED                               
  TCP    192.168.0.116:139      DESKTOP-R5RIU58:0      LISTENING                                 
  TCP    192.168.0.116:49691    20.198.162.78:https    ESTABLISHED                               
  TCP    192.168.0.116:49933    124.239.239.227:http   CLOSE_WAIT                                
  TCP    192.168.0.116:49934    124.239.239.227:http   CLOSE_WAIT                                
  TCP    192.168.0.116:57085    223.252.199.69:6003    ESTABLISHED                               
  TCP    192.168.0.116:60209    a23-45-60-10:https     CLOSE_WAIT                                
  TCP    192.168.0.116:62040    139.224.110.121:1883   ESTABLISHED                               
  TCP    192.168.0.116:62413    114.230.213.77:https   ESTABLISHED                               
  TCP    192.168.0.116:62431    114.230.213.77:https   ESTABLISHED                               
  TCP    192.168.0.116:62459    101.91.19.71:https     CLOSE_WAIT                                
  TCP    192.168.0.116:62477    119.0.83.42:https      TIME_WAIT                                 
  TCP    192.168.0.116:62488    39.97.4.86:https       ESTABLISHED                               
  TCP    192.168.0.116:62496    114.55.180.23:https    ESTABLISHED                               
  TCP    192.168.0.116:62745    113.96.208.167:8000    CLOSE_WAIT                                
  TCP    192.168.0.116:62746    113.96.232.84:https    CLOSE_WAIT                                
  TCP    192.168.0.116:62748    113.96.208.167:8000    CLOSE_WAIT                                
  TCP    192.168.0.116:62749    113.96.208.167:8000    CLOSE_WAIT                                
  TCP    192.168.0.116:62812    157.255.245.58:https   ESTABLISHED                               
  TCP    192.168.0.116:62905    114.222.112.94:8080    ESTABLISHED                               
  TCP    192.168.0.116:62942    180.163.150.162:https  ESTABLISHED                               
  TCP    192.168.0.116:62953    124.232.169.203:https  ESTABLISHED                               
  TCP    192.168.0.116:62954    ecs-114-116-236-109:https  ESTABLISHED                           
  TCP    192.168.0.116:62969    ppp48-99:http          TIME_WAIT                                 
  TCP    192.168.0.116:62970    60.205.170.78:https    CLOSE_WAIT                                
  TCP    192.168.0.116:62971    14.17.5.240:https      ESTABLISHED                               
  TCP    192.168.0.116:62978    117.24.3.240:https     ESTABLISHED                               
  TCP    192.168.0.116:62980    52.143.87.28:https     ESTABLISHED                               
  TCP    192.168.0.116:62981    119.0.83.46:https      ESTABLISHED                               
  TCP    192.168.0.116:62982    tsa03s08-in-f10:https  SYN_SENT                                  
  TCP    192.168.0.116:62983    tsa03s08-in-f10:https  SYN_SENT                                  
  TCP    192.168.0.116:62984    49.7.22.7:https        ESTABLISHED                               
  TCP    192.168.0.116:62989    tsa01s11-in-f14:https  SYN_SENT                                  
  TCP    192.168.0.116:62991    113.96.213.14:https    ESTABLISHED                               
  TCP    192.168.0.116:62992    67.227.186.229:http    SYN_SENT                                  
  TCP    192.168.0.116:63070    124.232.169.236:https  ESTABLISHED                               
  TCP    192.168.0.116:63077    58.221.30.137:https    ESTABLISHED                               
  TCP    192.168.0.116:63088    36.110.186.243:https   ESTABLISHED                               
  TCP    192.168.0.116:64220    115.236.118.34:https   ESTABLISHED                               
  TCP    192.168.0.116:64223    59.111.211.9:https     CLOSE_WAIT                                
  TCP    192.168.0.116:64226    59.111.209.33:8080     ESTABLISHED                               
  TCP    192.168.139.1:139      DESKTOP-R5RIU58:0      LISTENING                                 
  TCP    192.168.190.1:139      DESKTOP-R5RIU58:0      LISTENING                                 
  TCP    [::]:135               DESKTOP-R5RIU58:0      LISTENING                                 
  TCP    [::]:443               DESKTOP-R5RIU58:0      LISTENING                                 
  TCP    [::]:445               DESKTOP-R5RIU58:0      LISTENING                                 
  TCP    [::]:5357              DESKTOP-R5RIU58:0      LISTENING                                 
  TCP    [::]:7680              DESKTOP-R5RIU58:0      LISTENING                                 
  TCP    [::]:15001             DESKTOP-R5RIU58:0      LISTENING                                 
  TCP    [::]:49664             DESKTOP-R5RIU58:0      LISTENING                                 
  TCP    [::]:49665             DESKTOP-R5RIU58:0      LISTENING                                 
  TCP    [::]:49666             DESKTOP-R5RIU58:0      LISTENING                                 
  TCP    [::]:49667             DESKTOP-R5RIU58:0      LISTENING                                 
  TCP    [::]:49668             DESKTOP-R5RIU58:0      LISTENING                                 
  TCP    [::]:49673             DESKTOP-R5RIU58:0      LISTENING                                 
  TCP    [::]:54322             DESKTOP-R5RIU58:0      LISTENING                                 
  TCP    [::1]:8307             DESKTOP-R5RIU58:0      LISTENING                                 
  TCP    [::1]:8307             DESKTOP-R5RIU58:62911  CLOSE_WAIT                                
  TCP    [::1]:8307             DESKTOP-R5RIU58:62961  ESTABLISHED                               
  TCP    [::1]:49669            DESKTOP-R5RIU58:0      LISTENING                                 
  TCP    [::1]:62553            DESKTOP-R5RIU58:62554  ESTABLISHED                               
  TCP    [::1]:62554            DESKTOP-R5RIU58:62553  ESTABLISHED                               
  TCP    [::1]:62911            DESKTOP-R5RIU58:8307   FIN_WAIT_2                                
  TCP    [::1]:62961            DESKTOP-R5RIU58:8307   ESTABLISHED                               
  UDP    0.0.0.0:1863           *:*                                                              
  UDP    0.0.0.0:3702           *:*                                                              
  UDP    0.0.0.0:3702           *:*                                                              
  UDP    0.0.0.0:3702           *:*                                                              
  UDP    0.0.0.0:3702           *:*                                                              
  UDP    0.0.0.0:5050           *:*                                                              
  UDP    0.0.0.0:5353           *:*                                                              
  UDP    0.0.0.0:5353           *:*                                                              
  UDP    0.0.0.0:5353           *:*                                                              
  UDP    0.0.0.0:5353           *:*                                                              
  UDP    0.0.0.0:5353           *:*                                                              
  UDP    0.0.0.0:5353           *:*                                                              
  UDP    0.0.0.0:5353           *:*                                                              
  UDP    0.0.0.0:5353           *:*                                                              
  UDP    0.0.0.0:5353           *:*                                                              
  UDP    0.0.0.0:5353           *:*                                                              
  UDP    0.0.0.0:5353           *:*                                                              
  UDP    0.0.0.0:5353           *:*                                                              
  UDP    0.0.0.0:5353           *:*                                                              
  UDP    0.0.0.0:5355           *:*                                                              
  UDP    0.0.0.0:6882           *:*                                                              
  UDP    0.0.0.0:12346          *:*                                                              
  UDP    0.0.0.0:15001          *:*                                                              
  UDP    0.0.0.0:50146          *:*                                                              
  UDP    0.0.0.0:50945          *:*                                                              
  UDP    0.0.0.0:51815          *:*                                                              
  UDP    0.0.0.0:52388          *:*                                                              
  UDP    0.0.0.0:52965          *:*                                                              
  UDP    0.0.0.0:52966          *:*                                                              
  UDP    0.0.0.0:54366          *:*                                                              
  UDP    0.0.0.0:54367          *:*                                                              
  UDP    0.0.0.0:54671          *:*                                                              
  UDP    0.0.0.0:54991          *:*                                                              
  UDP    0.0.0.0:55523          *:*                                                              
  UDP    0.0.0.0:56057          *:*                                                              
  UDP    0.0.0.0:56549          *:*                                                              
  UDP    0.0.0.0:60426          *:*                                                              
  UDP    0.0.0.0:61513          *:*                                                              
  UDP    0.0.0.0:62493          *:*                                                              
  UDP    127.0.0.1:1900         *:*                                                              
  UDP    127.0.0.1:56056        *:*                                                              
  UDP    127.0.0.1:61512        *:*                                                              
  UDP    127.0.0.1:64690        *:*                                                              
  UDP    192.168.0.116:137      *:*                                                              
  UDP    192.168.0.116:138      *:*                                                              
  UDP    192.168.0.116:1900     *:*                                                              
  UDP    192.168.0.116:56053    *:*                                                              
  UDP    192.168.139.1:137      *:*                                                              
  UDP    192.168.139.1:138      *:*                                                              
  UDP    192.168.139.1:1900     *:*                                                              
  UDP    192.168.139.1:56054    *:*                                                              
  UDP    192.168.190.1:137      *:*                                                              
  UDP    192.168.190.1:138      *:*                                                              
  UDP    192.168.190.1:1900     *:*                                                              
  UDP    192.168.190.1:56055    *:*                                                              
  UDP    [::]:3702              *:*                                                              
  UDP    [::]:3702              *:*                                                              
  UDP    [::]:3702              *:*                                                              
  UDP    [::]:3702              *:*                                                              
  UDP    [::]:5353              *:*                                                              
  UDP    [::]:5353              *:*                                                              
  UDP    [::]:5353              *:*                                                              
  UDP    [::]:5353              *:*                                                              
  UDP    [::]:5353              *:*                                                              
  UDP    [::]:5353              *:*                                                              
  UDP    [::]:5353              *:*                                                              
  UDP    [::]:5355              *:*                                                              
  UDP    [::]:12346             *:*                                                              
  UDP    [::]:52966             *:*                                                              
  UDP    [::]:54367             *:*                                                              
  UDP    [::]:54992             *:*                                                              
  UDP    [::]:55524             *:*                                                              
  UDP    [::]:56058             *:*                                                              
  UDP    [::1]:1900             *:*                                                              
  UDP    [::1]:56052            *:*                                                              
  UDP    [fe80::6c1c:ab92:ec2d:af31%22]:1900  *:*                                                
  UDP    [fe80::6c1c:ab92:ec2d:af31%22]:56050  *:*                                               
  UDP    [fe80::7431:8916:53d1:a1d8%10]:1900  *:*                                                
  UDP    [fe80::7431:8916:53d1:a1d8%10]:56051  *:*                                               
  UDP    [fe80::a5d0:c9d6:a7ce:32c%3]:1900  *:*                                                  
  UDP    [fe80::a5d0:c9d6:a7ce:32c%3]:56049  *:*                                                 
  • ② netstat –n:以点分十进制的形式列出IP地址,而不是象征性的主机名和网络名。

  • ③ netstat -e:-e选项用于显示关于以太网的统计数据,包括传送的数据包的总字节数、错误数、删除数、数据包的数量和广播的数量,这些统计数据既有发送的数据包数量,也有接收的数据包数量。使用这个选项可以统计一些基本的网络流量。

  • ④ netstat -r:-r用于返回显示有效路由以及当前有效的连接。

九、net命令

net用于了解Net服务的功能,可以通过Net服务命令解决有关网络问题。

  1. 在命令行键入net help command,可以在命令行获得net命令的语法帮助。
C:\Users\Administrator                                                                           
λ net help                                                                                       
此命令的语法是:                                                                                         
                                                                                                 
NET HELP                                                                                         
command                                                                                          
     -或-                                                                                         
NET command /HELP                                                                                
                                                                                                 
  可用的命令为:                                                                                        
                                                                                                 
  NET ACCOUNTS             NET HELPMSG              NET STATISTICS                               
  NET COMPUTER             NET LOCALGROUP           NET STOP                                     
  NET CONFIG               NET PAUSE                NET TIME                                     
  NET CONTINUE             NET SESSION              NET USE                                      
  NET FILE                 NET SHARE                NET USER                                     
  NET GROUP                NET START                NET VIEW                                     
  NET HELP                                                                                       
                                                                                                 
  NET HELP NAMES 解释 NET HELP 语法行中的不同类型名称。                                                        
  NET HELP SERVICES 列出可以启动的一些服务。                                                                 
  NET HELP SYNTAX 解释如何读取 NET HELP 语法行。                                                           
  NET HELP 命令 | MORE 显示帮助,一次显示一屏。                                                                                                                                                             
  1. 所有net命令都可以使用/y和/n命令行选项。例如,net stop server命令用于提示用户确认停止所有依赖的服务器服务,net stop server/y表示确认停止并关闭服务器服务。


计算科学与信息化
计算机网络与安全、区块链、人工智能、CV、VR/AR、数据分析挖掘、编程开发以及各种软硬件技术知识分享。欢迎关注计算科学与信息化!
 最新文章