有没有办法通过命令行查询当媒体与端口断开连接时当前的IP地址,子网掩码和默认网关是什么?
我累了ipconfig
,
Ethernet adapter Local Area Connection:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
netsh interface ip show addresses
确实显示了网关,但没有显示子网或IP地址,
Configuration for interface "Local Area Connection"
DHCP enabled: No
Default Gateway: 192.168.6.17
Gateway Metric: 1
InterfaceMetric: 5
和netsh interface ip show config
Configuration for interface "Local Area Connection"
DHCP enabled: No
Default Gateway: 192.168.6.17
Gateway Metric: 1
InterfaceMetric: 5
Statically Configured DNS Servers: None
Register with which suffix: Primary only
Statically Configured WINS Servers: None
当媒体断开连接时,GUI显示ip addess,子网掩码和默认网关。是否有命令在命令行上获取相同的信息?
答案 0 :(得分:0)
要获取IP地址和子网掩码,请运行以下命令。
> netsh interface ip dump
# ----------------------------------
# IPv4 Configuration
# ----------------------------------
pushd interface ipv4
reset
set global icmpredirects=enabled
add route prefix=0.0.0.0/0 interface="Local Area Connection" nexthop=192.168.7.12 metric=1 publish=Yes
add address name="Local Area Connection" address=192.168.7.34 mask=255.255.255.128
popd
# End of IPv4 configuration
IP地址为address=192.168.7.34
,子网掩码为mask=255.255.255.128
,Deafault网关为nexthop=192.168.7.12
。