当前位置:网站首页>Network Protocol 03 - Routing and NAT
Network Protocol 03 - Routing and NAT
2022-07-30 07:41:00 【Rhubarb _ yellow】
Routing
As previously known, forwarding data between different network segments requires the support of routers.However, by default, the router only knows the network segment directly connected to it, so the network segment that is not directly connected needs to be told to it through static routing and dynamic routing.
- Static routing: administrators manually add routing information, suitable for small-scale networks
- Dynamic routing: routers automatically obtain routing information through routing protocols (such as RIP, OSPF), suitable for large-scale networks
First of all, let's talk about how to manually add routing information for static routing. As shown in the figure below, how to configure four hosts to communicate with each other?
In the above picture, computers 0 and 1 can communicate with each other, Router 0 knows each other's network segments, and the same is true for computers 2 and 3, but it seems that computer 0 can't communicate with computer 3.Here, the concept of routing table needs to be introduced. By adding the static route of router 0, it can access computers that are not directly connected to the network segment. Of course, the configuration method of router 1 is the same.

In this static route, via network and subThe network mask sets the specific IP or network segment of the computer that needs to be reached, and the next hop is to set the IP of other routers connected to router 0 (in the same network segment, so the default subnet mask is the same), indicating that the data is forwarded by this router..There are several ways to set the routing table of router 0
Host-specific routing

thisThe method is to directly determine the IP of the target computer, and the range is the IP of a specific computerNetwork routing

this waySet the network segment where the target computing is located. If switch 3 is connected to computer 4 in the above figure, it can also be reached. The range is the upper right or lower right network segmentSummary route


This method enables all computers in the above network segment to receive data,The range is the entire network segment on the right (provided that all computers meet the above network segment)Default route

this wayThat is, when the router does not know how to go, it will choose to take the default route, that is, the next hop (If there is a designated route, then the designated route is preferred), and the range is larger than the above summary.The route is wider, as long as all the network segments connected to the next hop router can go
NAT (Network Address Translation)
Before explaining NAT, you first need to know the public IP and private IP
- Public network IP: The routers on the Internet only have the routing table for reaching the public network, but not the routing table for reaching the private network. The public network IP is uniformly allocated and managed by the Internet Network Information Center (Internet NIC), and the ISP(Internet service providers, such as mobile, telecommunications, etc.) need to apply for a public network IP from the Internet NIC
- Private network IP: mainly used for LAN, the following are reserved private network segments
- Class A: 10.0.0.0/8, 1 Class A network
- Class B: 172.16.0.0/16 ~ 172.31.0.0/16, 16 Class B networks
- 192.168.0.0/24 ~ 192.168.255.0/24, 256 Class C networks
General home networks are private IPs. When we want to access the Internet (public IP), we need to perform NAT translation, which will convert the private IP to the public IP. This step can be done by the router.For example, search the local IP address on a search engine, which is the converted public IP address (not necessarily the IP address of the router at home, because it may be that many routers have undergone multiple NAT translations)

The feature of NAT is that it hides the internal real IP and saves public IP resources at the same time.NAT is divided into the following ways:
- Static conversion: Manually configure the NAT mapping table to convert public IP and private IP one-to-one. This method cannot achieve the purpose of saving public IP and is not commonly used
- Dynamic conversion: Define an external IP address pool, and dynamically and randomly convert public network IP and private network IP one-to-one, still can not achieve the purpose of saving public network IP, not commonly used
- PAT (Port Address Translation): It can perform many-to-one conversion between multiple private network IPs and one public network IP, saving public network IP resources to the greatest extent.Using port multiplexing, each private network IP corresponds to a unique port number, and different data streams are identified by the port number.This is currently the most widely used NAT implementation.
边栏推荐
- Biotin-Dadps-azide|CAS:1260247-50-4|生物素-DADPS-叠氮
- JSP自定义标签
- 网络协议01 - 基础概念
- 【无标题】
- From installation to compilation: 10 minutes to teach you to use and develop GraphScope locally
- MongoDB-查询
- Event Delivery and Responder Chains
- ParseException line 8:13 mismatched input ‘(‘ expecting ) near ‘int‘ in create table statement
- I can't hide it, I want to expose the bad things about cloud native
- Ingress:从静态图分析到动态图分析
猜你喜欢

prometheus-basic_auth加密配置

测试开发工程师成长日记018 - 测试面试必备题记录(持续更新)

网络协议04 - 物理层和数据链路层

prometheus监控minio

Graph analysis like NetworkX with GraphScope

用于标记蛋白质和抗体的Biotin-LC-Sulfo-NHS|CAS:191671-46-2

kubernetes搭建SonarQube进行代码扫描

图扑软件携手华为云再创合作共赢新局面

The Force Plan Microservices | Centralized Configuration Center Config Asymmetric Encryption and Security Management

网络协议01 - 基础概念
随机推荐
大厂年薪50w+招聘具有测试平台开发能力的测试工程师
How to create a shortcut without the "shortcut" suffix?
测试开发工程师成长日记007 - Bug的优先级定义及填写规范
prometheus监控nacos
THREEJS导入外部OBJ+MTL后内存优化
Unity Shader 空间坐标系
Desthiobiotin-PEG4-Acid|脱硫生物素-PEG4-酸| 供应商和制造商
Network Protocol 01 - Basic Concepts
JSP自定义标签
libgrape-lite on GPUs:GPU助力加速图分析任务
比尔·盖茨买百万亩农地成美“头号地主”,图扑数字孪生农场
Graph Computing 101: Types, Languages, and Systems of Graph Computing
Azide-SS-biotin|CAS:1620523-64-9|生物素-二硫键-叠氮可降解 (cleavable) 的 ADC linke
Biotin-C6-amine_N-生物素基-1,6-己二胺_CAS:65953-56-2_100mg
Unity Shader标准光照模型——高光反射
Biotin-NH2|CAS:111790-37-5(生物素-氨基)是一种生物素化化合物
GNNLab: A Novel GNN System Based on Spatial Sharing Ideas
I can't hide it, I want to expose the bad things about cloud native
GAIA-IR: Parallelized Graph Query Engine on GraphScope
Unity 渲染流水线