Linux command Learning (+): ifconfig command

Source: Internet
Author: User

Copyright Notice Update:2017-05-22
Bo Master: Luckyalan
Contact: [Email protected]
Statement: Draft not forget to dig well man, reproduced please indicate the source!

1 Article Introduction

We know that in Windows, in addition to the graphical interface to find the IP address, we can also use "ipconfig" at the command line to view IP address or other network information, in Linux, we use "ifconfig".

Ifconfig (interface Configuration) is a system management tool that configures, controls, and queries TCP/IP network interfaces in a UNIX-like operating system, either at the command-line interface or in a system configuration script. Often used to set the IP address and subnet mask of an interface, disable or enable interfaces, and so on.

2. Development platform

Linux systems.

3. Reading instructions

No

4 Article Body 4.1 Command 4.1.1 Command

Command format: ifconfig [network device] [parameters]
Command function: Used to view and configure network devices, which can be configured to respond to the network when the network environment changes.

4.1.2 Parameters
    • Up: Starts the specified network device/NIC.
    • Down: Turn off the specified network device/NIC. This parameter can effectively block the IP traffic through the specified interface, and if you want to permanently shut down an interface, we also need to remove all the routing information from the core routing table from that interface.
    • ARP: Sets whether the NIC supports ARP protocol.
      -promisc sets whether the promiscuous mode of the NIC is supported, and if this parameter is selected, the NIC will receive all packets sent to it on the network.
      -allmulti Settings Support multicast mode, if you select this parameter, the NIC will receive all multicast packets in the network.
      -A displays all interface information.
      -S Displays summary information (similar to netstat-i).
    • Add: Configures the IPV6 address for the specified NIC.
    • Del: Delete the IPV6 address of the specified network card
    • MTU < number of bytes;: Sets the maximum Transmission Unit (bytes) of the NIC.
    • netmask < subnet mask;: Sets the subnet mask for the network card.
    • Tunel: Establish a tunnel.
    • DSTADDR: Set a remote address to establish point-to-point communication.
      -broadcast < address: Set the broadcast protocol for the specified network card.
      -pointtopoint < address: Set up point-to-point communication protocol for network card
    • Multicast: Sets the multicast identity for the network card.
    • Address: Setting IPV4 addresses for network cards
    • Txqueuelen < length: Set the length of the transmission queue for the network card
4.2 Command Instance 4.2.1 Display Network device information (active state)

Command: ifconfig

Description

BusyBox: This is a gadget, please see "for details."

Eth0: Represents the first NIC.

    • HWADDR: Represents the physical address of the network card, you can see the current physical address of the network card is: ce:fc:ce:94:95:31.
    • inet addr: Used to indicate the IP address of the network card, the IP of this network card is: 192.168.204.157.
    • Bcast: Represents the broadcast address of the network card, the broadcast address of this network card is: 192.168.204.255.
    • Mask: Subnet mask, mask address: 255.255.255.0.

Lo: The pensive address of the host, this is generally used to test a network program, but do not want to let the local area network or extranet users can view, only on this host to run and view the network interface used. For example, the HTTPD server is assigned to the bad address, in the browser input 127.0.0.1 will be able to see your Web site. But you can only see that the other host or user of the LAN is unknown.

    • First line: Connection type: Ethernet (Ethernet) HWADDR (Hardware MAC address)
    • Second line: IP address, subnet, mask of network card
    • Third line: Up (for Nic on) RUNNING (network cable on behalf of the NIC is connected) multicast (support multicast) mtu:1500 (Maximum transmission Unit): 1500 bytes
    • Line fourth to fifth: Receive, send packet statistics
    • Line seventh: Receive, send data byte count statistics
4.2.2 Boot off the specified NIC

Start Network card 0 (eth0): ifconfig eth0 up
Turn off NIC 0 (eth0): ifconfig eth0 down

Note that when SSH logs on to a Linux server, be careful when you close it, you won't be able to open it unless you have a multi-net card.

4.2.3 Configuring IP Addresses

Configure IP Address command: ifconfig eth0 192. 168. . About

Configure the IP address and start: ifconfig eth0 192. 168. . + up

4.2.4 Modifying MAC Addresses

Command: ifconfig eth0 hw ether xx:AA:BB:CC:DD:EE

4.2.5 Setting the maximum transmission unit

Command: ifconfig eth0 MTU 1490

Note: The NIC information configured with the Ifconfig command does not exist after the machine restarts after the network card restarts. In order to keep the above configuration information in the computer forever, it is necessary to modify the network card configuration file.

5 References

1, the concept of this part of the reference to Wikipedia
2, "A Linux command per day (ifconfig): Command"

Linux command Learning (+): ifconfig command

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.