Easy Tutorial
❮ Linux Comm Mkdir Linux Comm Which ❯

Linux ifconfig Command

Linux Command Manual

The Linux ifconfig command is used to display or configure network devices.

ifconfig can set the state of network devices or display the current settings.

Syntax

ifconfig [network device][down up -allmulti -arp -promisc][add<address>][del<address>][&lt;hw&lt;network device type>&lt;hardware address>][io_addr&lt;I/O address>][irq&lt;IRQ address>][media&lt;network media type>][mem_start&lt;memory address>][metric<number>][mtu<bytes>][netmask&lt;subnet mask>][tunnel<address>][-broadcast<address>][-pointopoint<address>][IP address]

Parameter Description:

Examples

Display network device information

# ifconfig        
eth0   Link encap:Ethernet HWaddr 00:50:56:0A:0B:0C 
     inet addr:192.168.0.3 Bcast:192.168.0.255 Mask:255.255.255.0
     inet6 addr: fe80::250:56ff:fe0a:b0c/64 Scope:Link
     UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
     RX packets:172220 errors:0 dropped:0 overruns:0 frame:0
     TX packets:132379 errors:0 dropped:0 overruns:0 carrier:0
     collisions:0 txqueuelen:1000 
     RX bytes:87101880 (83.0 MiB) TX bytes:41576123 (39.6 MiB)
     Interrupt:185 Base address:0x2024 

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

Start and stop a specified network interface

# ifconfig eth0 down
# ifconfig eth0 up

Configure and remove an IPv6 address for a network interface

# ifconfig eth0 add 33ffe:3240:800:1005::2/ 64 //Set IPv6 address for the network interface

# ifconfig eth0 del 33ffe:3240:800:1005::2/ 64 //Remove IPv6 address for the network interface
# ifconfig eth0 down // Turn off the network card
# ifconfig eth0 hw ether 00:AA:BB:CC:DD:EE // Modify the MAC address
# ifconfig eth0 up // Start the network card
# ifconfig eth1 hw ether 00:1D:1C:1D:1E // Turn off the network card and modify the MAC address
# ifconfig eth1 up // Start the network card

Configure IP address

# ifconfig eth0 192.168.1.56
// Configure the IP address for eth0 network card
# ifconfig eth0 192.168.1.56 netmask 255.255.255.0
// Configure the IP address for eth0 network card, and add the subnet mask
# ifconfig eth0 192.168.1.56 netmask 255.255.255.0 broadcast 192.168.1.255
// Configure the IP address for eth0 network card, add the subnet mask, and add the broadcast address

Enable and disable ARP protocol

# ifconfig eth0 arp  // Enable
# ifconfig eth0 -arp  // Disable

Set the maximum transmission unit

# ifconfig eth0 mtu 1500
// Set the maximum packet size to 1500 bytes

Linux Command Manual

❮ Linux Comm Mkdir Linux Comm Which ❯