Skip to content

ifconfig COMMAND

July 24, 2010

ifconfig COMMAND:
ifconfig command displays information about the network interfaces attached to the system and also used to configure the network interface.

SYNTAX:
The Syntax is
ifconfig [options]

OPTIONS:

-a dispalys information about both active and inactive Interface
[interface-name] dispalys information about interface
[interface-name] up Activates the interface
[interface-name] down Inactivates the interface
[interface-name] [IP Address] up Assigns IP address to the interface and activates it

EXAMPLE:

  1. To get information of active network-interfaces:
    ifconfig

    The sample output of above command:

    eth0
    Link encap:Ethernet HWaddr 00:14:85:9C:CC:55
    inet addr:192.168.0.12 Bcast:192.168.0.255 Mask:255.255.255.0
    inet6 addr: fe80::214:85ff:fe9c:cc55/64 Scope:Link
    UP LOOPBACK RUNNING MTU:16436 Metric:1
    RX packets:7856 errors:0 dropped:0 overruns:0 frame:0
    TX packets:7856 errors:0 dropped:0 overruns:0 carrier:0
    RX bytes:492016 (480.4 KiB) TX bytes:398 (398.0 b)
    Interrupt:201 Memory:e1000000-0
    lo
    Link encap:Local Loopback
    inet addr:127.0.0.1 Mask:255.0.0
    inet6 addr: ::1/128 Scope:Host
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:1455 errors:0 dropped:0 overruns:0 frame:0
    TX packets:5 errors:0 dropped:0 overruns:0 carrier:0
    RX bytes:1917382 (1.8 MiB) TX bytes:1917382 (1.8 MiB)
    In above output:
    Link encap:Ethernet -Specifies the type Interface
    HWaddr 00:14:85:9C:CC:55 -Specifies the Hardware or MAC address
    inet addr:192.168.0.12 -Specifies the IP address assigend to network-interface
  2. To Assign IP address to Network Interface[Ethernet Card]:
    ifconfig eth0 192.168.0.12 up

    The above command will Assign IP address 192.168.0.12 to Ethernet card with name eth0.

  3. To inactivate the Network Interface[Ethernet Card]:
    ifconfig eth0 down

    The above command inactivates the ethernet card.

From → Unix

Leave a Comment

Leave a comment