在 Debian 中查看 IP 地址,常用方法如下:
ifconfig(需安装 net-tools)ifconfig
如果提示 command not found,先安装:
sudo apt update
sudo apt install net-tools
查看某个网卡(如 eth0):
ifconfig eth0
IP 地址在 inet 后面。
ip 命令(默认已安装)ip addr
或简写:
ip a
要只看 IPv4:
ip -4 addr
curl ifconfig.me
或
curl icanhazip.com
如果你是最小化 Debian 系统,建议直接用 ip a,比 ifconfig 更现代也更常用。