Do you get 'Ifconfig' Command Not Found
in your RHEL 8 / CentOS 8 minimal server installation?. The minimal installation of RHEL 8 / CentOS 8 doesn’t come with the ifconfig command.
Ifconfig is a command line tool used to configure the kernel-resident network interfaces. With ifconfig
you can configure a network interface, display all interfaces which are currently available, even if down.
NOTE: The ifconfig
program is obsolete! For replacement check ip addr
and.ip link
commands.
On a Minimal installation of RHEL 8 / CentOS 8, the ifconfig command is provided by the packagenet-tools
, which is Basic networking management tools group package.
$ sudo 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
Install ifconfig on RHEL 8 / CentOS 8
To get ifconfig command, install the net-tools package:
sudo yum -y install net-tools
Ifconfig Usage Cheat sheet
1.
Display network settings of the first ethernet adapter
$ ifconfig wlan0
$ ifconfig eth0
2.
Display all interfaces, even if down:
$ ifconfig -a
3.
Take down / up a network adapter:
$ ifconfig wlan0/eth0 {up|down}
4.
Set a static IP and netmask:
$ ifconfig eth0 192.168.1.100 netmask 255.255.255.0
5.
You may also need to add a gateway IP
$ route add -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.1.1
6.
Change MAC address
$ ifconfig eth0 hw ether AA:BB:CC:DD:EE:FF
7.
Enable Promiscuous Mode
ifconfig eth0 promisc
ifconfig eth0 -promisc
8.
Add New Alias to Network Interface
ifconfig eth0:0 172.16.25.127
ifconfig eth0:0 down
Now you have ifconfig
on your RHEL 8 / CentOS 8 server.