Fully parse the Linux ifconfig command (2)

Source: Internet
Author: User

The Linux ifconfig command has already been used to view the NIC information. Here we will describe how to use this command to perform simple configuration and status settings for the NIC, which involves switching the IP address, MAC address, and nic status.

Ifconfig

Configure the IP address of the NIC

Ifconfig eth0 192.168.0.1 netmask 255.255.255.0

Configure the IP address and 24-bit mask of 192.168.0.1 on eth0. What if I want to configure another IP address 192.168.1.1/24 on eth0? Use the following command

Ifconfig eth0: 0 192.168.1.1 netmask 255.255.255.0

Then run the ifconifg command to view the information of the two NICs: eth0 and eth0: 0. If you want to add more IP addresses, enter the names of the network adapters: eth0: 1, eth0: 2. OK!

Configure the hardware address of the NIC

Ifconfig eth0 hw ether xx: xx

You can change the hardware address of the NIC, and then you can cheat the IP address in the LAN.

Disable Nic

Ifconfig eth0 down

Enable the NIC

Ifconfig eth0 up

The ifconfig command has powerful functions. You can also set the MTU and hybrid mode of the NIC. I will not discuss it one by one. I can study it myself in time.

Note: The NIC information configured using the Linux ifconfig command does not exist after the NIC is restarted. To save the above configuration information to your computer forever, you need to modify the NIC configuration file.

  1. Fully parse Linux ifconfig command 1)
  2. Describes how to manage Linux User Accounts
  3. Detailed introduction to the creation of Linux batch users
  4. Linux mounting commands
  5. Linux mount command usage


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.