方法一:通过hostname命令
进查看IPv4地址
[root@sre01 ~]# hostname -I
192.168.236.100
同时查看IPv6地址
[root@sre01 ~]# hostname -i
fe80::efee:7ca0:acf0:ad72%ens33 192.168.236.100
方法二:通过ip命令
[root@sre01 ~]# ip a show ens33
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:0c:29:c0:78:d1 brd ff:ff:ff:ff:ff:ff
inet 192.168.236.100/24 brd 192.168.236.255 scope global noprefixroute ens33
valid_lft forever preferred_lft forever
inet6 fe80::efee:7ca0:acf0:ad72/64 scope link noprefixroute
valid_lft forever preferred_lft forever
方法三:通过ifconfig命令
[root@sre01 ~]# ifconfig ens33
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.236.100 netmask 255.255.255.0 broadcast 192.168.236.255
inet6 fe80::efee:7ca0:acf0:ad72 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:c0:78:d1 txqueuelen 1000 (Ethernet)
RX packets 12510 bytes 4363658 (4.1 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 6591 bytes 1836503 (1.7 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0