2.2 The Internet 互联网

Internet 和 WWW 的区别

Internet:

  • (Internet 的定义)The internet is a massive network of networks which are made up of various computers and other electronic devices;

  • It stands for interconnected network;

  • The internet makes use of transmission control protocol (TCP) / internet protocol (IP).

WWW (World Wide Web):

  • (WWW 的定义)A collection of multimedia web pages and other documents which are stored on websites;

  • http(s) protocols are written using HyperText Mark-up Language (HTML);

  • Uniform Resource Locators (URLs) specify the location of all web pages;

  • Web resources are accessed by web browsers;

  • The world wide web uses the internet to access information from servers and other computers.

连接互联网的要求:

  • Device; (such as a computer, tablet , mobile phone)

  • Telephone line connection or mobile phone network connection; (tablet or mobile phone may connect to internet using a wireless router)

  • Router and modem; (which can be wired or wireless)

  • Internet Service Provider (ISP); (combination of hardware and software)

  • Web browser. (Software)

Telephone lines have changed from copper cables to fibre optic cables, which permits greater bandwidth and faster data transfer rates and less risk of data corruption from interference.

Fibre optic telephone networks are fast broadband. High speed communication links allow telephone and video calls to be made using computer and internet. Video calls require a webcam. When using internet to make a phone call, user's voice is converted to digital packages using Voice over Internet Protocol (VoIP). Data is split into packages (packets witching) and sent over network via fastest route.

在城镇中,电话网络系统被用于连接电脑/设备和 LAN. 整个网络被叫作 公共交换电话网(Public Switched Telephone Network, PSTN)

早期的电话使用 模拟声音数据(Analogue Voice Data)

PSTN 和 Internet 打电话的区别

DescriptionPSTNInternet
connection only in use whilst sound is being transmitted 
dedicated channel used between two points for the duration of the call 
connection maintained throughout the telephone call 
encoding schemes and compression technology used 
lines remain active even during a power outage 

IP 地址

(定义)IP address is unique address for device on a network.

Internet is based on TCP/IP protocols. IP Protocols define rules that must be agreed by senders and receivers on internet.

IPv4

互联网中最常用的是 IPv4 地址。IPv4 地址由 32 个 bit 构成,一共有 232 (大约 40 亿)个 IPv4 地址。

IPv4 地址的特点:

  • An IPV4 address is made up of a network ID and Host ID;

  • IPv4 is composed of four integer numbers; (denary or hexadecimal)

  • Each integer number in range of 0-255 (denary) or 00-FF (hexadecimal);

  • Each digit is stored as one byte or complete IP is stored as 32 bits / 4 bytes;

  • 32 bits are split into four groups of 8 bits (range of 0 to 255);

  • It is represented by dotted decimal notation as, aaa.bbb.ccc.ddd;

  • First part of IPv4 is Network identifier and second part is Host identifier.

System uses group of bits to define network (net ID) and network host (host ID). The net ID allows for initial transmission to be routed according to net ID and then host ID is looked at by receiving network.

Network ClassIPv4 rangeNumber of net ID bitsNumber of host ID bitsTypes of Network
A0.0.0.0 to 127.255.255.255824Very Large
B128.0.0.0 to 191.255.255.2551616Medium Size
C192.0.0.0 to 223.255.255.255248Small Networks
D224.0.0.0 to 239.255.255.255--Multi-Cast
E240.0.0.0 to 255.255.255.255--Experimental

In Class A, leading bit will be 0; In Class B leading bit will be 10 and in Class C, leading bit will be 110.

Class D is used for multicasting (Group of recipient used by router) and Class E is reserved for future use for research and development.

IPv4 system provides insufficient address range.


Classless Inter-Domain Routing (CIDR)

为了改善 IPv4 地址范围不足的状况,出现了第一种增加寻址方案的技术:无类域间路由(Classless Inter-Domain Routing, CIDR)技术。在传统体系中,IPv4 地址被固定划分为 A、B、C 等类别(见前文),每类都有固定的网络前缀长度,由于这些类别的划分太过僵硬,导致 IPv4 地址浪费和路由表膨胀的问题。CIDR 不再使用固定的类别划分,而是采用可变长度子网掩码(VLSM,Variable Length Subnet Mask) 来灵活地定义网络范围。如:

