← Back to Hub ← 返回主页

Week 10: Client/Server Computing (Part 1) 第 10 周:客户机/服务器计算(第一部分)

Core Concepts 核心概念

1. Client/Server Architecture (7.1 - 7.2)

  • Thin Clients: Do not perform any application logic processing locally. They only run user interface display services, offloading all calculation/data processing to the remote server (e.g. web browser based systems).
  • Thick Clients: Execute significant application processing logic locally on the client machine itself. They rely on the server mainly for data storage and transaction management (e.g. desktop software like Cisco Packet Tracer, PC games).
  • 2-Tier vs 3-Tier: 2-Tier connects client directly to the database. 3-Tier introduces a middle Application/Middleware Tier between the presentation client and database server, improving security, scalability, and flexibility.

2. Middleware Functions (7.3)

Middleware is specialized software that connects heterogeneous client and server systems, enabling them to communicate, share data, and interoperate seamlessly. It shields applications from transport details and platform differences (e.g., RPC, Message Queues).

1. 客户机/服务器架构 (7.1 - 7.2)

  • 瘦客户端 (Thin Client):本地不执行任何应用业务逻辑。它们只运行用户界面显示,将所有计算、数据处理任务卸载到远端服务器(例如基于网页浏览器的系统)。
  • 胖客户端 (Thick Client):在客户端机器本地执行大量的应用业务逻辑。它们主要依靠服务器进行数据存储和事务管理(例如 Cisco Packet Tracer 软件、大型单机/网络游戏)。
  • 双层与三层架构:双层架构将客户端直接连接到数据库。三层架构在表示客户端与数据库服务器之间引入了一个中间件(应用服务器)层,提高了安全性、可扩展性和系统灵活性。

2. 中间件作用 (7.3)

中间件是位于客户端和服务器之间的专用软件,它能够连接异构系统,使它们能无缝地通信、共享数据并协同工作。它对开发者屏蔽了低层网络传输细节和不同操作系统的兼容性差异(如 RPC、消息队列)。

Concept Visualization: 3-Tier Client/Server Architecture 概念可视化:三层客户机/服务器架构

Client Tier Middleware (App Server) Database Tier

Tips 提示

  • Thick vs. Thin Client tradeoffs: Thick clients provide a richer, faster local UI experience because they execute code locally, but they are harder to maintain because updates must be installed on every device. Thin clients are easy to update centrally but rely heavily on high-speed network connectivity.
  • RPC Middleware: Remote Procedure Call (RPC) middleware makes a call to a function on a remote server look identical to a local function call, hiding the networking details from developers.
  • 胖客户端与瘦客户端权衡:胖客户端由于在本地执行代码,提供了更丰富、更快的本地 UI 体验,但由于更新必须安装在每个设备上,因此更难维护。瘦客户端易于进行集中更新,但高度依赖高速网络连接。
  • RPC 中间件:远程过程调用 (RPC) 中间件使对远程服务器上函数的调用看起来与本地函数调用完全相同,从而对开发人员隐藏了网络细节。

Practical Exercises & Step-by-Step Guide 实践练习与分步指南

Exercise 1: 3-Tier Network Topology Setup in Cisco Packet Tracer 练习 1:Cisco Packet Tracer 中的三层网络拓扑配置

Steps to configure:

  1. In Packet Tracer, drag a **3560 Layer 3 Multilayer Switch**. Connect a Client PC, an App Server, and a DB Server to it using Straight-Through cables.
  2. Configure VLANs on the Layer 3 Switch:
    Switch# configure terminal
    Switch(config)# vlan 10
    Switch(config-vlan)# name Client-VLAN
    Switch(config-vlan)# vlan 20
    Switch(config-vlan)# name App-VLAN
    Switch(config-vlan)# vlan 30
    Switch(config-vlan)# name DB-VLAN
  3. Assign interfaces to respective VLANs:
    Switch(config)# interface fastEthernet 0/1
    Switch(config-if)# switchport mode access
    Switch(config-if)# switchport access vlan 10
    Switch(config-if)# interface fastEthernet 0/2
    Switch(config-if)# switchport mode access
    Switch(config-if)# switchport access vlan 20
    Switch(config-if)# interface fastEthernet 0/3
    Switch(config-if)# switchport mode access
    Switch(config-if)# switchport access vlan 30
  4. Enable IP Routing and configure Switched Virtual Interfaces (SVIs) as default gateways:
    Switch(config)# ip routing
    Switch(config)# interface vlan 10
    Switch(config-if)# ip address 192.168.10.1 255.255.255.0
    Switch(config)# interface vlan 20
    Switch(config-if)# ip address 192.168.20.1 255.255.255.0
    Switch(config)# interface vlan 30
    Switch(config-if)# ip address 192.168.30.1 255.255.255.0
  5. Assign IP addresses to hosts (e.g. PC: `192.168.10.10` gateway `192.168.10.1`). Verify you can ping across VLANs.

