It is said in a textbook that routing function is not needed in the local area network, what is the use of the home router?

Please look at the green line, which is very strange.

Apr.19,2022

your own computers are connected to a local area network to access each other. It would be nice to have a switch.

but if the machine in your local area network wants to access the external public network, it should be routed


Home routing is generally used to connect to the external network, and now home routing not only has the routing function, but also has the functions of modulation mediation and hub.


-- transferred from the network

suppose your name is small (local host), and you live in a large courtyard (local local area network). There are many neighbors (network neighbors). There is an Uncle Li who is watching the gate in the reception room at the door. Uncle Li is your gateway. When you want to play with a buddy in the yard, as long as you shout his name (ping him) in the yard, he will respond to you when he hears it and runs out to play with you.

but you are not allowed to walk out the door, and all your contact with the outside world must be assisted by Uncle Li (gateway) on the phone. If you want to chat with your classmate Xiao Ming, Xiao Ming's family lives in another yard far away (Xiao Ming and you are not in the same local area network), and there is also a janitor Uncle Wang (Xiao Ming's gateway) in his yard. You don't know the phone number of Xiao Ming's family, but your head teacher has a list of all the students in your class and a comparison table of phone numbers. Your teacher is your DNS server. So you dialed Uncle Li at the door at home and had the following conversation:

little one: uncle Li, may I ask the head teacher to check Xiao Ming's phone number? (DNS query)

Uncle Li: OK, you wait. (then Uncle Li called your head teacher and asked Xiao Ming's phone number.) asked, his home number is 211.99.99.99 (Xiao Ming's IP address)

Little one: great! Uncle Li, I'd like to speak to Xiaoming. Please contact Xiaoming for me.

