Network knowledge and tools that should be known

Source: Internet
Author: User

Network knowledge and tools that should be known

Usually in the development, testing, production will encounter a variety of network problems, how to quickly locate the problem, need to know the relevant knowledge, to master the relevant tools.

1, the address of the private IP

The private IP is the IP on the local LAN, which corresponds to the public IP. Due to the limitations of the IPV4 protocol we currently use, the number of IP addresses is now limited. In this way, we cannot assign a public IP to each computer residing on the Internet. Therefore, each computer on the LAN can only use the private IP address. A private IP address is a reserved IP address that is used only on a local area network and is not used on the Internet. We can select the appropriate private IP address classes as needed, and use them like public IP addresses in the internal LAN. The address range of the private IP is as follows:

Class A: 10.0.0.0-10.255.255.255

Class B: 172.16.0.0-172.31.255.255

Class C: 192.168.0.0-192.168.255.255

2, visit the basic process of the site (mainly to explain DNS)

(1). Enter the URL (www.demo.com.)

(2). Accessing the local hosts

(3). Accessing the local hosts DNS cache

(4). Access Ldns (local DNS), configure the address for the gateway

(5). First access to the root domain DNS (13 units worldwide)

(6). accessing COM-corresponding servers

(7). Access the demo server

(8). To access a Web site authoritative DNS server

(9). ·

(10). Returned to the requestor machine, the requestor machine caches DNS, and accesses the corresponding server

(11). The corresponding server returns content

3. Modify Host Name

The Linux operating system's hostname is a kernel variable that can be viewed by hostname commands to view the hostname of the machine. There are some ways to modify the hostname of a runtime Linux system:

(1). Temporary entry into force

Hostname newname

(2). Permanent entry into force

Vim/etc/sysconfig/network

Hostname=newname #主机名

4. Network card file

In the Linux hairstyle version of CentOS, the address of the NIC file is/etc/sysconfig/network-scripts/ifcfg-eth0, each parameter has the following meanings:

#指第一块网卡名称为eth0, the second block is eth1.

Device=eth0 #类型

Type=ethernet

#开机网卡自启动

Onboot=yes

Nm_controlled=yes

#静态分配地址

Bootproto=none

#客户端dns设置

dns1=8.8.8.8

Userctl=no

Ipv6init=no

#mac地址, different machines cannot be duplicated, especially cloning virtual

#机或者复制网卡配置的时候

Hwaddr=00:0c:20:3f:00:20

#这里是ip地址设置

ipaddr=10.10.1.1

#子网掩码

netmask=255.255.255.0

#网关配置, you can also add a delete command line via the route

getway=10.0.0.254

5, single network card set up multiple IP addresses

#ifconfig eth0 192.167.0.1 netmask 255.255.255.0 up

Description

Eth0 is the first Nic, and the others are eth1,eth*

192.167.0.1 is the IP address configured for the first NIC configured for the NIC

Netmask 255.255.255.0 is configured with a subnet mask

Up means immediate activation

Change eth0 to Eth0:x (x is 0-255 for example eth0:0 or eth0:1, etc.), ETH0:X is called Virtual network interface, is built on the network Interface (eth0), so the way to configure multiple IPs for a single NIC is to use the command:

#ifconfig eth0:0 192.167.0.1 netmask 255.255.255.0 up

#ifconfig eth0:1 192.167.0.2 netmask 255.255.255.0 up

6. Modify the default gateway

Immediate effect: Route add default GW 192.167.1.1

Restart effective: vim/etc/sysconfig/network--Add or modify the following line gateway=192.167.1.1

7. View Gateway

Execute route-n command

The last one is the default gateway, and when all rules are not met, go to the default gateway.

8. View DNS resolution

The general usage is dig www.baidu.com.

For example, the site domain name www.baidu.com Trace query can see the root domain, the domain name authoritative server address and their respective return results, so that the tracking of DNS resolution in the problem of a great help.

If dig is not installed on the system, the following command can be installed under CentOS: Yum install bind-utils

9. Track routes

The general usage is traceroute www.baidu.com.

If dig is not installed on the system, the following command can be installed under CentOS: Yum install traceroute

10, grasping the bag tool

Tcpdump is a tool for intercepting network groupings and outputting grouped content. Tcpdump can intercept the "head" of the packets that are transmitted in the network to provide analysis. It supports filtering on the network layer, protocol, host, network, or port, and provides logical statements such as and, or, not, to help you get rid of useless information.

10, the network does not pass the examination idea

(1). Whether the physical link is through

(2). Native IP, routing, DNS settings compliance

(3). Test the patency of the gateway or router, first measuring the gateway and then measuring the router

(4). Test the patency of ping public network IP

(5). Test DNS for unobstructed

Network knowledge and tools that should be known

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.