Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the common command ifconfig in Linux

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article is to share with you about how to use the common command ifconfig in Linux. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Linux common commands ifconfig commands are used to display or set network devices, and ifconfig can set the status of network devices or display current settings

Syntax ifconfig [Network device] [down up-allmulti-arp-promisc] [add] [del] [] [io_addr] [irq] [media] [mem_start] [metric] [mtu] [netmask] [tunnel] [- broadcast] [- pointopoint] [IP address] Parameter description:

Add sets the IP address of the network device IPv6.

Del deletes the IP address of the network device IPv6.

Down shuts down the specified network device.

Set the type and hardware address of the network device.

Io_addr sets the Istroke O address of the network device.

Irq sets the IRQ of the network device.

Media sets the media type of the network device.

Mem_start sets the starting address occupied by the network device in the main memory.

Metric specifies the number to be added when calculating the number of forwarding packets.

Mtu sets the MTU of the network device.

Netmask sets the subnet mask for network devices.

Tunnel establishes a tunnel communication address between IPv4 and IPv6.

Up starts the specified network device.

-broadcast treats packets to be sent to the specified address as broadcast packets.

-pointopoint establishes a direct connection with the network device at the specified address. This mode has the function of confidentiality.

-promisc turns off or starts the promiscuous mode of the specified network device.

[IP address] specifies the IP address of the network device.

[network device] specifies the name of the network device.

Example displays 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: 1CPT 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) starts and shuts down the specified network card

# ifconfig eth0 down # ifconfig eth0 up configure and delete IPv6 addresses for network cards

# ifconfig eth0 add 33ffe:3240:800:1005::2/ 64 / / set the IPv6 address for the network card # ifconfig eth0 del 33ffe:3240:800:1005::2/ 64 / / delete the IPv6 address for the network card and modify the MAC address with ifconfig

# ifconfig eth0 down / / close 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 eth2 hw ether 00:1D:1C:1D:1E / / close the network card and modify the MAC address # ifconfig eth2 up / / start the network card configuration 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 eth0 network card with IP address and add a submask # ifconfig eth0 192.168.1.56 netmask 255.255.255.0 broadcast 192.168.1.255 / configure eth0 network card with IP address, add a submask, plus a broadcast address to enable and disable ARP protocol

# ifconfig eth0 arp / / enable # ifconfig eth0-arp / / disable setting the maximum transmission unit

# ifconfig eth0 mtu 1500 / / set the maximum big data package size to 1500 bytes. Thank you for reading! This is the end of the article on "how to use ifconfig in Linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report