Linux ifconfig command details how to use Linux ifconfig command

Source: Internet
Author: User

Ifconfig can set the status of the network device or display the current settings.

Syntax

Ifconfig [network device] [down up-allmulti-arp-promisc] [add <address>] [del <address>]

[<Hw <network device type>

[Mem_start <memory address>] [metric <quantity>] [mtu <byte>] [netmask <subnet mask>] [tunnel <address>]

[-Broadcast <address>] [-pointopoint <address>] [IP address]

Parameter description:

  • Add <address> set the IPv6 IP address of the network device.
  • Del <address> delete the IPv6 IP address of the network device.
  • Down to disable the specified network device.
  • <Hw <network device type>
  • Io_addr <I/O address> sets the I/O address of the network device.
  • Irq <IRQ address> sets the IRQ of the network device.
  • Media <network media type> sets the media type of the network device.
  • Mem_start <memory address> sets the starting address occupied by the network device in the main memory.
  • Metric <quantity> specifies the number of data packets to be added when calculating the number of data packets to be transferred.
  • Mtu <byte> sets the MTU of the network device.
  • Netmask <subnet mask> sets the subnet mask of the network device.
  • Tunnel <address> establishes the tunnel communication address between IPv4 and IPv6.
  • Up to start the specified network device.
  • -Broadcast <address> processes data packets sent to the specified address as broadcast data packets.
  • -The pointopoint <address> is directly connected to the network device of the specified address. This mode has the confidentiality function.
  • -Promisc: disable or start 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.

Instance

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 fig: 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)

Enable or disable a specified Nic

# Ifconfig eth0 down

# Ifconfig eth0 up

Configure and delete IPv6 addresses for NICs

# Ifconfig eth0 add 33ffe: 3240: 800: 1005: 2/64 // the IPv6 address of the NIC.

# Ifconfig eth0 del 33ffe: 3240: 800: 1005: 2/64 // delete an IPv6 address for the NIC

Use ifconfig to modify the MAC address

# Ifconfig eth0 down // disable the NIC

# Ifconfig eth0 hw ether 00: AA: BB: CC: DD: EE // modify the MAC address

# Ifconfig eth0 up // start the NIC

# Ifconfig eth1 hw ether 00: 1D: 1C: 1D: 1E // disable the NIC and modify the MAC address

# Ifconfig eth1 up // start the NIC

Configure IP addresses

# Ifconfig eth0 192.168.1.56

// Configure an IP address for the eth0 Nic

# Ifconfig eth0 192.168.1.56 netmask 255.255.255.0

// Configure an IP address for the eth0 Nic and add a sub mask

# Ifconfig eth0 192.168.1.56 netmask 255.255.255.0 broadcast 192.168.1.255

// Configure an IP address for the eth0 Nic with a sub-mask and a broadcast address.

Enable and disable ARP

# Ifconfig eth0 arp // enable

# Ifconfig eth0-arp // disable

Set the maximum transmission unit

# Ifconfig eth0 mtu1500

// Set the maximum data packet size that can pass to 1500 bytes.

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.