Uncle Li: no problem. (then Uncle Li sent a request to the telephone office to get through to Xiaoming's house. Of course, the last level was transferred to Uncle Wang in Xiaoming's courtyard, and then Uncle Wang transferred the call to Xiaoming's home) (routing)

so you got in touch with Xiaoming. (establish a connection)

as for DHCP server, you can compare it this way:

there are more and more residents in your yard. The telephone exchange of Uncle Li in the reception room can no longer meet the needs of so many residents (originally there are few partners, they use a fixed IP). If there are too many, they can't manage it, so they use DHCP. When residents turn on the phone, they get a random phone number, and the number may be different each time. Every once in a while, the number you rent will be withdrawn, and you need to get a new one next time. (this is the lease of DHCP)

Uncle Li at your door
your head teacher: your DNS server
telephone exchange in the reception room: your DHCP server

Ibid., the conversation between Uncle Li and Uncle Wang is called routing.

another: if there is a child named Xiao Yin, the doorman of the yard where he lives is Uncle Sun, because Xiao Yin's yard has just been built, and Uncle Sun has just arrived. He does not have the office phone number of Uncle Li and Uncle Wang (of course, Uncle Li and Uncle Wang do not have his phone number), there will be two situations:

1. Aunt Zhao of the neighborhood committee told Uncle Sun about the phone number of Uncle Li and Wang (at the same time, Aunt Zhao also told Li and Wang Guan Sun's phone number). This is called static routing
2. Aunt Zhao is ill, and Uncle Sun calls everywhere and says, "I am the one in charge of the phone in their yard." as a result, Li and Wang heard it and wrote it down in their address book. Then Li and Wang called Uncle Sun back and said, "I'm Xiao Ming (little one), who runs the phone in their yard." this is called dynamic routing

.

then one day, Xiao Xiao wanted to find Xiao Dark, and naturally he called Uncle Li and said, "Uncle, I'll find Xiao Dark." (here omits the process of checking the phone number of Uncle Li, assuming he knows Xiao Dark's phone). Uncle Li looked for the address book: "Oh, Uncle Sun is in charge of the phone in Xiaoyin's courtyard. If you want to find Xiaoyin, you have to inform Uncle Sun. I can tell Uncle Wang to ask him to find Uncle Sun." You can also find Sun directly, of course, it is convenient to find Sun directly. "so Uncle Li called Uncle Sun, and then Uncle Sun transferred the call to the small dark house. Here Uncle Li's address book is called the routing table.

Uncle Li's choice of whether to go to Uncle Sun directly or ask Uncle Wang to help transfer is called routing.

there is a reason why Uncle Li chose to go to Uncle Sun directly, because he can get there in one step if he goes directly to Uncle Sun. If you want Uncle Wang to transfer, you need two steps to complete. The "step" here is called "hop count". Uncle Li's choice follows the principle of the least step (hop count) (if he does not abide by this principle, the little one may wait a little longer to find the dark. In the end, Uncle Li may be fired for poor work, which is called "the delay is too long, the routing principle is unreasonable, and the router has been changed.")

routing tables on the Internet are always transmitted in this way. If the central router breaks down one day, many of the points associated with it will not be able to find the target, and you will not be able to get on the Internet.

of course, things always change. Little one has a quarrel with Xiao Ming. These days, little one always calls Xiao Yin, and Xiao Ming thinks to himself, "Fuck, is he speaking ill of me?" So Xiao Ming decided to eavesdrop on the call between Xiao Di and Xiao Yin, but he couldn't get out of the yard. What should he do? Xiao Ming made such a decision:
first of all, he told Uncle Wang, who is in charge of the phone in his courtyard, "call Uncle Li and say that Xiao Yin has moved to our yard, and I'll answer all the phone calls to him in the future." Uncle Wang didn't reflect it (after all, he's too old!) ) he called Uncle Li and said, "now I'm in charge of Xiao Dark's phone, but Sun doesn't care anymore." as a result, Uncle Li changed his address book, which is called routing fraud.

when Xiao Xiao points to Xiao Yin again, Uncle Li will transfer it to Uncle Wang (which should have been transferred to Uncle Sun). When Uncle Wang received this call, he transferred it to Xiao Ming (because he had already made a deal with Xiao Ming). Xiao Ming pretended to communicate with Xiao Ji when he received the call. Because Xiao Ming was guilty of being a thief, he was afraid to ask him face-to-face after meeting with Xiao Dark tomorrow, so after the communication was cut off, he made a phone call to Xiao Yin in the name of little one and repeated what he had just said, which is called data eavesdropping.

later, Xiao Xiao is still in constant contact with Xiao Yin, and Xiao Ming is scattered. Xiao Ming mutters to himself, "I can't always talk to him like this. What should I do if it comes out one day?" So he thought of a more insidious trick: "I might as well stop eavesdropping on your phone, and you little one won't call me!" then I won't let you call Xiao Dark, hem! " Well, how did he do it? Let's see:

he contacted a group of bad friends and colluded with them. At a fixed time every day, everyone called the reception room in the small dark courtyard with everything. As long as Grandpa Sun in the reception room answered the phone, he would hear, "it's thunder, it's raining to collect clothes!" , "people are born by his mother, demons are born by his mother", "your mother's surname", etc., listen to the head is big, do not listen to it, the phone keeps ringing! Finally, one day, Grandpa Sun couldn't help it and shouted, "I can't stand pulling!" So he hanged himself!

this is the simplest DDoS attack. Grandpa Sun's weak psychological ability is called "Datagram processing module has BUG", and Grandpa Sun's suicide is called "router paralysis." If it were me, I would smile and talk with them, such as telling them, "I have already listened to the weather report and put away my clothes 10 minutes ago" or "is your mother a person or a demon" or "has the same last name as your grandmother" and so on. My sound mind is called "robust Datagram processing, able to resist any attack". Even so, Xiaoming can find a bunch of bad friends (chicken) to make Uncle Sun die.

after Grandpa Sun was paralyzed, little one finally stopped calling Xiao Dark, because no matter how much he hit each other, this phenomenon is called "denial of service", so Xiao Ming's practice is also called "denial of service attack" (DoS attack). When there are more bad friends, it is called distributed denial of service attack (DDoS).
Xiao Ming was finally quiet for a few days.

A few days later, a beautiful girl named Xiao Li came to Xiaoming's yard. Xiao Ming liked her very much. (but Xiao Li has a handsome boyfriend, and Xiao Ming can't help it. Of course, we still have to follow the above principle: Xiao Li can't leave the yard. Naturally, the man had to make a phone call if he wanted to hook up with Xiao Li, so Xiao Ming was ready to move again:

do you remember Grandpa Wang was the telephone manager in the yard? The reason why he can manage phone calls is that he has an address book, because there may be two children named Xiaoming in the same yard, which cannot be distinguished by name, so there are only two items in each line of the address book:

phone number
door 1234567 (this is Xiao Ming's) IP and MAC correspond to
door 7654321 (this is Xiao Li's)
.

Grandpa Wang has a bad memory, but it can't be wrong (there won't be two "No. 2 gates" in the same yard, right? Every time he makes a phone call, people will give out the phone number they are looking for, and then go to the courtyard through the address book and knock on the door. for example, they say I am looking for "1234567". So as soon as Grandpa Wang compares, oh, it is door number one, he knocks on door one to "answer the phone." if he is looking for "7654321", he will go to door two to "answer the phone."

the phone number here is the legendary IP address

the house number here is the 'MAC' address of the legendary network card (the MAC address of each network card is different, which is written by the manufacturer of the network card in the chip of the network card)
Xiao Ming thought to himself, "Damn it, you can't do it if I can't get you." so he came up with the idea of Grandpa Wang's address book. After careful observation, careful preparation. He finally found that Grandpa Wang had the problem of frequent urination (after all, the old man.). Finally in a dark and windy day, Grandpa Wang went to the bathroom. Xiaoming secretly entered the reception room and carefully changed Grandpa Wang's address book.

A few days later, Xiao Li's boyfriend called Xiao Li again. The phone number of the other party was "7654321". Grandpa Wang looked at the address book and said:

phone number
door 1234567 (this is Xiao Ming's)
door 7654321 (Note: this was originally Xiao Li's, but it was changed by Xiao Ming)
.

Grandpa Wang didn't know it had changed, so he went to Xiao Ming from door one. Xiao Ming was beautiful in his heart. He severely lectured the improper relationship between the man and Xiao Li in the tone of Xiao Li's father. as a result, the man respectfully hung up the phone. Of course, Xiao Li didn't know the whole thing happened.

here Xiao Ming's behavior is called "ARP spoofing" (because it is realized by sending ARP packets on the actual network, it is called "ARP spoofing"), and Grandpa Wang's address book is called "ARP Table"

.

Note here: Grandpa Wang now has two address books, one is a notebook for recording phone calls in each courtyard reception room, called the "routing table," and the other is a notebook for recording detailed information in the courtyard, called the "ARP table."

Grandpa Wang's system says, "re-check the corresponding book of house number and phone (that is, ARP table) every month." this action is called "refresh ARP table", and the monthly time limit is called "refresh ARP table cycle". In this way, Xiao Ming secretly changed the address book once a month in order that the man could never find Xiao Li, but this is something he had to do.

add that Xiao Ming is very smart. If the address book (ARP table) is changed like this:
MAC number (IP)
door 1234567 (this is Xiao Ming's)
door 1234567 (Note: this has been changed by Xiao Ming, but he made a mistake in a moment of dizziness), then two MAC correspond to the same IP address
.

the computer will pop up a dialog box saying "duplicate IP address", which will eventually cause Grandpa Wang to be at a loss, so he informs doors one and two that your calls are duplicated. In this way, Xiao Li knows that someone is ruining her good deed, a phenomenon called "the scam has been exposed"

the little one knew that Xiao Ming eavesdropped on the phone between him and Xiao Yin, so he agreed on the password with Xiao Yin. The little one told Xiao Dark after encrypting what he had to say at home. Potato-> Wednesday, sweet potato-> treat, idiot-> small point home. So the little one told Xiao Dark: potato stupid sweet potato. Xiao Ming listened to it. I don't understand. I'm depressed. This is encryption.

in addition, Xiao Li also knew that Xiao Ming changed his home phone number. So Grandpa Wang came to the door and wrote down the phone number and house number one by one. And hide and do not allow outsiders to modify, can only have their own key (password). This is the binding of ip address and MAC address. When someone changes the phone number, he has to ask Grandpa Wang to change it. Trouble is trouble, but it's safe. However, Xiao Ming secretly matched Grandpa Wang's key (successfully stealing the password), so he could also modify it.

Menu