在linux系统中,如果在没有安装图形界面的情况下查看本地的IP信息是需要使用ssh命令的,下面73so博客就说说在linux系统中使用ssh命令来查看本地IP地址的方法。
在linux系统中可以使用下面的命令来查看本机的IP信息
[root@VM-16-2-centos ~]# ifconfig -aeth0: flags=4163 mtu 1500 inet 101.0.16.2 netmask 255.255.252.0 broadcast 10.06.19.255 inet6 fe80::5065:ff:fe86:1c3e prefixlen 64 scopeid 0x20 ether 52:54:00:86:1c:3e txqueuelen 1000 (Ethernet) RX packets 180739870 bytes 32038251651 (29.8 GiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 179462128 bytes 32270236620 (30.0 GiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0lo: 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 13125 bytes 1585429 (1.5 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 13125 bytes 1585429 (1.5 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0注意:输出结果中的inet 则为当前主机的IP地址
如果你的系统中无法使用ifconfig命令,可以通过下面的命令进行安装
[root@VM-16-2-centos ~]# yum -y install net-tools已加载插件:fastestmirror, langpacksRepository epel is listed more than once in the configurationLoading mirror speeds from cached hostfile
查看ifconfig版本号
ifconfig eth0 up # 启动网卡eth0ifconfig eth0 down # 关闭网卡eth0
显示网卡信息
[root@VM-16-2-centos ~]# ifconfig eth0 #单独显示eth0网卡信息eth0: flags=4163 mtu 1500 inet 101.0.16.2 netmask 255.255.252.0 broadcast 10.06.19.255 inet6 fe80::5065:ff:fe86:1c3e prefixlen 64 scopeid 0x20 ether 52:54:00:86:1c:3e txqueuelen 1000 (Ethernet) RX packets 180756415 bytes 32048131066 (29.8 GiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 179476989 bytes 32273313924 (30.0 GiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0以上就是linux系统中ifconfig的使用命令,当然此命令除了上面所说的几个查询方法外,还可以新增网卡IP地址,修改MAC地址以及删除IP地址等功能,各位可以搜索一下。
可通过以下几种方式联系或关注我们!
联系我们
可通过以下几种方式联系或关注我们!
Q Q:540344537
微信:mowu1086
链接:
关注我们
本文地址: https://www.earthnavs.com/jishuwz/2f3d7c4497cd0513edb2.html