智传网优云课堂,专注分享IT技术
与IT技术爱好者一起共同学习进步

CentOS8或RHEL8如何安装ifconfig命令

1. 前言

本文主要讲解如何在CentOS8或RHEL8系统中安装ifconfig命令。
你的RHEL 8 / CentOS 8最小化安装版中没有找到Ifconfig命令吗?RHEL8 / CentOS8的最小安装并没有附带ifconfig命令。参见RHEL 8的新特性

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

RHEL8 / CentOS8如何安装ifconfig命令
注意:ifconfig程序已经过时了!请使用ip addrip 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

在RHEL8或CentOS8系统上如何安装<code>ifconfig</code>命令

3. ifconfig命令使用案例

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

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

ifconfig wlan0
ifconfig eth0

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 promisc
ifconfig eth0 -promisc

3.8 添加网络接口别名

ifconfig eth0:0 172.16.25.127
ifconfig eth0:0 down

4.总结

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

赞(0)
未经允许不得转载:Linux入门学习到精通 » CentOS8或RHEL8如何安装ifconfig命令
分享到: 更多 (0)

学习QQ群:557371664

关注微信公众号自助视频学习

评论 抢沙发

评论前必须登录!