English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Linux ifconfig command is used to display or set network devices.
ifconfig can set the status of the network device or display the current settings.
ifconfig [Network Device][down up -allmulti -arp -promisc][add<address>][del<address>][<hw<Network Device Type><Hardware Address>][io_addr<I/O address>][irq<IRQ address>][media<Network Media Type>][mem_start<Memory Address>][metric<Number>][mtu<Bytes>][netmask<Subnet Mask>][tunnel<address>][-broadcast<address>][-pointopoint<address>][IP address]
Parameter Description:
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 specified network card
# ifconfig eth0 down # ifconfig eth0 up
Configure and delete IPv for network card6Address
# ifconfig eth0 add 33ffe:3240:800:1005::2/ 64 //Set IPv for network card6Address # ifconfig eth0 del 33ffe:3240:800:1005::2/ 64 //Delete IPv for network card6Address
Modify MAC address using ifconfig
# ifconfig eth0 down //Close network card # ifconfig eth0 hw ether 00:AA:BB:CC:DD:EE //Modify MAC Address # ifconfig eth0 up //Start network card # ifconfig eth1 hw ether 00:1D:1C:1D:1E //Close network card and modify MAC address # ifconfig eth1 up //Start 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 //Open # ifconfig eth0 -arp //Close
Set the Maximum Transmission Unit
# ifconfig eth0 mtu 1500 //Set the maximum packet size that can be passed through 1500 bytes