ipconfig
Microsoft Windows [版本 10.0.22631.3593]
(c) Microsoft Corporation。保留所有权利。
C:\Users\cheng>ipconfig
Windows IP 配置
以太网适配器 以太网 2:
媒体状态 . . . . . . . . . . . . : 媒体已断开连接
连接特定的 DNS 后缀 . . . . . . . :
无线局域网适配器 本地连接* 8:
媒体状态 . . . . . . . . . . . . : 媒体已断开连接
连接特定的 DNS 后缀 . . . . . . . :
无线局域网适配器 本地连接* 9:
媒体状态 . . . . . . . . . . . . : 媒体已断开连接
连接特定的 DNS 后缀 . . . . . . . :
无线局域网适配器 WLAN 2:
...
以太网适配器 vEthernet (WSL (Hyper-V firewall)):
连接特定的 DNS 后缀 . . . . . . . :
本地链接 IPv6 地址. . . . . . . . : fe80::ed84:13c8:f7e2:6918%45
IPv4 地址 . . . . . . . . . . . . : 172.31.32.1
子网掩码 . . . . . . . . . . . . : 255.255.240.0
默认网关. . . . . . . . . . . . . :
C:\Users\cheng>
ping $(hostname).local
(base) yongqiang@yongqiang:~$ ping $(hostname).local
PING yongqiang (172.31.32.1) 56(84) bytes of data.
...
cat /etc/resolv.conf
(base) yongqiang@yongqiang:~$ cat /etc/resolv.conf
# This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to /etc/wsl.conf:
# [network]
# generateResolvConf = false
nameserver 172.31.32.1
(base) yongqiang@yongqiang:~$
(base) yongqiang@yongqiang:~$ cat /etc/resolv.conf | grep nameserver
nameserver 172.31.32.1
(base) yongqiang@yongqiang:~$
(base) yongqiang@yongqiang:~$ cat /etc/resolv.conf | grep nameserver | awk '{ print $2 }'
172.31.32.1
(base) yongqiang@yongqiang:~$
ip route show
(base) yongqiang@yongqiang:~$ ip route show
default via 172.31.32.1 dev eth0 proto kernel
172.31.32.0/20 dev eth0 proto kernel scope link src 172.31.33.1
(base) yongqiang@yongqiang:~$
(base) yongqiang@yongqiang:~$ ip route show | grep -i default
default via 172.31.32.1 dev eth0 proto kernel
(base) yongqiang@yongqiang:~$
ip addr
(base) yongqiang@yongqiang:~$ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:15:5d:10:1c:0d brd ff:ff:ff:ff:ff:ff
inet 172.31.33.1/20 brd 172.31.47.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::215:5dff:fe10:1c0d/64 scope link
valid_lft forever preferred_lft forever
(base) yongqiang@yongqiang:~$
[1] Yongqiang Cheng, https://yongqiang.blog.csdn.net/