多种方法在ubuntu系统上查看ip地址 |
您所在的位置:网站首页 › 获取ip指令 › 多种方法在ubuntu系统上查看ip地址 |
参考: https://www.howtouseubuntu.com/network/ubuntu-command-terminal-find-ip-address-in-ubuntu/ 当使用命令行在Ubuntu系统上获取IP地址时,以下是几个示例: 使用ip命令获取IP地址: $ ip addr show示例输出: 1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever 2: eth0: mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 inet 192.168.1.10/24 brd 192.168.1.255 scope global dynamic eth0 valid_lft 86400sec preferred_lft 86400sec在上述示例中,eth0接口的IP地址是192.168.1.10。 使用ifconfig命令获取IP地址: $ ifconfig示例输出: eth0: flags=4163 mtu 1500 inet 192.168.1.10 netmask 255.255.255.0 broadcast 192.168.1.255 inet6 fe80::a00:27ff:fe5c:ebac prefixlen 64 scopeid 0x20 ether 08:00:27:5c:eb:ac txqueuelen 1000 (Ethernet) RX packets 26284 bytes 2144348 (2.1 MB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 24776 bytes 1939930 (1.9 MB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73 mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10 loop txqueuelen 1000 (Local Loopback) RX packets 1558 bytes 115900 (115.9 KB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 1558 bytes 115900 (115.9 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0在上述示例中,eth0接口的IP地址是192.168.1.10。 使用hostname命令获取主机名和IP地址: $ hostname -I示例输出: 192.168.1.10在上述示例中,主机的IP地址是192.168.1.10。 这些示例演示了如何使用命令行在Ubuntu系统上获取IP地址。根据你的系统配置和网络接口,IP地址可能会有所不同。 |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |