ifconfig 安装_CentOS8或RHEL8安装ifconfig命令

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

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

1. 前言

本文主要讲解如何在CentOS8或RHEL8系统中安装ifconfig命令。

你的RHEL 8 / CentOS 8最小化安装版中没有找到Ifconfig命令吗?RHEL8 / CentOS8的最小安装并没有附带ifconfig命令。参见RHEL 8的新特性

ifconfig是一个命令行工具,用于配置驻留内核的网络接口。使用ifconfig,您可以配置一个网络接口,显示当前可用的所有接口,即使是关闭的。

4db9ef1d840b497343b20d23b64ec048.png

RHEL8 / CentOS8如何安装ifconfig命令

注意:ifconfig程序已经过时了!请使用ip addr和ip link命令。在RHEL 8 / CentOS 8的最小安装上,ifconfig命令由net-tools提供,它是基本的网络管理工具组包。

yum provides ifconfig

Updating Subscription Management repositories.

Updating Subscription Management repositories.

Last metadata expiration check: 21 days, 0:07:56 ago on Fri 30 Nov 2018 03:57:18 AM EST.

net-tools-2.0-0.51.20160912git.el8.x86_64 : Basic networking tools

Repo : @System

Matched from:

Filename : /usr/sbin/ifconfig

net-tools-2.0-0.51.20160912git.el8.x86_64 : Basic networking tools

Repo : rhel-8-for-x86_64-baseos-beta-rpms

Matched from:

Filename : /usr/sbin/ifconfig

2. 在RHEL8或CentOS8系统上如何安装`ifconfig`命令

要获得ifconfig命令,请安装net-tools包:

sudo yum -y install net-tools
e27cd6ced807f37e2c40c87a69053732.png

在RHEL8或CentOS8系统上如何安装ifconfig命令

3. `ifconfig`命令使用案例

3.1 使用`ifconfig`命令显示第一个以太网适配器的网络设置

假设无线网卡为wlan0,有线网卡为etho,请使用ip addr查看当前网卡标识。

ifconfig wlan0ifconfig eth0
9092a7a1ca824fd078eb7e4642df57ec.png

ifconfig命令已过时,请使用ip命令集

3.2 使用`ifconfig`命令显示所有接口信息

ifconfig -a

3.3 使用`ifconfig`命令开启与禁用接口

ifconfig wlan0/eth0 {up|down}

3.4 使用`ifconfig`命令设置静态IP和子网掩码

ifconfig eth0 192.168.1.100 netmask 255.255.255.0

3.5 使用`ifconfig`命令添加网关

route add -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.1.1

3.6 使用`ifconfig`命令修改网卡的MAC地址

ifconfig eth0 hw ether AA:BB:CC:DD:EE:FF

3.7 开启混杂模式

ifconfig eth0 promiscifconfig eth0 -promisc

3.8 添加网络接口别名

ifconfig eth0:0 172.16.25.127ifconfig eth0:0 down

4.总结

通过本文您应该了解到如何在RHEL8或CentOS8上安装ifconfig命令了吗?

33e3e5a5bca3500d1592e839047e0e23.png

CentOS8安装ifconfig命令总结

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值