当前位置:网站首页>Network layer protocol hardware
Network layer protocol hardware
2022-06-30 04:26:00 【Tra220123】
One 、NAT gateway
1. Router
The home router has an internal network port and an external network port .
Plug the cable of the external network port into the network port of the network cable pulled out by the optical cat , Configure the external network port to be the same as the LAN of optical cat . The intranet port is connected to all computers at home .
Routers connect multiple LANs , The exit of each LAN is the gateway .
2. If it's not the same segment , What do I do ?
Default gateway required Gateway.
Gateway The address must be the same as the source IP The address is a segment of . Either the first or the second .
3. How to send to the default gateway ?
Put the source address and destination IP Put the address in IP head , adopt ARP Get the MAC Address , Will source MAC And gateway MAC Put in MAC In the head , Send out .
4. A gateway is often a router , It's a three-tier forwarding device . What is a three-tier device ?
hold MAC The head and IP Take off your head , And then according to what's in it , Look at the device where the packet is going to be forwarded next .
Accurate said : A router is a device , There are multiple network cards or network cards , Connected to multiple LANs . Every network card IP Address and LAN IP Segments with the same address , Each network card is the gateway of the LAN . Any packet that wants to be sent to another lan , Will reach one of the gateways , Be brought in , Take down MAC The head and IP head , According to their own routing algorithm , Select another network card , add IP The head and MAC head , And throw it out .
5. Static routing
Indicates that the data sent to any network segment passes through the local interface 192.168.1.104 Sent to a default gateway :192.168.1.1, Its management distance is 25.
Manage distance : The credibility of information in the process of path selection , The smaller the management distance , The more credible .
A Class address 127.0.0.0 Retain local debugging to use , All routing tables send to 127.0.0.0 Network data is looped back locally 127.0.0.1 Send to the specified gateway :127.0.0.1, That is, from your own loopback interface to your own loopback interface , This will not take up LAN bandwidth .
The destination network here is in the same LAN as the local network , So send it to the network 192.168.1.0 On the link of , This eliminates the need for router routing or switch switching , Increased transmission efficiency .
route:
netstat -rn:
6. Forwarding gateway
The server A To access the server B.
① First , The server A Will think 192.168.4.101 And I'm not a segment of , So it needs to be sent to the gateway first .
② The gateway has been statically configured , Gateway is :192.168.1.1.
③ gateway MAC What's the address ? send out ARP Get the MAC Address , Then send the package .
The content of the bag is :
④ The bag reaches 192.168.1.1 This network port , Find out MAC The address is consistent , Take the bag in , Start thinking about where to forward .
⑤ In the router A After static routing is configured in , To visit 192.168.4.0/24, From you to 192.168.56.1 Go out this way , The next jump is 192.168.56.2.
⑥ Router A When thinking , Match this route , From you to 192.168.56.1 This mouth sends out , issue 192.168.56.2, that 192.168.56.2 Of MAC What's the address ? Router A send out ARP obtain 192.168.56.2 Of MAC Address , Then send the package .
The content of the bag is :
⑦ Package arrival 192.168.56.2 This network port , Find out MAC Agreement , Take the bag in , Start thinking about where to go ?
Router B Static routing is configured in , To visit 192.168.4.0/24, From you to 192.168.4.1 Go out this way , There's no next jump .
Because the network card on the right hand is of this network segment , It's the last jump .
⑧ route B When thinking , Matches this route , From you to 192.168.4.1 This mouth sends out , To be sent from 192.168.4.101. That's from 192.168.4.101 Of MAC What's the address ? Router B send out ARP Get from 192.168.4.101 Of MAC Address , Then send the package .
The content of the bag is :
The packet arrives at the server B,MAC Address matching , Put the bag away .
->
Through this process, we can see :
Not to a new lan ,MAC It's all about changing , however IP The address doesn't change . stay IP Inside the head , No gateways will be saved IP Address .
The next jump is something IP To put this IP Address conversion to MAC Put in MAC head .
7. Solve the following problems ?
The target service B We should have an international identity in the world , Give it a 192.168.56.2. At gateway B On , Let's write it down , International identity 192.168.56.2 Corresponding domestic identity 192.168.1.101.
All visits 192.168.56.2, All turned into 192.168.1.101. therefore , The source server A To access the target server B, The destination address to be specified is 192.168.56.2.
8.NAT
Network Address Translation
Source IP For the server A International identity of , So when sending the return packet , Also send this international identity , By the router A do NAT, Convert to a domestic identity . This process I The card address will also change .
① adopt What Is My IP? Quickly See My IP Address and My IP Location Look at your exit IP Address .
②linxu Grab the bag :tcpdump
Two 、 Dynamic routing algorithm
1. Routing protocol
The gateway administrator manually modifies the routing protocol in the routing table .
2. Dynamic routing
Use dynamic routing router , Generate dynamic routing table according to routing protocol algorithm , Changes with the operation of the network .
① What is the routing algorithm ?
Complex paths can be abstracted into a data structure called graph . Find the shortest path on the way .
② Two ways to find the shortest path :
[1] Distance vector routing ( be based on Bellman-Ford Algorithm )
Each router keeps a routing table , Contains multiple tables , Each row corresponds to a router in the network , Each line contains two parts of information : One is to go to the target router , Get out of that line , The other is the distance of the target router .( Every router knows the global information )
problem 1: Good news travels fast , Bad news travels slowly .
problem 2: Every time you send , To send this global routing table .
[2] Link state routing (link state routing)( be based on Dijkstra Algorithm )
When a router starts , First find your neighbors , To the neighbors say hello, The neighbors replied . Then calculate the distance from your neighbor , Send a echo, Ask to return immediately , Divide 2 That's the distance. .
Then broadcast the link state packet between yourself and your neighbor , To every router in the entire network . In this way, each router can receive the relationship information between it and its neighbors .
Each router can build a complete graph locally , Use... For this diagram Dijkstra Algorithm , Find the shortest path between two points .
3. Dynamic routing protocol
① Research on link state based routing algorithm OSPF: open shortest path first, Open shortest paths take precedence
It is mainly used inside the data center , Used for routing decisions , So it's called IGP: Internal gateway protocol .
IGP The key point is to find the shortest path .
Equivalent route :OSPR Multiple latest SMS messages can be found , Load balancing across multiple paths .
②BGP agreement
Routing protocols between autonomous systems ,BGP The exchanged network reachability information provides enough information to detect the routing loop and make routing decisions according to the performance first policy constraints .
边栏推荐
- FortiGate performs DNAT mapping, and intranet users cannot normally access the mapping
- JS file block to Base64 text
- FortiGate firewall configuration link detection link monitor and status query
- Imile uses Zadig's multi cloud environment to deploy thousands of times a week to continuously deliver global business across clouds and regions
- 数据链路层详解
- Matlab reads fig file and restores signal
- Differences between beanfactory and factorybean
- 487-3279(POJ1002)
- Day 10 data saving and loading
- Qt 6.3.1Conan软件包发布
猜你喜欢
Mongodb learning
基于SSM框架茶叶商城系统【项目源码+数据库脚本+报告】
Matlab reads fig file and restores signal
Junior students summarize JS advanced interview questions
Cloud native -- websocket of Web real-time communication technology
Anonymous pipeline for interprocess communication
Day 12 advanced programming techniques
Redis cache avalanche, breakdown and penetration
管道实现进程间通信之命名管道
Interview topic of MySQL
随机推荐
FortiGate firewall and Aruze cloud tunnel interruption
Error Nova missingauthplugin: an auth plugin is required to determine endpoint URL
Matlab reads fig file and restores signal
I spent three years in a big factory outsourcing, which subverted my understanding!
MySQL DDL change
Titanic(POJ2361)
输入输出及中断技术——微机第六章学习笔记
El upload upload file (manual upload, automatic upload, upload progress)
Es2016 key summary
进程间通信之匿名管道
7-3 打怪升级 单源最短路
lego_loam 代码阅读与总结
Myrpc version 0
FortiGate creates multiple corresponding DDNS dynamic domain names for multiple ADSL interfaces
Knowledge - how to build rapport in sales with 3 simple skills
Imile uses Zadig's multi cloud environment to deploy thousands of times a week to continuously deliver global business across clouds and regions
Interview topic of MySQL
Ora-00907: missing right parenthesis problem supplement
Configure specific source IP in SLA detection of FortiGate sdwan
Day 12 advanced programming techniques