Conventional network configuration commands and advanced IP routing commands

Source: Internet
Author: User
Article Title: Traditional network configuration commands and IP advanced routing commands. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

Knowing how to configure network commands is a must-have technique for general technicians. after some time of research and study, I have summarized some common commands and examples for future reference.

The traditional ip advanced routing commands between and can be used in common and achieve the same purpose, but the ip is more powerful and can achieve more configuration purposes.

First, understand the traditional network configuration commands:

1. use the ifconfig command to configure and view network interfaces

Example 1: configure the IP address of eth0 and activate the device at the same time:

# Ifconfig eth0 192.168.4.1 netmask 255.255.255.0 up

Example 2: configure the IP address of the eth0 alias device eth0: 1 and add a route

# Ifconfig eth0: 1 192.168.4.2

# Route add? Host 192.168.4.2 dev eth0: 1

Example 3: Activate (disable) a device

# Ifconfig eth0: 1 up (down)

Example 4: View All (specified) network interface configurations

# Ifconfig (eth0)

2. use the route command to configure the route table

Example 1: Add to host route

# Route add? Host 192.168.4.2 dev eth0: 1

# Route add? Host 192.168.4.1 gw 192.168.4.250

Example 2: Route added to the network

# Route add? Net IP netmask MASK eth0

# Route add? Net IP netmask MASK gw IP

# Route add? Net IP/24 eth1

Example 3: Add a default gateway

# Route add default gw IP

Example 4: Delete a route

# Route del? Host 192.168.4.1 dev eth0: 1

Example 5: View route information

# Route or route-n (-n indicates that no name is parsed, and the list speed is faster than route)

3. ARP management commands

Example 1: View ARP cache

# Arp

Example 2: Add

# Arp? S IP MAC

Example 3: delete

# Arp? D IP

4. ip is a powerful network configuration tool in iproute2, which can replace some traditional network management tools.

For example, ifconfig and route,

The preceding example can be fully implemented using the following ip command, and the ip command can implement more functions. The following describes some examples:

4.0 ip command syntax

Ip [OPTIONS] OBJECT [COMMAND [ARGUMENTS]

4.1 ip link set -- change device properties. abbreviation: set, s

Example 1: up/down start/close the device.

# Ip link set dev eth0 up

This is equal to the traditional # ifconfig eth0 up (down)

Example 2: change the length of the device transmission queue.

Parameter: txqueuelen NUMBER or txqlen NUMBER

# Ip link set dev eth0 txqueuelen 100

Example 3: Change the MTU value of the network device.

# Ip link set dev eth0 mtu 1500

Example 4: modify the MAC address of a network device.

Parameter: address LLADDRESS

# Ip link set dev eth0 address 00: 01: 4f: 00: 15: f1

4.2 ip link show -- Display Device Properties. abbreviations: show, list, lst, sh, ls, l

If the-s option appears twice or more times, the ip will output more detailed error information statistics.

Example:

       
        
# Ip-s link ls eth0 eth0: mtu 1500 qdisc cbq qlen 100 link/ether 00: a0: cc: 66: 18: 78 brd ff: ff: ff RX: bytes packets errors dropped overrun mcast 2449949362 2786187 0 0 0 0 RX errors: length crc frame fifo missed 0 0 0 0 0 TX: bytes packets errors dropped carrier collsns 178558497 1783946 332 0 332 TX errors: aborted fifo window heartbeat 0 0 0 35172 this command is equal to the traditional ifconfig eth0
       

[1] [2] [3] [4] Next page

Related Article

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.