Linux network basic network configuration

Source: Internet
Author: User
Tags traceroute command
Article title: Linux network basic network configuration method introduction. 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.

View network information

View network interface information

1. understand network interface devices in linux

$/Sbin/ifconfig to view information about all active network interfaces, including a loose.

2. view the information of the specified network interface

$/Sbin/ifconfig <网络接口名称> View the specified interface information.

3. View information of all network interfaces in the system

$/Sbin/ifconfig? A. View All interface information, including inactive interfaces.

Note: When a common user views network interface information, add "/sbin" before the command, but the administrator does not. This is because of the command search PATH. you can view it through "$ echo $ PATH.

  View gateway address and route information

1. View host route information

#/Route

Displays the route table information of the current linux host.

#/Route | grep default

The line starting with "default" is displayed in the display result of the route command. the default gateway address of the host is used to combine the route command and grep command, only the default gateway address is displayed.

2. test the network connection with other hosts

$ Ping the target host address

Use the ping command to test the network connection with other hosts. Ctrl + C terminate.

$ Ping? C <测试数据包数量> <目的主机地址>

Use the ping command to send a specified number of packets for network connection testing.

$ Tips for using the ping command to test network connections.

Note: when the ping command test fails, the connection between the current host and the target host cannot be determined to be disconnected because of many factors (such as network firewall) the host cannot be pinged when the network connection is normal.

3. test the network connection path with other hosts

$ Traceroute <目的主机地址>

The traceroute command displays the addresses of network nodes that pass between the current host and the target host, and the connection status between the current host and each intermediate node.

  View host name information

1. view the current host name

$ Hostname: view the current host name.

2. use the dns server to query domain names

$ Nslookup

Interactive mode: usually used to test the DNS server

Direct Mode: used to query the IP address corresponding to a domain name

Use Network commands for network settings

Network setting method

1. DHCP network configuration

$ Dhclient you can use the dhclient command to apply for a new network configuration application from the DHCP server to the current host.

Note: the DHCP server usually provides the most basic network configuration information to the DHCP client, including the interface IP address, default gateway, and DNS.

Server address.

2. Manual network configuration

Network interface IP address and subnet mask

Default Gateway address

Current host name

DNS server address

IP address configuration command

Ifconfig <网络接口名称> Network <子网掩码>

Example: # ifconfig eth0 192.168.1.222 netmask 255.255.255.0

Note: manual linux network configuration is only for temporary use, and the configuration is not saved.

Extension: # ifconfig eth0: 1 10.0.0.1 netmask 255.0.0.0 multiple sub-IP addresses are configured for one Nic.

# Ifconfig eth0 hw ether MAC address: modify the mac address of the NIC,

[1] [2] 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.