A suffix is used, in format <IPv4 Address> / <suffix>, which means <suffix> bits will be used for net ID and last other bits will be used for host ID.

192.168.1.0/24 表示前 24-bit 作为 net ID,后 8-bit 作为 host ID(256个地址)。

192.168.1.0/26 表示前 26-bit 作为 net ID,后 6-bit 作为 host ID(64个地址)。

Suffix 的作用:Increases flexibility regarding which bits represent net ID and which present host ID.

CIDR 的作用范围:CIDR allow already existing Class A, B or C addresses to be used with suffixes 8, 16 or 24.

Sub-Netting 子网划分

子网划分(Sub-Netting) 是一种将一个IP地址块拆分成多个小网络(子网)的技术,目的是提高IP地址利用率、优化网络管理、减少广播流量,并增强网络安全性。

Note

Sub-Netting: Process of dividing a larger network into smaller sub-networks, known as subnets.

子网划分的作用:Allows more efficient use of host ID by applying a structure to it.

CIDR is actually based on sub-netting.

子网划分的优点:

  • Subnetting is useful in organizations with multiple departments. Each department can have its own subnet with its IP address range, facilitating network management and segmentation;

  • Organise a large network into smaller, more manageable sub-networks which reduce amount of traffic in a network which improves network speed;

  • Improve network performance by reducing network congestion and increasing network efficiency; Allow for better utilization of IP addresses by dividing them into smaller subnetworks, reducing IP address waste.

  • When network issues occur, subnetting heIPs isolate problem to specific subnet, making it easier to identify and resolve issues without affecting entire network.

Important

To enable communication between devices on different subnets, routers are used to route traffic between subnets.

Public and Private IP Address

Public IP Address(公网 IP 地址) 和 Private IP Address(私有 IP 地址)** 是两种用于设备通信的 IPv4 地址类型,主要区别在于是否可在互联网上直接访问。

Private IP Address

Note

Private IP Addresses: Unique addresses that your network router assigns to your device.

Private IP Address 的特点:

  • Used within a private network to connect securely to other devices;

  • Reserved for internal use behind router or NAT device.

以下 3 组 IP 地址被预留用于私有 IP 地址,不作为公网 IP 使用:

Class A10.0.0.0 to 10.255.255.25516,777,216 possible addresses
Class B172.16.0.0 to 172.31.255.2551048,576 possible addresses
Class C192.168.0.0 to 192.168.255.25565,536 possible addresses

Note

Private IP Address 的优点:

  • A private address is more secure;

  • Address is unique within their network and can be duplicated within other networks;

  • NAT is necessary for private IP address to access Internet directly.

Public IP Address

Note

Public IP Addresses: Unique IP addresses assigned to your network router by your ISP and can be accessed directly over Internet.

使用 Public IP Address 的设备举例:

  • DNS Servers;

  • Network Routers;

  • Directly-controlled Computers.

Private IP Address 的特点:

  • Public address is less secure than a private address;

  • A public IP address can be accessed over the internet;

  • It can be static or dynamic. Static is for hosting websites or services on internet.

公网 IP 分为 静态 IP 地址(Static IP Address)动态 IP 地址(Dynamic IP Address)两种。

Note

Static IP Address: Fixed IP address that remains same even after a device disconnects and rejoins a network.

Static IP Address 的使用场景:Assigned to servers and routers, and is manually assigned by a network administrator or an Internet Service Provider (ISP).

Static IP Address 的特点:

  • A fixed IP address that never changes;

  • Manually assigned by network administrator or ISP;

  • Used by servers, websites, and other network devices that need to be constantly accessible;

  • More secure, as it is easier to track who is accessing the network;

  • More expensive as ISP will charge monthly fee from user. It requires additional configuration and management.

Note

Dynamic IP Address: Type of IP address that is assigned automatically by a network's Dynamic Host Configuration Protocol (DHCP) server or router, and can change periodically when a device disconnects and rejoins a network.

Dynamic IP Address 的特点:

  • Dynamic IP address can change periodically;

  • Assigned automatically by the network;

  • Used by residential internet users and smaller businesses;

  • Less secure, as it is more difficult to track who is accessing the network;

  • More cost-effective as ISP can reuse IP addresses that are not currently in use;

  • Use of Dynamic IP Address is convenient for users, as they do not have to manually configure their IP address.

