当前位置:网站首页>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-PEG4-SS-Alkyne_1260247-54-8_生物素-PEG4-SS-炔烃
- Azide-SS-biotin|CAS:1620523-64-9|生物素-二硫键-叠氮可降解 (cleavable) 的 ADC linke
- 测开基础知识02
- 用 GraphScope 像 NetworkX 一样做图分析
- MySQL common commands and mysqldump backup
- Build an intelligent network security management and control system for digital government
- 04-packing and unpacking
- 牛客:删除公共字符
- 陕西Biotin-LC_CAS:72040-64-3_N-生物素氨基己酸供应商价格
- Event Delivery and Responder Chains
猜你喜欢
随机推荐
OP 代币和不可转让的 NFT 致力于建立新的数字民主
how to use xilinx's FFT ip
陕西Biotin-LC_CAS:72040-64-3_N-生物素氨基己酸供应商价格
Mastering JESD204B (2) – Debugging of AD6676
测试开发工程师成长日记016 - 关于提测的那些事
Unity Shader 空间坐标系
不依赖框架的文件下载
PC DBCO-PEG3-Biotin|PC-生物素-PEG3-DBCO可用于使用无铜点击化学
Test Development Engineer Growth Diary 003 - Interface Automation Framework Construction
MySQL common commands and mysqldump backup
测试开发工程师成长日记003 - 接口自动化框架搭建
图计算在网络安全分析中的应用
彻底删除openstack中镜像的记录
元宇宙与图扑国风的碰撞,科技与文化的虚实融合
Shortcut keys commonly used in the use of Word
Redis6的数据类型
mysql常用命令以及mysqldump备份
Desthiobiotin-PEG4-Acid|脱硫生物素-PEG4-酸| 供应商和制造商
测试开发工程师成长日记008 - 浅谈一些Bug/用例管理平台/协作平台
测开基础知识01