Home  >  Article  >  Computer Tutorials  >  Detailed explanation of the usage of network command ifconfig.

Detailed explanation of the usage of network command ifconfig.

WBOY
WBOYforward
2024-02-18 17:50:241535browse

Detailed explanation of the usage of network command ifconfig.

ifconfig is a commonly used network command used to display and configure network interface information. The following is a detailed explanation of the ifconfig command:

Command format:

ifconfig [网络接口] [选项]

Common options:

  • -a: Display detailed information for all network interfaces (including unenabled interfaces).
  • up: Enable the specified network interface.
  • down: Disable the specified network interface.
  • inet: Displays the IPv4 address.
  • inet6: Display IPv6 address.
  • netmask: Displays the subnet mask.
  • broadcast: displays the broadcast address.
  • hw
    ether: Displays the hardware address (MAC address).
  • promisc: Set the network interface to promiscuous mode.

Example usage:

  1. Display information about all network interfaces:

    ifconfig -a
  2. Enable network interface:

    ifconfig eth0 up
  3. Disable network interface:

    ifconfig eth0 down
  4. Display the IPv4 address and subnet mask of the specified network interface:

    ifconfig eth0 inet
  5. Display the IPv6 address and subnet mask of the specified network interface:

    ifconfig eth0 inet6
  6. Display the broadcast address of the specified network interface:

    ifconfig eth0 broadcast
  7. Display the hardware address (MAC address) of the specified network interface:

    ifconfig eth0 hw ether
  8. Set the specified network interface to promiscuous mode:

    ifconfig eth0 promisc

The ifconfig command provides various information about the network interface, such as IP address, subnet mask, broadcast address, hardware address, etc. By becoming familiar with and using the ifconfig command, you can manage and adjust the configuration of network interfaces. Please note that ifconfig has been replaced by the ip command in some Linux distributions, but it is still one of the commonly used commands on many systems.

The above is the detailed content of Detailed explanation of the usage of network command ifconfig.. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:mryunwei.com. If there is any infringement, please contact admin@php.cn delete