当前位置:网站首页>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-LC-Sulfo-NHS|CAS:191671-46-2

Biotin-Dadps-azide|CAS:1260247-50-4|生物素-DADPS-叠氮

flask项目快速搭建部署gunicorn+supervisor

Biotin-NHS LC(72040-63-2)生物素接头|站点特定探针

Jenkins一些常见问题

Ingress:从静态图分析到动态图分析

Biotin-PEG4-DADPS-Picolyl-azide(CAS:2599839-59-3)生物素试剂

图扑数字孪生青岛城轨,赋能智慧交通低碳发展

Test Development Engineer Growth Diary 003 - Interface Automation Framework Construction

为数字政府构建智能化网络安全管控体系
随机推荐
libgrape-lite: 提供 GraphScope 的图分析能力
大厂年薪50w+招聘具有测试平台开发能力的测试工程师
不依赖框架的文件下载
Unity 渲染流水线
Alamofire源码分析 - POST请求
一种新的DNA生物素系统Biotin LC hydrazide|CAS:109276-34-8|(+)-生物素酰胺基己酸肼
基于精灵(Sprite)管道烟雾流动效果
网络协议04 - 物理层和数据链路层
Biotin-SS-NHS ester|生物素-二硫键-活性酯|CAS:122266-55-1具有良好的水溶性
prometheus监控minio
网络协议03 - 路由和NAT
测试开发工程师成长日记009 - 环境排排站:开发环境、测试环境、生产环境、UAT环境、仿真环境
测试开发工程师成长日记002 - 从0开始做接口自动化
SE_01
05-Theos
使用 Helm 部署 GraphScope
Graph Computing 101: Types, Languages, and Systems of Graph Computing
prometheus-basic_auth加密配置
JSP自定义标签
How to import matlab data into modelsim simulation