HOWTO: Use Ifconfig.
Ifconfig is probably short for ‘interface configuration’ since its primary use is to manipulate your network interfaces. For all intents and purposes, a network interface is a network card, so I’m just going to call them network cards.
From the ifconfig man page:
Ifconfig is used to configure the kernel-resident network interfaces. It is used at boot time to set up interfaces as necessary. After that, it is usually only needed when debugging or when system tuning is needed.
To get a quick look at all the network cards on your system that are ‘up’ (meaning they are functioning), open a terminal window and type:
ifconfig
On my system, that gives me this:
lan1 Link encap:Ethernet HWaddr 00:03:2F:05:55:03
inet addr:192.168.200.103 Bcast:192.168.200.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2312 errors:0 dropped:0 overruns:0 frame:0
TX packets:2168 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1432020 (1.3 MiB) TX bytes:391013 (381.8 KiB)
Interrupt:10 Base address:0×3000lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:389 errors:0 dropped:0 overruns:0 frame:0
TX packets:389 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:11533 (11.2 KiB) TX bytes:11533 (11.2 KiB)
The first entry is for my wireless card which is named lan1. The second entry is my localhost entry which just points to my own machine. You can tell the localhost entry by its IP address which will always be 127.0.0.1.
You may have more network cards on your machine, but they won’t show if they’re not ‘up’. To see every network card on your system regardless of its status, type:
ifconfig -a
On my system that shows me an additional interface:
lan0 Link encap:Ethernet HWaddr 00:0F:1F:BB:38:C7
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Interrupt:4 Base address:0×1800
This lan0 entry is my ethernet wired connection that I don’t have plugged in right now.
Ifconfig isn’t just for viewing information, there are many switches that you can put after the initial ifconfig to manage your network cards as well.
You may be able to go through your entire GNU/Linux career without ever using the ifconfig command, but if you do need it, you’ll likely need it to being an interface up or down:
ifconfig lan0 up - will bring my ethernet connection up and ready for action.
ifconfig lan0 down - will bring my ethernet connection down and out of action
Use the man ifconfig command to see the plethora of things you can do with ifconfig.
Related entries:
Requesting an IP address
Managing a wireless network card
Related Stories
POSTED IN: How To
0 opinions for HOWTO: Use Ifconfig.
No one has left a comment yet. You know what this means, right? You could be first!
Have an opinion? Leave a comment: