The Ifconfig of Linux commands

Source: Internet
Author: User

Ifconfig [Interface]

Ifconfig interface [Aftype] options | Address ...

Ifconfig is a tool for viewing and configuring network interfaces. Ifconfig configuration information is restored after the network device restarts. To permanently save, go to configuration file configuration.

Address can be inet (TCP/IP, default IPv4), Inet6 (IPV6), ax25 (AMPR packet radio), DDP (Appletalk Phase 2), IPX (Nocell IPX), Netrom (AMPR Packet radio)

Note: CetOS6.8 prompts that this command is obsolete, use the IP command.

(1). Options

Up activate network device down stop network device [enable or disable the ARP protocol on the-]ARP device] [enable or disable promiscuous mode on the-]PROMISC device, if enable will receive all packets [-]allmulti enable or disable multicast mode, If enabled will receive all multicast packets Metric < number > This parameter sets the interface metric, not suitable for gnu/linux. (Specify the number of packets to count when the packet is calculated) MTU < bytes > This parameter sets the maximum transmission unit of the interface netmask < subnet mask > sets the subnet mask for the interface. This entry defaults to the usual Class A, class B, or Class C subnet mask (derived from the interface IP address), but can be set to any value. Add < address > Adding an IPv6 address to interface del < address > Remove a IPV6 address from the interface tunnel:: AA.BB.CC.DD Create a new sit (Ipv6-in-ipv4) device, tunnel connects to the specified target IRQ <IRQ address > Set the interrupt in use for this device. Not all devices can dynamically change their IRQ settings. IO_ADDR <I/O address > Set the start address in the I/O space of this device Mem_start < memory address > Set the starting address of the shared memory used by this device. Only a few devices require this setting. Media < network media type > set the physical port or media type used by the device. Not all devices can change this setting, as well as settings that can change the values they support. [-]broadcast] If the address parameter is given, set the address of the laundry broadcast for this interface. Otherwise set (or clear) the IFF_BROADCAST flag of the interface (the packet to be sent to the specified address is treated as a broadcast packet). [-]pointopoint [address] This keyword enables the point-to-point mode of an interface, which means that it is a direct link between two computers and no one else listens. If the address parameter is given, set the protocol at the other end of the link, otherwise set or clear the Iff_pointopointment flag for the interface. (A direct connection to the network device of the specified address, this mode has a confidentiality function) multicast set the multicast flag on the interface. (usually not required, the driver will set the correct flag itself) address assigns an IP address to the interface

(2). Example

  View Network interfaces

[[email protected] Desktop]# ifconfig//View all running network interfaces (eth1 not networked) eth1 Link encap:ethernet HWaddr 00:0c:29:42:9f:ce          Inet6 addr:fe80::20c:29ff:fe42:9fce/64 scope:link up broadcast RUNNING multicast mtu:1500 metric:1          RX packets:3058 errors:0 dropped:0 overruns:0 frame:0 TX packets:2715 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:355994 (3          47.6 KiB) TX bytes:263751 (257.5 KiB) 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:65536 metric:1 RX packets:12 errors:0 D          ropped:0 overruns:0 frame:0           TX packets:12 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:720 (720.0 b) TX bytes:720 (720.0 b) [[email protected] Desktop]# ifconfig//View all running network interfaces (eth1 networking) eth1 Link E Ncap:ethernet HWaddr 00:0c:29:42:9f:ce inet addr:192.168.78.133 bcast:192.168.78.255 mask:255.255.255.0 inet6 addr:fe80::20c:29ff:fe42:9fce/64 scope:link          Up broadcast RUNNING multicast mtu:1500 metric:1 RX packets:3084 errors:0 dropped:0 overruns:0 frame:0 TX packets:2716 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:357836  (349.4 KiB) TX bytes:264093 (257.9 KiB) lo Link encap:local Loopback inet addr:127.0.0.1 mask:255.0.0.0 ine T6 Addr::: 1/128 scope:host up LOOPBACK RUNNING mtu:65536 metric:1 RX packets:12 errors:0 dropped:0 ov          erruns:0 frame:0           TX packets:12 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:720 (720.0 b) TX bytes:720 (720.0 b) [[email protected] Desktop]# ifconfig eth1//view specified network interface eth1 Link Encap:eth Ernet HWaddr 00:0c:29:42:9f:ce inet addr:192.168.78.133 bcast:192.168.78.255 mask:255.255.255.0 ine T6 Addr: FE80::20C:29FF:FE42:9FCE/64 scope:link up broadcast RUNNING multicast mtu:1500 metric:1 RX packets:30          errors:0 dropped:0 overruns:0 frame:0 TX packets:2716 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:357836 (3 49.4 KiB) TX bytes:264093 (257.9 KiB)

Note: If you want to see all the network interfaces, use ' ifconfig-a '.

The following is a detailed description of the network interface ifconfig display, taking eth1 as an example:

First line: eth1 Link encap:ethernet HWaddr 00:0c:29:42:9f:ce

Eth1 is the name of the network card, link encap:ethernet is the connection type, here is Ethernet (Ethernet), HWaddr 00:0c:29:42:9f:ce is the physical address (MAC address) of the network card.

Second line: inet addr:192.168.78.133 bcast:192.168.78.255 mask:255.255.255.0

Inet addr:192.168.78.133 is the IPV4 address of the network card; bcast:192.168.78.255 is the broadcast address; mask:255.255.255.0 is the subnet mask.

Third line: Inet6 addr:fe80::20c:29ff:fe42:9fce/64 Scope:link

Part may not be, this line is IPV6 address.

Line four: Up broadcast RUNNING multicast mtu:1500 metric:1

Up is the network card is on, (broadcast should be supported broadcast;) running is the network card is running; multicast description supports multicast; mtu:1500 is the maximum Transmission Unit 1500 bytes.

Chapters V line: RX packets:3084 errors:0 dropped:0 overruns:0 frame:0

TX packets:2716 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

These three lines are the statistics that receive and send packets.

Line eighth: RX bytes:357836 (349.4 KiB) TX bytes:264093 (257.9 KiB)

This line is the data byte count that is received and sent.

Note: Lo is the loopback address of the host, which is typically used to test a network program, but does not want the local area network or extranet users to be able to view, can only run on this host and view the network interface used. For example, the HTTPD server is designated to the loopback address, the browser input 127.0.0.1 can see your Web site. But you can only see that the other host or user of the LAN is unknown.

Turn off or turn on the network interface

[[email protected] Desktop]# ifconfig eth1eth1 Link encap:ethernet HWaddr 00:0c:29:42:9f:ce inet addr:192          .168.78.133 bcast:192.168.78.255 mask:255.255.255.0 inet6 addr:fe80::20c:29ff:fe42:9fce/64 scope:link          Up broadcast RUNNING multicast mtu:1500 metric:1 RX packets:5072 errors:0 dropped:0 overruns:0 frame:0 TX packets:4027 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:877465  (856.8 KiB) TX bytes:537369 (524.7 KiB) [[email protected] Desktop]# ifconfig eth1 down//Off network interface [[email protected] Desktop]# ifconfi G eth1eth1 Link encap:ethernet HWaddr 00:0c:29:42:9f:ce inet addr:192.168.78.133 bcast:192.168.78.255 M ask:255.255.255.0 Broadcast Multicast mtu:1500 metric:1//can see up and running has disappeared RX packets:5072 Erro          rs:0 dropped:0 overruns:0 frame:0 TX packets:4027 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1RX bytes:877465 (856.8 KiB) TX bytes:537369 (524.7 KiB) [[email protected] Desktop]# ifconfig eth1 up/ /Open Network interface [[[email protected] Desktop]# ifconfig eth1eth1 Link encap:ethernet HWaddr 00:0c:29:42:9f:ce inet A          ddr:192.168.78.133 bcast:192.168.78.255 mask:255.255.255.0 Inet6 addr:fe80::20c:29ff:fe42:9fce/64 Scope:Link Up broadcast RUNNING multicast mtu:1500 metric:1//up and RUNNING again RX packets:5076 errors:0 dropped          : 0 overruns:0 frame:0 TX packets:4033 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:877987 (8 57.4 KiB) TX bytes:538149 (525.5 KiB)

Configure IPV4 address, subnet mask, and broadcast address

[[email protected] Desktop]# ifconfig eth1eth1 Link encap:ethernet HWaddr 00:0c:29:42:9f:ce inet addr:192          .168.78.133 bcast:192.168.78.255 mask:255.255.255.0 inet6 addr:fe80::20c:29ff:fe42:9fce/64 scope:link          Up broadcast RUNNING multicast mtu:1500 metric:1 RX packets:5123 errors:0 dropped:0 overruns:0 frame:0 TX packets:4035 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:880990  (860.3 KiB) TX bytes:538289 (525.6 KiB) [[email protected] Desktop]# ifconfig eth1 192.168.78.140 netmask 255.255.255.254 broadcast 19 2.168.78.254[[email protected] Desktop]# ifconfig eth1eth1 Link encap:ethernet HWaddr 00:0c:29:42:9f:ce I NET addr:192.168.78.140 bcast:192.168.78.254 mask:255.255.255.254 inet6 addr:fe80::20c:29ff:fe42:9fce/64 Scope : Link up broadcast RUNNING multicast mtu:1500 metric:1 RX packets:5165 errors:0 dropped:0 overruns:0 F      rame:0    TX packets:4052 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:88504 3 (864.2 KiB) TX bytes:541394 (528.7 KiB)

