001、利用net-tools工具下的 ifoconfig命令
root@ubuntu01:/home/software# ifconfig | head -n 3 ens32: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.186.134 netmask 255.255.255.0 broadcast 192.168.186.255 inet6 fe80::5e5e:ac9b:46ad:b6a0 prefixlen 64 scopeid 0x20<link>
002、利用ip addr命令
root@ubuntu01:/home/software# 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: ens32: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000 link/ether 00:0c:29:8c:4d:05 brd ff:ff:ff:ff:ff:ff altname enp2s0 inet 192.168.186.134/24 brd 192.168.186.255 scope global dynamic noprefixroute ens32 valid_lft 1679sec preferred_lft 1679sec inet6 fe80::5e5e:ac9b:46ad:b6a0/64 scope link noprefixroute valid_lft forever preferred_lft forever
003、利用hostname -I命令
root@ubuntu01:/home/software# hostname -I 192.168.186.134
004、利用ip route命令
root@ubuntu01:/home/software# ip route get 1.2.3.4 | awk '{print $7}' 192.168.186.134
005、
root@ubuntu01:/home/software# nmcli -p device show
标签:00,IP,forever,192.168,lft,ff,linux,home,本机 From: https://www.cnblogs.com/liujiaxin2018/p/16704583.html