Network Interface Configuration (ifconfig) in Linux

ifconfig command


The “ifconfig” or interface configuration command is used for displaying and configuring the network configuration information like ip address, broadcast address, netmask etc.

ifconfig is used to configure the system's 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.



network interface ifconfig


View all network setting

[ved@pagelinux  ~ ]$ ifconfig

Example of ifconfig output

[ved@pagelinux  ~ ]$ ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0B:A6:1D:38:58
              inet addr:192.168.25.126  Bcast:192.168.25.01  Mask:255.255.255.0
              inet6 addr: fa89::b0b:3d0f:021e:188a/64 Scope:Link
             UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
             RX packets:3012985229 errors:643 dropped:0 overruns:0 frame:643
             TX packets:2799126081 errors:0 dropped:0 overruns:0 carrier:0
             collisions:0 txqueuelen:1000
             RX bytes:3261659953 (3.0 GiB)  TX bytes:1629354666 (1.5 GiB)
             Interrupt:169 Memory:f4000000-f4012100


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:43718676 errors:0 dropped:0 overruns:0 frame:0
           TX packets:43718676 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:0
           RX bytes:34413473 (32.8 MiB)  TX bytes:34413473 (32.8 MiB)


Different options to view and configure Network Interface using ifconfig

To view all network interface information


[ved@pagelinux  ~ ]$ ifconfig –a


For a Specific interface eth0


[ved@pagelinux  ~ ]$ ifconfig eth0


Enabling a Network Interface


[ved@pagelinux  ~ ]$ ifconfig eth0 up

[ved@pagelinux  ~ ]$ ifup eth0


Disabling a Network Interface


[ved@pagelinux  ~ ]$ ifconfig eth0 down

[ved@pagelinux  ~ ]$ ifdown eth0


Adding new Alias eth0:0 to Network Interface


[ved@pagelinux  ~ ]$ ifconfig eth0:0 192.168.25.17


Assigning an IP, Netmask and Broadcast to Network Interface eth0


[ved@pagelinux  ~ ]$ ifconfig eth0 192.168.25.15 netmask 255.255.255.0 broadcast 192.168.25.01


Assign an IP Address to Network Interface eth0


[ved@pagelinux  ~ ]$ ifconfig eth0 192.168.25.15


Assign a Netmask to Network Interface eth0


[ved@pagelinux  ~ ]$ ifconfig eth0 netmask 255.255.255.0


Assign a Broadcast to Network Interface eth0


[ved@pagelinux  ~ ]$ ifconfig eth0 broadcast 192.168.25.01






No comments: