::code by youxi01@bbs.bathome.cn 2008-1-7
Use @echo off and setlocal enabledelayeexpansion to disable echo from the command prompt and enable delayed expansion.
title LAN idle IP query@bbs.bathome.cn
Rem '/*========Get the IP address of this machine (LAN)=========*/
echo Obtaining the IP address of this machine, please wait...
In the given command line, use the `nbtstat -n` command to get the output and extract the third token from it, skipping the first two tokens. Finally, use a colon as a delimiter to split the output. The function of this command is to obtain the network
in Windows systemset "IP_addr=%%i"
set IP_addr=!IP_addr:~1,-1!
echo The local IP is:! IP_addr!
goto :next
)
:next
for /f "delims=. tokens=1,2,3,4" %%i in ("%IP_addr%") do set IP_fd=%%i.%%j.%%k
Rem '/*========Get the computer name============*/
echo.&echo Retrieving the computer name in the LAN, please wait...
echo The computers in network segment %IP_fd%.* are: &echo.
for /f "delims=" %%i in ('net view') do (
set "var=%%i"
rem ----------Get the computer name------------
if "!var:~0,2!"=="\\" (
set "var=!var:~2!"
echo !var!
Rem ----------ping computer name--------------
ping -n 1 !var!>nul
)
)
echo.&echo --------------------------------
Rem '/*========Extract arp cache=========*/
echo.&echo Obtaining the computer IP in the LAN, please wait...& echo.
for /f "skip=3 tokens=1,* delims= " %%i in ('arp -a') do echo IP: %%i has been used
echo.&echo --------------------------------
echo program is completed, thank you for using it!
pause>nul
==============Copy the above content=============
Welcome: bbs.bathome.cn
In CMD, use the route print command to view routes. You can add the parameter /4 to view only IPV4 routes.
The view is only to view the IP address. Use the ipconfig command and add the parameter /all to view all IP information.
Routing refers to the network-wide process of determining the end-to-end path when a packet travels from source to destination
. Routing works on the third layer of the OSI reference model - the packet forwarding device of the network layer. Routers implement network interconnection by forwarding data packets. Routers usually connect two or more logical ports identified by IP subnets or point-to-point protocols, and have at least 1 physical port. The router determines the output port and next hop address based on the network layer address in the received data packet and the routing table maintained internally by the router, and rewrites the link layer data packet header to forward the data packet. Routers maintain routing tables by dynamically maintaining routing tables to reflect the current network topology and by exchanging routing and link information with other routers on the network.
The interconnection protocol (IP) between networks is the foreign language abbreviation of Internet Protocol, and the Chinese abbreviation is "Network Association". It is a protocol designed for computer networks to connect to each other for communication. In the Internet, it is a set of rules that enable all computer networks connected to the Internet to communicate with each other. It stipulates the rules that computers should abide by when communicating on the Internet. Computer systems produced by any manufacturer can interconnect with the Internet as long as they comply with the IP protocol. IP addresses are unique and can be divided into 5 categories according to the nature of the user. In addition, IP also has meanings such as access protection, intellectual property rights, pointer registers, etc.
1. Open the command prompt in the start menu.
2. Right-click and select Run as administrator.
3. Enter the command arp -a in the pop-up command window.
4. Press the Enter key on the keyboard to execute the command.
5. In this way, the command window can display the IP information of all users in the LAN.
Extended information:
Area network address classification:
1, 0--127. Диапазон номеров сетей класса A — 0.0.0.0—--127.0.0.0, используется для 128 сетей. Но сеть не может состоять из одних нулей, и адрес 127.0.0.0 зарезервирован для циклов.
2, 128-191. Класс B, диапазон номеров сетей составляет 128.0.0.0–191.254.0.0 для 16256 сетей.
№##3, 192--223. Класс C, диапазон номеров сети: 192.0.0.0–223.254.254.0, используется в сетях 2064512.4. Категория D. 224.0.0.0--240.255.255.255 используется для многоадресной рассылки, что позволяет экономить сетевые ресурсы.
Источник ссылки: Энциклопедия Sogou-Интранет IP
The above is the detailed content of CMD command or IP software to view all MAC addresses on the LAN. For more information, please follow other related articles on the PHP Chinese website!