ifconfig command
LINUX-Frequently used commands
ifconfig command Checking the operational status of network interfaces |
Syntax |
ifconfig [ Interfaces] [Option] |
The ifconfg command is used to display and configure information about network interfaces. If you run the ifconfg command with a network interface as argument, it will display the current settings for that network interface. If the network interface is specified as an argument to the ifconfg command, the current settings for that network interface will be displayed. You can change the configuration of a network interface by specifying the network interface and options as arguments. However, only the super user (root) can change the settings. |
Frequently used options |
<IP address> Setting the IP address of the network interface down Disable the network interface up Enabling the network interface netmask <Netmask address> Setting the netmask for a network interface broadcast <Broadcast address> Setting the broadcast address of a network interface |
Example: Display network interface information. |
$ ifconfig eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.11.52 netmask 255.255.255.0 broadcast 192.168.11.255 inet6 fe80::ec4:7aff:fe05:a326 prefixlen 64 scopeid 0x20<link> ether 0c:c4:7a:05:a3:26 txqueuelen 1000 (Ethernet) RX packets 6364988 bytes 979848077 (934.4 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 16732822 bytes 23431364693 (21.8 GiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 device interrupt 20 memory 0xf6200000-f6220000lo: 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 1239 bytes 3526991 (3.3 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 1239 bytes 3526991 (3.3 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0. |
Example: Display information by specifying a network interface |
$ ifconfig eth0 ← Run with eth0 eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.11.52 netmask 255.255.255.0 broadcast 192.168.11.255 inet6 fe80::ec4:7aff:fe05:a326 prefixlen 64 scopeid 0x20<link> ether 0c:c4:7a:05:a3:26 txqueuelen 1000 (Ethernet) RX packets 6377512 bytes 981145556 (935.6 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 16750749 bytes 23454621731 (21.8 GiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 device interrupt 20 memory 0xf6200000-f6220000 |