如何查看CentOS Linux上面的IP地址信息(主要针对CentOS 7.x)
来源:中国U网 日期:2018-01-19 类别:服务器问题 点击:5174
“用过Linux的很多都知道查看IP的命令是ifconfig,但是这个在CentOS 7.x默认是不存在的命令,那如何来查看CentOS 7的IP信息呢? ”
对于CentOS 5.x, 6.x,来说,查看IP信息的命令是ifconfig,这个命令是在系统里面默认就带的,但是自从有了CentOS 7之后,很多人发现这个命令不存在了,执行ipconfig命令之后是这样的。
[root@localhost ~]# ipconfig
-bash: ipconfig: command not found
那如何来查看CentOS 7的IP信息呢?
# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
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: enp5s0f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
link/ether 00:1b:21:bb:f9:fc brd ff:ff:ff:ff:ff:ff
inet 192.168.1.10/29 brd 192.168.1.15 scope global enp5s0f0
valid_lft forever preferred_lft forever
inet6 fe80::21b:21ff:febb:f9fc/64 scope link
valid_lft forever preferred_lft forever
3: enp1s0f0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN qlen 1000
link/ether 00:25:90:35:de:e4 brd ff:ff:ff:ff:ff:ff
4: enp1s0f1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN qlen 1000
link/ether 00:25:90:35:de:e5 brd ff:ff:ff:ff:ff:ff
5: enp5s0f1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN qlen 1000
link/ether 00:1b:21:bb:f9:fd brd ff:ff:ff:ff:ff:ff
在这里,我们看到了5个网络设备,enp5s0f0上面的192.168.1.10/29就是我们的IP地址。
另外还可以安装iconfig命令,首先需要知道哪个工具包里面有iconfig命令,如果不知道的话,可以用yum provides ifconfig 来查看,通过此命令知道是net-tools
# yum install net-tools
安装好之后,我们熟悉的iconfig命令就可以用了
# ifconfig
enp1s0f0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 00:25:90:35:de:e4 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device memory 0xfbbe0000-fbbfffff
enp1s0f1: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 00:25:90:35:de:e5 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device memory 0xfbb60000-fbb7ffff
enp5s0f0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.10 netmask 255.255.255.248 broadcast 192.168.1.10
inet6 fe80::21b:21ff:febb:f9fc prefixlen 64 scopeid 0x20<link>
ether 00:1b:21:bb:f9:fc txqueuelen 1000 (Ethernet)
RX packets 23465 bytes 25373312 (24.1 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 19151 bytes 3629457 (3.4 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
enp5s0f1: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 00:1b:21:bb:f9:fd txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 0 (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
关键词:查看IP信息,CentOS 7.x,ifconfig,ip addr
如何查看CentOS Linux上面的IP地址信息(主要针对CentOS 7.x)为中国U网原创文章,在不经过允许的情况下,禁止用于商业用途或随意转载,转载请注明出处,并加上本页链接地址:
http://www.cuwww.com/help/detail-79.html
如何查看CentOS Linux上面的IP地址信息(主要针对CentOS 7.x)为中国U网原创文章,在不经过允许的情况下,禁止用于商业用途或随意转载,转载请注明出处,并加上本页链接地址:
http://www.cuwww.com/help/detail-79.html
服务器推荐
香港服务器租用:
E3-1230 / 8G / 1TB / 10M = 700元
美国洛杉矶服务器租用:
i3-4130 / 4G / 1TB / 30M=500元
荷兰服务器租用:
E3-1230/8G/4x1T/1G/100TB=680元
瑞典斯德哥尔摩服务器租用:
E3-1240 / 16G / 1T或250GB SSD / 1Gbps=950元
香港服务器租用:
E3-1230 / 8G / 1TB / 10M = 700元
美国洛杉矶服务器租用:
i3-4130 / 4G / 1TB / 30M=500元
荷兰服务器租用:
E3-1230/8G/4x1T/1G/100TB=680元
瑞典斯德哥尔摩服务器租用:
E3-1240 / 16G / 1T或250GB SSD / 1Gbps=950元
- 把Python程序编译成Windows可执行文件exe的工具pyinstaller
- 解决:Could not resolve host: mirrorlist.centos.org; Unknown error解决方法
- 宝塔安装PHP的Swoole扩展的时候,CentOS 7提示No package 'libbrotlienc' found的解决方法
- ModuleNotFoundError: No module named 'PIL'解决方法
- 在Linux服务器上手动生成自签名证书
- Python数据类型中比较有趣的事情
- CentOS Linux下更换为阿里云的源repo
- Linux上安装宝塔BT面板企业版破解版(开心版9.0.0/9.1.0/9.2.0)
- Linux上如何卸载宝塔(BT)面板?
- 宝塔(BT)忘记BasicAuth身份验证密码怎么办?
- Windows11家庭版 出现身份验证错误。要求的函数不受支持,这可能是由于 CredSSP 加密数据库修正 错误解决办法
- 宝塔(BT)面板打不开,但网站可以打开的解决办法