当前位置:网站首页>内网IP和公网IP的区别及作用
内网IP和公网IP的区别及作用
2022-06-27 21:36:00 【全栈程序员站长】
大家好,又见面了,我是你们的朋友全栈君。
内网IP和公网IP的区别及作用
参考链接:https://baijiahao.baidu.com/s?id=1665320351852255921&wfr=spider&for=pc
说明:本文仅是针对网络知识懵懂人事的一篇白话解说文,并非技术探讨及进阶文章,各位看官自行甄选;本文仅以ipv4为基础。
使用网络的人必然会接触IP地址,ip地址又分内网(私有)ip和公网(外网)ip地址,那么他们之间的区别是什么?为什么要分为内网和外网ip?何时使用哪种ip今天我就用大白话的形式,给大家举一个例子,希望能对各位对于ip有一个初步的了解。
拿一个家庭来举例,一般你的路由器以内,就是内网,并且路由器内连接的所有设备或终端都会被分配一个内网ip;反之,路由器及以外就是外网ip,这个外网ip通常在路由器的WAN口上。如果你路由器用的透明模式、桥接模式等咱们暂且不在本文解释。
那么无论内网ip还是外网ip都是以点分十进制的形式显示的如192.168.1.1,这个192.168.1.1就是内网ip,下面我列个表,显示出目前所有ipv4地址的分类
【1】A类地址:1.0.0.0~127.255.255.255
【2】B类地址:128.0.0.0~191.255.255.255
【3】C类地址:192.0.0.0~223.255.255.255
【4】D类地址:224.0.0.0~239.255.255.255
【5】E类地址:240.0.0.0~255.255.255.255
1、A类地址范围:1.0.0.1—126.155.255.254(127.0.0.1 为保留地址,一般用于环回地址)
①10.x.x.x是私有地址(所谓的私有地址就是在互联网上不能使用,而被用在局域网中的地址)。
②127.x.x.x是保留地址,用作循环测试用
2、B类地址范围:128.0.0.1—191.255.255.254
① 172.16.0.0—172.31.255.255是私有地址
② 169.254.x.x是保留地址。如果IP地址是自动获取IP地址,而在网络上又没有找到可用的DHCP服务器,就会得到其中一个IP。
3、C类地址范围:192.0.0.1—223.255.255.254
① 192.168.0.0–192.168.255.255是私有地址
4、D类地址范围:224.0.0.1—239.255.255.254
5、E类地址范围:240.0.0.1—255.255.255.254
重点来了:说了半天,可能对于懵懂人事有些迷茫了,其实上面的列表你只要记住大致哪个网段属于内网(私有)哪些属于公网(外网)就足够了。
红圈属于内网,之外就是公网
那么我们为什么要分内网和外网ip呢?简单来说就是因为ip地址(ipv4)数量有限和管理上的需要。
具体的例子来了,假如我们把ip地址看成一个我们日常快递中填写的收件方地址,可能就比较好了解了。
比如我们要寄信到X省X市X区X大道9号X小区1号楼1单元101室,那么其中“X省X市X区X大道9号”可以理解为公网ip,“X小区1号楼1单元101室”就可以理解为内网ip。
试想一下,如果我们想给某人寄信,只写“X小区1号楼1单元101室”,那谁也找不到这个小区在哪,是不是?反过来,我们只写“X省X市X区X大道9号”,信应该给谁?这个谁又具体在哪个建筑的哪层哪号?也没人知道。也就是说公网ip是大家能通过这个地址找到的,内网ip是具体哪个人接收。
有人问了,小区里可能有1号楼,2号楼,每个楼又有1单元,2单元,每个单元都有101,又如何区分呢?知道内网和公网ip了,我们又是如何通信的呢?这里就要涉及到网关、路由等更深层次的知识了,我们以后有时间再聊。
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/133029.html原文链接:https://javaforall.cn
边栏推荐
- Sentinel
- Google Earth Engine(GEE) 03-矢量数据类型
- [learn FPGA programming from scratch -48]: Vision - development and application of intelligent sensors
- 手把手教你移植 tinyriscv 到FPGA上
- At the beginning of reading English literature, I would like to ask you how you should read it in the first place?
- [digital ic/fpga] detect the position of the last matching sequence
- golang使用mongo-driver操作——查(基础)
- Msp430f5529 MCU reads gy-906 infrared temperature sensor
- Instructions for vivado FFT IP
- After a period of silence, I came out again~
猜你喜欢

2022 PMP project management examination agile knowledge points (3)
![[idea] idea formatting code skills](/img/06/38079517e901bc48dc4ca0f8cc63fe.jpg)
[idea] idea formatting code skills

一文剖析C语言函数

Smart wind power | Tupu software digital twin wind turbine equipment, 3D visual intelligent operation and maintenance

【Try to Hack】veil-evasion免杀

Windows环境下的ELK——Logstash+Mysql(4)
![[tinyriscv verilator] branch transplanted to Da Vinci development board of punctual atom](/img/a8/4786e82d0646b08c195dd0a17af227.png)
[tinyriscv verilator] branch transplanted to Da Vinci development board of punctual atom

【tinyriscv verilator】分支移植到正点原子达芬奇开发板

ASP.NET仓库进销存ERP管理系统源码 ERP小程序源码

Zero foundation self-study SQL course | case function
随机推荐
Is it safe to open a stock account through the account opening QR code of CICC securities manager? Or is it safe to open an account in a securities company?
mysql读写分离配置
webService
golang使用mongo-driver操作——查(基础)
安全省油環保 駱駝AGM啟停電池魅力十足
C WinForm reads the resources picture
Safe, fuel-efficient and environment-friendly camel AGM start stop battery is full of charm
股市小白在网上股票开户安全吗?
At the beginning of reading English literature, I would like to ask you how you should read it in the first place?
Although the TCGA database has 33 cancers
十大券商注册账户安全吗,会有风险吗?
Flutter series: Transformers in flutter
Mise en œuvre du pool de Threads: les sémaphores peuvent également être considérés comme de petites files d'attente
virtualbox扩展动态磁盘大小的坑
使用cef3开发的浏览器不支持flash问题的解决
Does the subscription of Siyuan notes stop deleting cloud data directly?
【Try to Hack】veil-evasion免杀
【论文阅读|深读】SDNE:Structural Deep Network Embedding
Use of go log package log
【AI应用】NVIDIA Tesla V100S-PCIE-32GB的详情参数