在 Debian 系统中,查看 IP 地址常用以下几种方式:
ifconfig(需安装 net-tools)ifconfig
如果提示 command not found,说明没装,先安装:
sudo apt update
sudo apt install net-tools
然后:
ifconfig
通常 inet 后面就是 IP 地址(如 192.168.1.100)。
只看某个网卡(如 eth0):
ifconfig eth0
ip 命令(Debian 默认自带)ip addr
或简写:
ip a
找到你的网卡(如 eth0、ens33、wlan0),inet 后面就是 IP。
只看 IPv4:
ip -4 addr
curl ifconfig.me
或
curl icanhazip.com
如果你是刚装好的 Debian 最小化系统,ifconfig 一般是没有的,建议直接用 ip a。