ifconfig: Display network interfaces configurations
August 9th, 2024 12:23 PM Mr. Q Categories: Command
Command: ifconfig
Used to display or configure network interface parameters. It provides details about network interfaces, including IP addresses, MAC addresses, and network statistics.
Sample Command and Output:
$ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.10 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::a00:27ff:fe0a:8c0a prefixlen 64 scopeid 0x20<link>
ether 08:00:27:0a:8c:0a txqueuelen 1000 (Ethernet)
RX packets 1234 bytes 567890 (567.8 KB)
TX packets 567 bytes 123456 (123.5 KB)
interrupt 20
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 123 bytes 4567 (4.5 KB)
TX packets 123 bytes 4567 (4.5 KB)
Description:
ifconfig
: Displays information about all active network interfaces. The output includes:- Interface Name: (e.g.,
eth0
,lo
) - Flags: Indicates the status and capabilities of the interface (e.g.,
UP
,BROADCAST
). - IP Address: The assigned IP address (e.g.,
192.168.1.10
). - Netmask: Subnet mask (e.g.,
255.255.255.0
). - MAC Address: Physical address (e.g.,
08:00:27:0a:8c:0a
). - RX/TX Packets: Number of received and transmitted packets.
- Interrupt: IRQ number used by the interface.
Additional Usage Examples:
ifconfig eth0
: Display information only for theeth0
interface. Sample Command and Output:
$ ifconfig eth0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.10 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::a00:27ff:fe0a:8c0a prefixlen 64 scopeid 0x20<link>
ether 08:00:27:0a:8c:0a txqueuelen 1000 (Ethernet)
RX packets 1234 bytes 567890 (567.8 KB)
TX packets 567 bytes 123456 (123.5 KB)
interrupt 20
ifconfig -a
: Display information about all interfaces, including inactive ones. Sample Command and Output:
$ ifconfig -a
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.10 netmask 255.255.255.0 broadcast 192.168.1.255
...
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
...
Note: ifconfig
is deprecated on some Linux distributions in favor of ip
command. Use ip addr
for similar functionality:
Command: ip addr
Sample Command and Output:
$ ip addr
Description:
ip addr
: Provides detailed information about network interfaces, including IP addresses and additional details.