Network Address Translation

网络地址转换(NAT, Network Address Translation) 是一种用于在本地网络(LAN)和互联网之间转换 IP 地址的技术,主要用于解决 IPv4 地址短缺、提高网络安全性,并允许多个私有 IP 共享一个公网 IP 访问互联网。

NAT box has one IP address which is visible over Internet and so can be used as a sending address or as a receiving address. Internally IP addresses have to be chosen from one of three ranges of private IP addresses that have been allocated for networks.

NAT 技术的原理:

  • When a user sends a packet from a computer to a server over internet, NAT server swaps private IP address for a public IP address and attaches a Port ID to packet.

  • NAT server keeps track of which computers are assigned to which private IP address so that when a packet returned to port, it can swap that public IP address on packet back to private IP address and send it through LAN to correct computer.

IPv6

IPv6 用于取代 IPv4,它的主要目标是提供足够的 IP 地址空间,并改进网络安全和性能。

IPv6 地址的格式:8 groups of 4 hexadecimal digits, separated by colons(:), for total of 32 hexadecimal digits.

如:2001:0db8:85a3:0000:0000:8a2e:1428:57ab

Note

IPv6 比起 IPv4 的优点:

  • IPv6 has no need for NATs;

  • IPv6 removes risk of private IP address collisions;

  • IPv6 has built in authentication;

  • IPv6 allows for more efficient routing.

  • Multicast Support: Allows for efficient distribution of data to multiple devices. This is particularly useful for applications such as video streaming and online gaming.

使用 Zero Compression 来表示 IPv6 地址

通过将 IPv6 地址中连续的若干个 0000 压缩为双冒号,可以实现 IPv6 地址的 Zero Compression. 如:

示例地址 2001:0db8:85a3:0000:0000:8a2e:1428:57ab 可以被表示为 2001:0db8:85a3::8a2e:1428:57ab .

但是若某 IPv6 地址中出现了多组不连续的 0000 段,则为了避免歧义,最多只能对其中最长的一组进行 Zero Compression. 如:

示例地址 2001:0db8:85a3:0000:1235:0000:0000:1428 只能被压缩为 2001:0db8:85a3:0000:1235::1428,而不能被压缩为 2001:0db8:85a3::1235::1428。因为在第二种情况下,无法确认每一组中 0000 的数量(最后一种情况既可以理解为 ...:0000:0000:1235:0000:1428 也可以理解为 ...:0000:1235:0000:0000:1428,造成歧义)。

同时,还可以结合 Leading Zero Compression 来表示 IPv6 地址,如:

对于示例地址 2001:0db8:0000:0000:0000:0000:0001:2345,先应用 Leading Zero Compression,删除所有的前导 0,得到:

2001:db8:0:0:0:0:1:2345

再使用 Zero Compression,得到最终压缩的结果:

2001:db8::1:2345

如果需要在 IPv6 地址格式中使用 IPv4 地址,则使用 :: + IPv4 地址 的格式,如:

要在 IPv6 中使用 192.0.2.0 这个地址,则应表示为 ::192.0.2.0 .

Note

IPv6 地址的优点:

  • Larger Address Space: IPv6 provides much larger address space than IPv4's addresses which eliminates need for NAT that is commonly used in IPv4. This also removes risk of private IP address collision because of its larger address space;

  • Improved Security: IPv6 includes built-in features for security. Data transmitted over internet is secure and protected from unauthorised access;

  • More Efficient Routing: IPv6 uses simplified header format and allows more efficient routing, which reduces burden on routers and improves network performance;

  • Automatic Address Configuration is a feature which simplifies network administration by allowing devices to automatically configure their own unique IP addresses;

  • Multicast Support: Allows for efficient distribution of data to multiple devices. This is particularly useful for applications such as video streaming and online gaming.

URL

统一资源定位符(Uniform Resource Locator, URL)是网页地址,用于定位互联网上的资源(如网页、图片、视频、文件等)。它告诉浏览器如何找到所需资源,并使用适当的协议进行访问。一般来说,URL 可以是一个 IPv4 地址,如 192.0.2.0,也可以是以下格式:

