Skip to content
Search

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

ifconfig <device> <ipaddresss> netmask <netmask> broadcast <broadcast> [up|down]

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.

$ ifup eth0

Static IP config

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.

grub2-mkconfig -o /boot/grub2/grub.cfg

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.

$ sudo yum install net-tools

See also

Favorite site

References


  1. CentOS_7_-Change_network_interface_name-_Voyager_of_Linux.pdf ↩

author Zer0 sitemap