配置步骤:

  1. 在 Packet Tracer 中,拖入一个 **3560 三层多层交换机**。使用直通线将客户端 PC、应用服务器和数据库服务器连接到该交换机。
  2. 在三层交换机上配置 VLAN:
    Switch# configure terminal
    Switch(config)# vlan 10
    Switch(config-vlan)# name Client-VLAN
    Switch(config-vlan)# vlan 20
    Switch(config-vlan)# name App-VLAN
    Switch(config-vlan)# vlan 30
    Switch(config-vlan)# name DB-VLAN
  3. 将物理接口分配给相应的 VLAN:
    Switch(config)# interface fastEthernet 0/1
    Switch(config-if)# switchport mode access
    Switch(config-if)# switchport access vlan 10
    Switch(config-if)# interface fastEthernet 0/2
    Switch(config-if)# switchport mode access
    Switch(config-if)# switchport access vlan 20
    Switch(config-if)# interface fastEthernet 0/3
    Switch(config-if)# switchport mode access
    Switch(config-if)# switchport access vlan 30
  4. 启用 IP 路由功能并配置交换虚拟接口 (SVI) 作为默认网关:
    Switch(config)# ip routing
    Switch(config)# interface vlan 10
    Switch(config-if)# ip address 192.168.10.1 255.255.255.0
    Switch(config)# interface vlan 20
    Switch(config-if)# ip address 192.168.20.1 255.255.255.0
    Switch(config)# interface vlan 30
    Switch(config-if)# ip address 192.168.30.1 255.255.255.0
  5. 为各主机配置静态 IP 地址(例如 PC: `192.168.10.10` 网关 `192.168.10.1`)。验证跨 VLAN 的 ping 是否通畅。

Exercise 2: Capture and Analyze Database Connection Ports 练习 2:捕获和分析数据库连接端口

Steps to analyze:

  1. On a host client connected to a MySQL database, open **Wireshark**. Select your active interface and click start.
  2. Run your application or script that connects to the database and submits a query (e.g. `SELECT * FROM employees;`).
  3. Go back to Wireshark, click stop.
  4. In the display filter, enter: tcp.port == 3306.
  5. Select one packet, expand the **Transmission Control Protocol** header in the packet details panel, and note the Source Port and Destination Port.

分析步骤:

  1. 在连接到 MySQL 数据库的主机客户端上打开 **Wireshark**。选择您的活动物理接口,然后点击开始。
  2. 运行连接至数据库并提交查询的应用程序或脚本(例如 `SELECT * FROM employees;`)。
  3. 返回 Wireshark,点击停止。
  4. 在显示过滤器中输入: tcp.port == 3306。
  5. 选择任意一个数据包,在数据包详细信息面板中展开 **Transmission Control Protocol**(传输控制协议)头部,记录源端口与目的端口。

Self-Check Practice Questions 自测练习题

1. What does an IPv4 address represent? 一个 IPv4 地址代表什么?

2. Describe routing in data networks. 描述数据网络中的路由。

3. Identify which device connects two different networks and makes forwarding decisions. 识别哪种设备连接两个不同的网络并做出转发决策。

4. Explain the role of a default gateway in host IP settings. 解释主机 IP 设置中默认网关的作用。

5. Describe a key difference between Classless and Classful IP addressing. 描述无类与有类 IP 地址分配之间的一个关键区别。

6. Identify the primary function of a network router. 识别网络路由器的主要功能。

7. Explain a key benefit of dynamic routing protocols over static routing. 解释动态路由协议相比于静态路由的一个核心优势。

8. Compare static routing and dynamic routing. 对比静态路由与动态路由。

Vocabulary Matching Game 词汇配对游戏

Match the IP/Routing term on the left with its definition on the right. (Click a term, then click its matching definition). 将左侧的 IP/路由术语与右侧的定义进行配对。(点击术语,然后点击匹配的定义)。

IPv4 Address
Router
Default Gateway
Dynamic Routing
Static Routing
Local router interface address to send out-of-subnet packets 发送跨越子网数据包时所指向的本地路由器接口 IP 地址
32-bit unique logical identifier for a host network card interface 主机网卡接口的 32 位唯一逻辑标识符
Manually configured path entries in the router routing table 由管理员在路由器路由表中手动配置的路径条目
Layer 3 intermediate system that forwards packets between networks 在不同网络之间转发数据包的三层中间网络设备
Path discovery using protocol exchanges to adapt to changes 使用协议交换自动发现路径以适应拓扑改变

Review Questions 复习问答题

Q1. Describe the functions of the Physical layer and the Data Link layer in the OSI reference model.

Q2. Describe the role and key functions of the Transport layer in the OSI reference model.

Q3. Explain the layer interactions (Application, Transport, Network) and the processes of encapsulation/decapsulation during web browsing.