"Tang teacher learning with cloud network" - the first four-way router Huawei ye walked [cloud] Share

Abstract Well, here at least you should be able to understand the routing table information. Give you a purpose IP, you should also know what a route it will use. Road show to see how to get in you ~

First, routing

In fact, everyone on the network is experiencing the most problems: FML, why not make sense ah!

A little better luck than this: FML, through the past, back to nowhere ah!

Do not panic, after reading this chapter, the next encounter such a problem can get basic own. First, we hope to be able to pass two machines, you have to know is how to pass through, that is, pass the time, the road is how to go.

In most cases you (where you are referring to your message) went over the road, came back with the same road.

In rare cases, you walk past the road and then around the back roads. This does not affect the principle of finding the way.

For chestnut: When you are in Hangzhou, Heilongjiang want to go, you should go north. Normally you will not be around one from Shenzhen. In case the line is interrupted, the line you look around from Xi'an.

Overall: how to get a specific message, it is the problem of the route.

Second, the routing table

If you want to know there is a network, this table is sure to read it.

Find Linux host, enter #route -n

 

Kernel IP routing table
Destination     Gateway    Genmask      Flags  Metric  Ref  Use Iface
0.0.0.0      10.120.174.1  0.0.0.0       UG     0   0   0  eth0
10.120.174.0    0.0.0.0    255.255.254.0    U     0   0   0  eth0
172.17.0.0     0.0.0.0    255.255.0.0     U     0   0   0  docker0

 

Note, -n argument here is not necessary, but is recommended to bring a lot of other network-related commands, it is also recommended with the -n option.

(The reason: route command, the default IP address will be translated into hostname, but IP-> Hostname this action, it will go to check DNS, DNS configuration and sometimes bad, such as check fails the route command will feel stuck same.)

The first line in this table:

Destination Gateway Genmask Flags Metric Ref Use Iface

Red part is the foundation, meaning respectively:

Destination Gateway Genmask Iface

Mask Destination IP gateway card

(Destination, transit point, destination range, which door departure)

Look at the middle of a route record

 

Destination destination transit point range, which door starting 
10.120.174.0 0.0.0.0 255.255.254.0 eth0

First, the destination address is 10.120.174.0, range 255.255.254.0

According to the principle of the mask on the festival, we know that the mask is 23, that is, only the first 23 do not move, you can move only the last nine.

Both a binding (to), the network will know the scope of the object:

 

(FIG: destination address)

 

(FIG: Destination range)

Combination of both ranges: 10.120.174.0 (variable portion are all 0) ~ 10.120.175.255 (variable portion are all 1), a total of 512 destination addresses (IP).

That is the purpose of all these IP addresses within this range, the choice of route, this route will match the record.

That this record is like this: When a match to this record, does not require the transfer station (gateway to 0), just put this message to eth0 door thrown herd (Iface as eth0).

What does it mean? Is this IP range we are in a small local area network inside, you cry, you can know, without transit.

Look at the last record route

 

Destination destination transit point range, which door starting 
172.17.0.0 0.0.0.0 255.255.0.0 docker0

This is on top of a record with essentially the same meaning, purpose & destination address range, combined with the results:

Target address being 172.17.0.0 ~ 172.17.255.255 of just throwing it wants to docker0 above the card.

 

Finally, look at the first route recording

Destination destination transit point range, which door starting 
0.0.0.0 10.120.174.1 0.0.0.0 eth0

Here the destination address is 0, indicating default default route, which means: When your destination address is really no other can match the record of the route, use this one right.

And that a default rule means: to throw eth0 card, then sent to a transit station 10.120.174.1. Behind the things you do not control (mean let transit point to solve routing back)

For example, I want to:

# ping 10.184.43.7

At the right time, the purpose IP, that is clearly not in line with the middle of the range that record does not conform to the range of the last record. How this one can only use the default record.

Look again this default route record:

This record says: When a match to this record, transfer station to be set as 10.120.174.1, and the message to go to the door to throw out eth0 (Iface as eth0).

Here the implicit representation of the transfer station must be able to reach you, or else the network will not work.

How to guide packet transfer station

Well, then we take a look at how the message is through the transfer station. Here is a transit point for IP 10.120.174.1, in order to put the message sent here to go to, how should we go?

Hey, but also a way how to get the problem, this is not just learning the above thing.

To match with me, Article okay? No.

Article okay, OK!

Just the second path, it is sent by the recorded range (10.120.174.0 ~ 10.120.175.255) with a second route specified manner (packet from eth0 thrown herd).

It is clear that the routing table at recursion. At the same time, this also shows that a transit station in the same local area network thing.

That is the message to the gateway, but also to the routing table.

summary

By all routing tables are matched again, you will find that any purpose IP, can be matched to a routing table (because you have a default rule).

The matching process as you are "artificial" one by one check. If you how to get even the road is not set, and how the network can pass it?

Third, the impact on the local IP address route

Look at the IP information of the client:

1 # ifconfig
2 docker0   Link encap:Ethernet  HWaddr 02:42:e6:07:93:34  
3           inet addr:172.17.0.1  Bcast:0.0.0.0  Mask:255.255.0.0
4 eth0     Link encap:Ethernet  HWaddr 28:6e:d4:88:f8:64  
5           inet addr:10.120.175.166  Bcast:10.120.175.255  Mask:255.255.254.0
6 lo      Link encap:Local Loopback  
7           inet addr:127.0.0.1  Mask:255.0.0.0

You will find that each network card if there are IP, will add a route recorded in the routing table inside. For example, you put a card down out, look at the route table, you will find less of a route record. up the card again when routing records back.

Also, the route of Destination (destination range) and you set the IP mask is the same. For example here is my local ip 10.120.175.166, mask is 255.255.254.0. So the route is IP & Mask = 10.120.174.0.

why? This is not very clear what, you added a new card, plug in the network cable, but also get a new IP, this card that you access a new local area network ah, of course you more than a new way to go.

IV contains the problem

When the record contains two routes to each other how to do?

such as:

172.0.0.0       0.0.0.0         255.0.0.0      U     0      0        0 eth0
172.17.0.0      0.0.0.0         255.255.0.0     U     0      0        0 docker0

This time, if you want to

# ping 172.17.0.2

Which way is it a record?

First, if you have to seriously study before class, then you will know where different mask, represents the different networks. Then the mind should show two different paths. Choose which way, of course, is a choice that best matches the :-)

(Eg default record, in fact, can match any destination IP, but it is not the most accurate match)

Second, if this happens, that your network specifications to be improved, although this is not a problem, but due to influence people's understanding, it is recommended not set up this way.

Unless you are very clear so deliberately planned, such as flannel network settings:

. 1 the root @ K8S-node1: ~ # route - n-
 2  the Destination Gateway Genmask-Iface the Flags the Use the Metric Ref
 . 3  10.1 . 0.0     0.0 . 0.0    255.255 . 0.0     the U-     0     0    0    flannel0   // packet across nodes container 
4  10.1 . 15.0     0.0 . 0.0    255.255 . 255.0    the U-     0     0    0    docker0    // package container of the present node

For all of the containers (containers may be separate as a host, will be described later chapters) together, first of all the above container as a large host part of the network, and each independent of each other inside the container and a separate host division of smaller networks. And any two small separate subnets will not be repeated.

Note that stand in the perspective of the machine view, this is two separate networks, just look at everyone within a large network administrator perspective.

Host treat packets is made completely independent judgment: is native or not native.

So the packet to the container, are in line: this is not a machine. Then it would begin to match the routing table it. See above courses matching process.

Well, here at least you should be able to understand the routing table information. Give you a purpose IP, you should also know what a route it will use.

Road show to see how to get in you ~

Author: tsjsdbd

Guess you like

Origin www.cnblogs.com/huaweicloud/p/12018090.html