linux中ifconfig命令的功能

人气:289 ℃/2022-11-20 23:44:52

linux系统中ifconfig命令的功能是什么呢?下面是具体介绍:

ifconfig命令功能:

ifconfig命令用来查看和配置网络设备。当网络环境发生改变时可通过此命令对网络进行相应的配置。

拓展资料:

linux系统中ifconfig命令详解

1、命令格式:

ifconfig[网络设备][参数]

2、命令功能:

ifconfig命令用来查看和配置网络设备。当网络环境发生改变时可通过此命令对网络进行相应的配置。

3、命令参数:

up启动指定网络设备/网卡。

down关闭指定网络设备/网卡。该参数可以有效地阻止通过指定接口的IP信息流,如果想永久地关闭一个接口,我们还需要从核心路由表中将该接口的路由信息全部删除。

arp设置指定网卡是否支持ARP协议。

-promisc设置是否支持网卡的promiscuous模式,如果选择此参数,网卡将接收网络中发给它所有的数据包

-allmulti设置是否支持多播模式,如果选择此参数,网卡将接收网络中所有的多播数据包

-a显示全部接口信息

-s显示摘要信息(类似于netstat-i)

add给指定网卡配置IPv6地址

del删除指定网卡的IPv6地址

<硬件地址>配置网卡最大的传输单元

mtu<字节数>设置网卡的最大传输单元(bytes)

netmask<子网掩码>设置网卡的子网掩码。掩码可以是有前缀0x的32位十六进制数,也可以是用点分开的4个十进制数。如果不打算将网络分成子网,可以不管这一选项;如果要使用子网,那么请记住,网络中每一个系统必须有相同子网掩码。

tunel建立隧道

dstaddr设定一个远端地址,建立点对点通信

-broadcast<地址>为指定网卡设置广播协议

-pointtopoint<地址>为网卡设置点对点通讯协议

multicast为网卡设置组播标志

address为网卡设置IPv4地址

txqueuelen<长度>为网卡设置传输列队的长度

以上就是小编今天的分享了,希望可以帮助到大家。

linux没有ifconfig命令

新装的Linux系统没有ifconfig命令?教你一键找回

请关注本头条号,每天坚持更新原创干货技术文章。

如需学习视频,请在微信搜索公众号“智传网优”直接开始自助视频学习

1. 前言

ubuntu ifconfig 命令找不到,是因为没有安装对应的软件包 。教大家一个方法,即查询某个命令由哪个软件包提供。

Ubuntu系统

2. 安装apt-file:

zcwyou@ubuntu1804:~$ sudo apt install -y apt-file

安装过程如下,即表示安装成功。

Setting up libapt-pkg-perl (0.1.33build1) …

Setting up libexporter-tiny-perl (1.000000-2) …

Processing triggers for man-db (2.8.3-2ubuntu0.1) …

Setting up libregexp-assemble-perl (0.36-1) …

Setting up liblist-moreutils-perl (0.416-1build3) …

Setting up apt-file (3.1.5) …

The system-wide cache is empty. You may want to run 'apt-file update'

as root to update the cache.

安装apt-file

3. 更新本地缓存

zcwyou@ubuntu1804:~$ sudo apt-file update

需要联网拉取数据,部分输出如下:

Fetched 73.4 MB in 37s (2,002 kB/s)

Reading package lists… Done

Building dependency tree

Reading state information… Done

All packages are up to date.

看到下图证明缓存更新完毕。

使用apt-file更新本地缓存

4. 查找ifconfig命令对应的软件包

zcwyou@ubuntu1804:~$ sudo apt-file search bin/ifconfig

查询结果:

net-tools: /sbin/ifconfig

如下图

查找ifconfig命令对应的软件包

可以看到,ifconfig对应的软件包为net-tools

5. 安装net-tools套件

zcwyou@ubuntu1804:~$ sudo apt install net-tools

按提示输入密码

[sudo] password for zcwyou:

6. 测试ifconfig命令

zcwyou@ubuntu1804:~$ sudo ifconfig

我的服务器输出信息如下:

ens33: flags=4163 mtu 1500

inet 172.16.87.140 netmask 255.255.255.0 broadcast 172.16.87.255

inet6 fe80::20c:29ff:fef1:b5e1 prefixlen 64 scopeid 0x20

ether 00:0c:29:f1:b5:e1 txqueuelen 1000 (Ethernet)

RX packets 5411 bytes 1269368 (1.2 MB)

RX errors 0 dropped 0 overruns 0 frame 0

TX packets 1808 bytes 266933 (266.9 KB)

TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: 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 222 bytes 19922 (19.9 KB)

RX errors 0 dropped 0 overruns 0 frame 0

TX packets 222 bytes 19922 (19.9 KB)

TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

测试ifconfig命令

7. 总结

已经成功安装并使用ifconfig。其实,ifconfig并不是必要安装的,使用Linux命令ip addr也具有同样的效果,如下图。

使用ip addr替代ifconfig

本文已同步至博客站,尊重原创,转载时请在正文中附带以下链接:

https://www.linuxrumen.com/rmxx/952.html

点击了解更多,快速查看更多的技术文章列表。

推荐

首页/电脑版/网名
© 2026 NiBaKu.Com All Rights Reserved.