Remove or add IPV6 addresses

[[email protected] Desktop]# ifconfig eth1eth1 Link encap:ethernet HWaddr 00:0c:29:42:9f:ce inet addr:192          .168.78.133 bcast:192.168.78.255 mask:255.255.255.0 inet6 addr:fe80::20c:29ff:fe42:9fce/64 scope:link          Up broadcast RUNNING multicast mtu:1500 metric:1 RX packets:5216 errors:0 dropped:0 overruns:0 frame:0 TX packets:4053 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:888385  (867.5 KiB) TX bytes:541736 (529.0 KiB) [[email protected] Desktop]# ifconfig eth1 del fe80::20c:29ff:fe42:9fce/64[[email   Protected] Desktop]# ifconfig eth1eth1 Link encap:ethernet HWaddr 00:0c:29:42:9f:ce inet addr:192.168.78.133 bcast:192.168.78.255 mask:255.255.255.0 up broadcast RUNNING multicast mtu:1500 metric:1 RX packets:5          241 errors:0 dropped:0 overruns:0 frame:0 TX packets:4053 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1RX bytes:889885 (869.0 KiB) TX bytes:541736 (529.0 KiB) [[email protected] Desktop]# ifconfig eth1 add FE80:            : 20c:29ff:fe42:9fce/64[[email protected] Desktop]# ifconfig eth1eth1 Link encap:ethernet HWaddr 00:0c:29:42:9f:ce inet addr:192.168.78.133 bcast:192.168.78.255 mask:255.255.255.0 inet6 addr:fe80::20c:29ff:fe42:9fce/ Scope:link up broadcast RUNNING multicast mtu:1500 metric:1 RX packets:5241 errors:0 dropped:0 over          runs:0 frame:0 TX packets:4056 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:889885 (8 69.0 KiB) TX bytes:541974 (529.2 KiB)

Modify MAC Address

[[email protected] Desktop]# ifconfig eth1eth1 Link encap:ethernet HWaddr 00:0c:29:42:9f:ce inet addr:192          .168.78.133 bcast:192.168.78.255 mask:255.255.255.0 inet6 addr:fe80::20c:29ff:fe42:9fce/64 scope:link          Up broadcast RUNNING multicast mtu:2000 metric:1 RX packets:5364 errors:0 dropped:0 overruns:0 frame:0 TX packets:4077 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:898649  (877.5 KiB) TX bytes:545368 (532.5 KiB) [[email protected] Desktop]# ifconfig eth1 hw ether 00:aa:bb:cc:dd:ee[[email protected] Desktop]# ifconfig eth1eth1 Link encap:ethernet HWaddr 00:aa:bb:cc:dd:ee inet addr:192.168.78.133 bcast:192.1 68.78.255 mask:255.255.255.0 Inet6 addr:fe80::20c:29ff:fe42:9fce/64 scope:link up broadcast RUNNING MU          Lticast mtu:2000 metric:1 RX packets:5385 errors:0 dropped:0 overruns:0 frame:0 TX packets:4077 errors:0 dropped:0overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:899909 (878.8 KiB) TX bytes:545368 (532.5 K IB)

Modify Maximum Transmission unit

[[email protected] Desktop]# ifconfig eth1eth1 Link encap:ethernet HWaddr 00:0c:29:42:9f:ce inet addr:192          .168.78.133 bcast:192.168.78.255 mask:255.255.255.0 inet6 addr:fe80::20c:29ff:fe42:9fce/64 scope:link          Up broadcast RUNNING multicast mtu:1500 metric:1 RX packets:5352 errors:0 dropped:0 overruns:0 frame:0 TX packets:4077 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:897929  (876.8 KiB) TX bytes:545368 (532.5 KiB) [[email protected] Desktop]# ifconfig eth1 MTU 2000[[email protected] Desktop]# ifconfig eth1e Th1 Link encap:ethernet HWaddr 00:0c:29:42:9f:ce inet addr:192.168.78.133 bcast:192.168.78.255 mask:255  .255.255.0 Inet6 addr:fe80::20c:29ff:fe42:9fce/64 scope:link up broadcast RUNNING multicast mtu:2000          Metric:1 RX packets:5360 errors:0 dropped:0 overruns:0 frame:0 TX packets:4077 errors:0 dropped:0 overruns:0 Carrier: 0 collisions:0 txqueuelen:1000 RX bytes:898409 (877.3 KiB) TX bytes:545368 (532.5 KiB) 

Turn ARP on or off, because I can't find the difference, so just write down the command

Ifconfig eth1 ARP//Turn on Arpifconfig eth1-arp//Turn off ARP

  

The Ifconfig of Linux commands

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.