URL 组成部分示例作用
协议(Protocol / Scheme)http, https, ftp指定通信协议
网站地址(Website Address)www.example.com服务器地址
路径(Path)/path/to/page服务器上的资源路径
文件名index.php服务器上的资源文件名

其中,网站地址分为以下几部分:

部分示例作用
主机名(Domain Host)www指定服务器或子域(子网)
域名名称(Domain Name)example代表指定的品牌或组织,由服务器持有者向 ISP 等购买
域名类型(Domain Type)/ 国家代码(Country Code)com, cn指定网站类型或国家 / 地区

如:

或:

DNS Service

域名系统(Domain Name System, DNS)服务是将域名转换为 IP 地址的服务,使用户能够通过易记的域名访问网站,而无需记住复杂的 IP 地址。

Note

Domain Name System:

  • Gives domain names for internet hosts;

  • a system for finding IP addresses of a domain name.

Domain names eliminate need for a user to memorise IP addresses.

DNS servers contain a database of URLs with matching IP addresses.

DNS Process:

  • User opens their web browser and types in URL https://ww.example.com and web browser asks DNS server (1) for IP address of website.

  • DNS server can't find https://ww.example.com in its database or its cache and sends out a request to DNS server (2).

  • DNS server (2) finds URL and can map it to 192.0.2.0; IP address is sent back to DNS server (1) which now puts the IP address and associated URL into its cache/database.

  • This IP address is then sent back to user's computer.

  • Computer now sets up a communication with website server and required pages are downloaded.

  • Web browser interprets HTML and displays information on user's screen.

DNS原理

例 3:

Compare and contrast IPv4 and IPv6 addressing in terms of structure, address space, and potential benefits.

解答:

IPv4 uses 32-bit addresses, offering around 4.3 billion unique addresses, but this limited space led to the adoption of IPv6.

IPv6 employs 128-bit addresses, providing a significantly larger address pool, which effectively resolves the address exhaustion issue faced by IPv4.

IPv4 addresses are typically represented in dotted-decimal format, whereas IPv6 uses hexadecimal notation.

The benefits of IPv6 over IPv4 include enhanced routing efficiency, improved security, and more straightforward address autoconfiguration.

These improvements position IPv6 as a more robust and scalable solution for the growing demands of internet connectivity.

练习 2

(a) Describe the structure of a URL and explain the significance of each component in the process of locating a web resource.

(b) Explain the core differences between the World Wide Web (WWW) and the internet. In your answer, highlight the primary function and protocols used for each.

章末测试

  1. A new company has been established. It has bought some new premises which consist of a number of buildings on a single site. It has decided that all of the computer workstations in the different buildings need to be networked. They are considering ways in which the network might be set up.

a One option they are considering is to use cabling for the network and to install it themselves.

i Name the three types of cabling that they might consider.
ii Explain two factors, other than cost, that they need to consider when choosing suitable cabling.

b Another option they are considering is to use wireless technology for at least part of the network.

i Explain one option that might be suitable for wireless networking.
ii Identify one advantage, other than cost, of using wireless rather than cable networking. iii Identify one disadvantage (other than cost) of using wireless rather than cable networking.

c The final option they are considering is to use the services of a PSTN.

i Define what a PSTN is or does.
ii Explain how a PSTN could provide a network for the company.

  1. The Domain Name System is vitally important for Internet users.

a If the designer has some images stored in files there are two possible formats for the files.

i Name the type of software used by the system and the type of hardware on which the software is installed.

ii Name two types of application that use the Domain Name System and for each give a brief description of how it is used.

b In the classful IPv4 addressing scheme, the 32-bit binary code for the address has the top (most significant) bit set to 0 if it is of class A, the top two bits set to 10 if class B or the top three bits set to 110 if class C. In a document an IPv4 address has been written as 205.124.16.152.

i Give the name for this notation for an IP address and explain how it relates to the 32-bit binary code. ii Identify the class of the address and explain your reason. iii Explain why an IPv4 address defines a netID and a hostID.

c If the CIDR scheme for an IPv4 address is used the IP address 205.124.16.152 would be written as:

205.124.16.152/24

State the binary code for the hostID in this address with a reason.

作者:张业浩  创建时间:2024-08-24 15:24
最后编辑:admin  更新时间:2025-03-17 12:31