Linux Comm Ifconfig
[ Linux Command Manual](#)
The Linux ifconfig command is used to display or configure network devices.
ifconfig can set the status of a network device or display the current configuration.
### Syntax
ifconfig [add][del][<hw][io_addr][tunnel][-broadcast][-pointopoint]
**Parameter Description**:
* add Set the IPv6 IP address for the network device.
* del Delete the IPv6 IP address for the network device.
* down Disable the specified network device.
* <hw Set the type and hardware address of the network device.
* io_addr Set the I/O address for the network device.
* irq Set the IRQ for the network device.
* media Set the media type for the network device.
* mem_start Set the starting memory address used by the network device in main memory.
* metric Specify the number to add when calculating the number of packet hops.
* mtu Set the MTU (Maximum Transmission Unit) for the network device.
* netmask Set the subnet mask for the network device.
* tunnel Create a tunnel communication address between IPv4 and IPv6.
* up Enable the specified network device.
* -broadcast Treat packets destined for the specified address as broadcast packets.
* -pointopoint Establish a direct connection with the network device at the specified address. This mode has confidentiality features.
* -promisc Disable or enable promiscuous mode for the specified network device.
* Specify the IP address for the network device.
* Specify the name of the network device.
### 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)
Enable or disable a specified network card
# ifconfig eth0 down# ifconfig eth0 up
Configure and remove IPv6 addresses for a network card
# ifconfig eth0 add 33ffe:3240:800:1005::2/ 64 //Set IPv6 address for the network card# ifconfig eth0 del 33ffe:3240:800:1005::2/ 64 //Delete IPv6 address for the network card
Use ifconfig to modify the MAC address
# ifconfig eth0 down //Disable the network card# ifconfig eth0 hw ether 00:AA:BB:CC:DD:EE //Modify the MAC address# ifconfig eth0 up //Enable the network card# ifconfig eth1 hw ether 00:1D:1C:1D:1E //Disable the network card and modify the MAC address # ifconfig eth1 up //Enable the network card
Configure IP address
# ifconfig eth0 192.168.1.56 //Configure IP address for eth0 network card# ifconfig eth0 192.168.1.56 netmask 255.255.255.0 // Configure IP address for eth0 network card and add subnet mask# ifconfig eth0 192.168.1.56 netmask 255.255.255.0 broadcast 192.168.1.255// Configure IP address for eth0 network card, add subnet mask, and add a broadcast address
Enable and disable ARP protocol
# ifconfig eth0 arp //Enable# ifconfig eth0 -arp //Disable
Set Maximum Transmission Unit
# ifconfig eth0 mtu 1500 //Set the maximum data packet size to 1500 bytes
[ Linux Command Manual](#)
YouTip