Ifconfig
lastmod 2026-01-05created 2015-01-1511 edits
ifconfig (short for interface configuration) is a system administration utility in Unix-like operating systems to configure, control, and query TCP/IP network interface parameters from a command line interface (CLI) or in system configuration scripts. Ifconfig originally appeared in 4.2BSD as part of the BSD TCP/IP suite.
In other words, it is a command for configuring or checking the network interfaces installed in the current system.
Synopsis
Example
If you want to set an IP address on the eth0 device, proceed as follows.
## IPADDR=192.168.0.10, NETMASK=255.255.255.0, BROADCAST=192.168.0.255 를 예로 든다.
ifconfig eth0 192.168.0.10 netmask 255.255.255.0 broadcast 192.168.0.255 up
Check your global IP
You can check your global IP with the curl ifconfig.me command.
Linux internet access
Using ifconfig, enter the device to enable as follows.
Static IP config
- How to configure static IP address on CentOS 6.5 minimal
- CentOS 6.4 SSH server installation & configuration & connection
CentOS7 : Change network interface name
Starting with CentOS 7, names are generated by combining BIOS device names. In other words, even if every server has the same network interface card, the network interface names on CentOS 7 can all be different.
For reference, the default network interface name on CentOS 7 is enp0s3. Older Linux systems commonly use eth0.
The way to change it is to declare in grub that BIOS device names should not be used as network interface names. To avoid the inconvenience of having to set the grub parameter again whenever the kernel is upgraded, change grub's default configuration.
Append net.ifnames=0 biosdevname=0 to the end of GRUB_CMDLINE_LINUX in the /etc/default/grub file. Watch the spacing. Then regenerate GRUB as follows.
Troubleshooting
How to fix ifconfig-related problems.
ifconfig command not found
If ifconfig does not exist, install it on Red Hat-based systems as follows.
See also
- ipconfig
- ip
- netplan - If you want to set a static IP on Ubuntu, see Netplan#How to set a static IP.
Favorite site
- Wikipedia (en) description of ifconfig
- [Recommended] Interface Configuration Files
- VirtualBox Linux internet connection
- Network configuration for CentOS installed on VIrtualbox 1
- How to setup network after RHEL/CentOS 7 minimal installation
- CentOS network configuration
- How to use ifconfig and netstat after a CentOS7 minimal install, and how to change the sshd port
- How to Configure the Network Interface File Automatically for Red Hat Linux
- CentOS: Setting IP with ifconfig and ifcfg-eth0
- How to use ifconfig
References
-
CentOS_7_-Change_network_interface_name-_Voyager_of_Linux.pdf ↩