ifconfig command : Manage network configuration in linux
The most frequent use of ifconfig command is setting an interface’s IP address and netmask, and disabling or enabling a interface.
To see IP address of the machine, open terminal and type ifconfig
It’ll list all the interfaces connected to the device e.g.
root@ubuntu:~$ ifconfig
eth0 Link encap:Ethernet HWaddr 00:1c:23:a4:ed:b0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:160524 errors:0 dropped:0 overruns:0 frame:0
TX packets:59261 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:40668433 (40.6 MB) TX bytes:14468340 (14.4 MB)
Interrupt:17
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:21240 errors:0 dropped:0 overruns:0 frame:0
TX packets:21240 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:3990382 (3.9 MB) TX bytes:3990382 (3.9 MB)
To view a particular interface, provide interface name after ifconfig command.
root@ubuntu:~$ ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:1c:23:a4:ed:b0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:160524 errors:0 dropped:0 overruns:0 frame:0
TX packets:59261 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:40668433 (40.6 MB) TX bytes:14468340 (14.4 MB)
Interrupt:17
here are few more frequent usages of ifconfig
ifconfig eth0 down
This flag causes eth0 interface to be shut down.
ifconfig eth0 up
If interface eth0 is in the down state then by setting this flag will make eth0 interface active.
ifconfig eth0 192.168.1.2 netmask 255.255.255.0 broadcast 192.168.1.20
Assign eth0 with the above values for IP, netmask and broadcast address.
January 21, 2009 | Filed Under Linux
Related Post
Comments
Leave a Reply