无论使用什么系统,都有用到ip地址的时候,习惯了windows系统的人很容易就能查找出系统的ip,但是在linux系统如何查看ip呢?作为Linux新手,以Ubuntu的使用经验,我知道Ubuntu查看IP有两种方式。
第一种是在终端中使用命令“ifconfig -a”,如果提示找不到“ifconfig”,根据提示安装“net-tools”,运行命令“sudo apt install net-tools”即可安装。,然后再运行命令“ifconfig -a”就可以查看网络连接信息了。但是这种方式有个缺点,正常情况下,只会有两组连接信息,你看不是“lo”的那一组就好了。如果你安装了一些会自动下载插件的软件,使用命令可能就会出现很多组网络信息,不熟悉系统的朋友可能不知道应该看那一个。
第二种方式是直接在“网络”里面查看网络连接情况。“设置->网络->有线连接”。点击“有线连接”后面的设置图标即可看见网络连接情况。根据系统右上角也是可以进入到网络里面去的,点击右上角,然后点击“有线设置”。

命令运行记录:
shenqh@shenqh-virtual-machine:~$ ifconfig -a

Command 'ifconfig' not found, but can be installed with:

sudo apt install net-tools

shenqh@shenqh-virtual-machine:~$ sudo apt install net-tools
[sudo] shenqh 的密码:
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
下列【新】软件包将被安装:
net-tools
升级了 0 个软件包,新安装了 1 个软件包,要卸载 0 个软件包,有 0 个软件包未被升级。
需要下载 194 kB 的归档。
解压缩后会消耗 803 kB 的额外空间。
获取:1 http://cn.archive.ubuntu.com/ubuntu bionic/main amd64 net-tools amd64 1.60+git20161116.90da8a0-1ubuntu1 [194 kB]
获取:1 http://cn.archive.ubuntu.com/ubuntu bionic/main amd64 net-tools amd64 1.60+git20161116.90da8a0-1ubuntu1 [194 kB]
已下载 11.2 kB,耗时 1分 22秒 (136 B/s)
正在选中未选择的软件包 net-tools。
(正在读取数据库 ... 系统当前共安装有 127724 个文件和目录。)
正准备解包 .../net-tools_1.60+git20161116.90da8a0-1ubuntu1_amd64.deb ...
正在解包 net-tools (1.60+git20161116.90da8a0-1ubuntu1) ...
正在处理用于 man-db (2.8.3-2) 的触发器 ...
正在设置 net-tools (1.60+git20161116.90da8a0-1ubuntu1) ...
shenqh@shenqh-virtual-machine:~$ ifconfig -a
docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255
ether 02:42:07:11:f3:5d txqueuelen 0 (以太网)
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

ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.233.135 netmask 255.255.255.0 broadcast 192.168.233.255
inet6 fe80::f214:e841:e441:a412 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:67:5f:9c txqueuelen 1000 (以太网)
RX packets 22166 bytes 20545268 (20.5 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 10903 bytes 1253345 (1.2 MB)
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 1000 (本地环回)
RX packets 2935 bytes 250130 (250.1 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2935 bytes 250130 (250.1 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

shenqh@shenqh-virtual-machine:~$
————————————————
版权声明:本文为CSDN博主「Mr_ZhangSan」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/sqhren626232/article/details/87707190

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。