Notes for FIT9137: Arch and Net notes

虽然在定义上是个基础课,但是实际上比国内的大计基深入的不是一点点。如果不是前阵子因为cryptocurrency mining的研究一直都在钻研底层,估计还挺难消化的。即便如此,不仔细的我到现在的quiz还是没能拿到过100……

Architecture

w1 到 w3 是非常快速且底层的计算机(与系统)架构介绍。

Network

w4 开始讲的就是Netowork的内容,直到w12,所以可以认为是整个课其实重点就在这里……

Introduction

网络的基本组成部分:Client,Sever,Router,Comm-Links(inter-connects network devices,换句话说就是medium)

网络的形式(规模):LAN(本地网络),BN(主干网),MAN(城域网),WAN(广域网)

还有个大一统的Internet

消息的传输

基于包交换的网络: 消息被分割为多个包packets

传输速率:

home2ISP: 1Mbps

home2home: 10-20Mbps

WLAN: 50-500Mbps

LAN: 1Gbps

BN: 10Gbps

光纤: Tbps

层级(Layers)与协议(Protocols)

TCP/IP模型

Layers
5. Application (App)
4. Transport (Logical conn)
3. Network (Routing)
2. Datalink (Low-level conn)
1. Physical (Hardware)

Switch: 1+2

Router: 1+2+3

Protocol Data Unit (PDU):

  1. Message (HTTP)

  2. Segment (TCP)

  3. Packet (IP)

  4. Frame (Ethernet)

  5. Bit

每一层都对数据会进行调制/解调(en/decapsulate),就类似tcp conn里套socks5再套ss/ssr一样

模块化设计

优秀的协议栈有三种特征:

低耦合(Low Coupling)高聚合(High Cohesive)无信息(Information Hiding)

Intro

物理层:直接连接设备

数据链接层:管理俩设备间的物理连接

物理层:主要焦点于如何将bits转换为信号以及转回bits

数据链接层:

  • Media Access Control:在设备发送时控制
  • Error Control:确保数据正确到达
  • Protocols:同步与异步传输
  • Transmission Efficiency:消息长度vs错误率
数字信号与模拟信号

老古董POTS: Plain Old Telephone Service

  • 语音在电话之间传递

  • 声音(模拟)转换成电波(麦克风)

  • 电波通过铜线传播

  • 电波(扬声器)转回声音

通过使用Modem来将数字信号转换成模拟信号

Modem(Modulator/Demodulator)

这里我们都使用正弦(sin)波。y = A * sin(f*2πX+φ) 波具有三个属性:

  • 振幅A
  • 频率f
  • 相位φ

数据链接层

两个子层

逻辑链接控制(LLC)

  • 处理PDU头
  • 错误控制
  • 定义与网络层的接口

媒体访问控制(MAC)

  • 在与物理层符号和frame之间编码/解码
  • 错误检测
  • 当设备传输时控制

[WIP]

LAN & WLAN

Why use a LAN

信息共享(文件,数据库,email等交流),资源共享(打印机等硬件,软件授权,公网连接)

LAN的类型

专用服务器LAN

  • 网络包含服务器和客户端

  • 每个服务器有一个或多个特定任务(e.g. DHCP,email…)

  • 最流行的企业网络

P2P LAN(例如家庭LAN,更便宜但性能更差)

  • 无专用服务器

  • 所有的计算机都作为服务端也作为客户端

专用服务器LAN P2P LAN
成本 贵(需要更多硬件) 便宜(重用存在的硬件)
性能 很高,可拓展 第,不太能拓展
可靠性 很高(企业级组件)
管理 更简单(中心化) 更困难

基础LAN组件

NOS(Network Operating System)

NIC(Network Interface Card)网卡

Switch

Cable

Client,Server

NIC网卡

实现了物理层与数据链接层

  • 包括独一无二的数据链接层地址(MAC Address)

  • 提供到网络的物理连接(socket插座或antenna天线)

  • 实现了协议(错误检测,frame构建,调制解调等等)

连接到电脑

  • 通常内置于主板
  • 或者通过USB/PCI-Express等接口连接
Network Cables网线

网络设备间的物理连接

不同的类别:

  • UTP (LAN最常用类型)

  • STP (防护双绞线)

  • 光纤 (当前LAN不常用)

  • 同轴线 (只有老LAN在用)

品名 数据速率 网线
10BASE-T 10Mbps UTP cat3 / cat5,三类线五类线
100BASE-T 100Mbps UTP cat5
1000BASE-T 1Gbps UTP 5e,6 <-现在常用
1000BASE-X 1Gbps 光纤 (单模式或多模式)
10GbE 10Gbps UTP cat6,ca7,光纤
40GbE/100GbE 40Gbps/100Gbps 光纤
NOS网络操作系统

用来访问与控制LAN的软件

  • 服务端NOS提供网络管理工具与网络服务
  • 客户端NOS提供访问网络服务的方式

由服务端NOS提供的服务

  • 文件夹服务
  • 网络与用户描述
  • 文件,web,打印,email服务器等等

NOS服务端软件

处理网络功能

  • 全协议栈(数据链接,网络,传输,应用层)
  • 包括应用软件如HTTP,FTP,SMTP,DHCP,LDAP,DHCP,DNS,SQL…

替代或加强普通操作系统

  • 可以得到服务器性能上的优化而非用户程序

例如

  • Linux
  • Microsoft Windows Server

NOS客户端软件

处理网络连接

  • 数据连接层,网络层,传输层
  • 和应用层交互
  • 曾经是分离的系统
  • 现在被整合进了所有的主流操作系统

客户端现在可以查阅与获取网络资源

  • 现在客户端可用的服务

以太网,集线器与交换机

主流LAN技术

  • 标准化如IEEE802.3
  • 被几乎所有LAN使用
  • 1973年开发,1980年被标准化

物理层

  • 起初是基于共享媒介的同轴电缆,10Mbps
  • 现在大多转换成了基于UTP的100Mbps或1Gbps网络
  • 光纤的标准能最高100Gbps

以太网
拓扑结构:

  1. 共享线路
  2. 星状(P2P)
  3. 多hub设计

以太网MAC(扼要重述)

基于意图的媒体获取

  • 设备间资源获取上的竞争
  • 如果设备同时发送frame会发生冲突

冲突

  • 没有被避免,但是可容忍可检测
  • 在小型和中型网络里非常高效

媒体获取控制(Media Access Control):CSMA/CD

  • 事件感知(CS):在线路上侦听,只在没有其他型号被感知时传输
  • 多重获取(MA):多个设备访问同一个介质
  • 冲突检测(CD):当非己信号被检测到
    传输拥挤信号(因此所有其他设备检测冲突)
    都在重新发送前等待随机时间

共享以太网中的问题
半双向:同一时间只有一个设备能够发送

W8

又到了不温习就不会做作业的地步了……

网络层: Routing

A router is a layer 3 device

  • one IP address per interface, i.e. typically per subnet it is connected to

  • Clients send packets to routers if destination is outside their own subnet

  • Routers use IP address to determine over where the packet is sent next

For each incoming packet, the router

  • looks at the packet’s destination IP
    address
  • consults the routing table:
    to which other router should I send a packet for this destination, or can I deliver it directly?
  • if destination not in table: send to default gateway
  • if no default gateway configured: packet can’t be routed

Three components:

  • The routing protocol:
    how to find the best route between a sender and a receiver through the network
  • The routing table:
    the best routes currently known are stored in a lookup table for fast access
  • The routing decisions:
    deciding for each incoming packet where it is sent next

Types of routing

  1. Centralized
    • All clients connect to central computer, which makes the routing decisions
    • Used on small, host-based networks
  2. Decentralized
    • Each device makes its own decisions
    • Information needs to be exchanged to prepare routing tables
    • Used on the Internet

Decentralized routing:

Static routing:

  • Network manager prepares fixed routing tables
  • Manually updated when the network changes
  • Used in simple networks that don’t change a lot

IP subnets

mask 计算方式就是bin对比,比如/20表示"1"*20+"0"*(32-20),mask则是取ip(每个数字分开LE encode,从右往左写)与这个的&值(即上下都是1就取1否则0)

要看清楚到底是ip还是mask。X.X.0.0这种就是mask,因为可以作为一个subnet的Network(gateway) address。作为mask的ip可能不带/20这样的后缀(因为人家能表达了)

X.X.X.X(/XX)在mask /XX(或者X.X.X.X)有几个subnet?先算前面那个的/XX比如20。再算后面那个的那比如24。那么subnet个数就是2^(24-20) = 16个。每个subnet里的ip数就是2^(32-24)=256,其中host ip数就是256-2 = 254

错题集!

Q: An access point ensures that all computers within range of the access point can communicate with each other

A: T

做的时候选了F,想的是没准就有内网隔离你访问个锤子。看到答案可能应该是想表达在一个LAN的意思。

Q: IPv6 is backwards compatible with IPv4.

A: F

做的时候以为是v6兼容不兼容v4,那肯定兼容啊。2002就是划给v4的(6to4)。直到看到答案才意识到问题意思应该是直接兼容。6to4毕竟是走了个转换通道的。而且google之后有明确答案。

Q: What is the main advantage of fibre-optic cables over copper cables?

Select one:

a. Higher latency

b. All of the other answers

c. Cheaper

d. Lower resistance

e. Much faster data rates

A: e

本来想想光纤无敌无脑选b。现在想想应该是铜在工艺和成本上来说是更便宜的,latency的话查了是copper更快(This is close to the oft-quoted 5 ns per meter for fiber. The latency for the twinax copper cables shown is 4.60 ns per meter

An advantage of centralized routing is:

Select one:

a. routing does reflect changing network conditions, such as computers that are overloaded by many messages

b. if anything happens to the computer developing the routing table, the routing tables cannot be changed until that computer is fixed, or until a new computer is selected to perform the function

c. it requires more processing by each computer or router in the network than dynamic routing

d. the routing tables are stored at all computers in the network

e. routing decisions are simple

A: e

不懂,背一下吧

How can a set of 802.11b access points be configured to operate without interference?

Select one:

a. assign the same channel to no more than two access points

b. assigning each access point a different channel to communicate with clients

c. none of the above

d. separate each access point by more than 10 meters

e. use omnidirectional antennas on some access points and directional on others.

A: b

很果断地选c,因为觉得肯定得首先不一样其次要1,6,11三个选。答案b其实就是不一样的意思,1,6,11应该只是最优情况。

http://www.wireless-nets.com/resources/tutorials/assign_ap_channels.html

_____ indicates what resources on each server are available on the network for use by other computers and what people are allowed what access to the network.

Select one:

a. server allocation list

b. network profile

c. network operating system

d. user access log

e. user profile

A: e

完全不记得啥时候讲了user profile。用Acrobat搜了一下在W6(LAN&WAN)。

就user profile是一个Server NOS(Network OS)的一个service

总的来说就这几个

  • directory service
  • network & user profiles
  • file, web, print, email server etc

然而后面就没具体介绍了……这题就当介绍一下(别的几个知道的

How many bits are required to sample an incoming signal 4000 times per second using 64 different amplitude levels?

A: 6

写了是64的我一脸懵逼。现在来复盘一下。先用Acrobat定位了一下知识点在W6。s(t)=Asin(2πft+ϕ)s(t) = A sin(2\pi ft + \phi)。这里ff已经确定了是个常量4000 times per secondϕ\phi没提到,变的应该只有A,有64个不同的值。首先已知了我们64错了。

题目说了有64个amplitude的值,另外求的是可以代表bit的数量。意思应该就是64个值可以用几个bit概括?一个bit可以表示0,1。两个就是00,01,10,11四个,以此类推就是n个bit代表2n2^n个。64=2664 = 2^6。所以是6。(要注意审题啊完全没意识到是bit)

Which of the following is not a controlled access method of media access control?

Select one:

a. CSMA/CD

b. hub polling

c. roll call polling

d. Token passing

e. polling

A: a. CSMA/CD

相关知识忘得差不多了,只记得CSMA/CD是和Media有关的。CSMA/CD也是W6(LAN&WLAN)的内容。

CSMA/CD是一个Media Access Control。

  • Carrier Sense (CS):
    listen on bus, only transmit if no other signal is “sensed”
  • Multiple Access (MA):
    several devices access the same medium
  • Collision Detection (CD):
    when signal other than own is detected:
    • transmit jam signal (so all other devices detect collision)
    • both wait random time before re-transmitting

CSMA/CD limits size of collision domain

而那些Polling是W5(Physical & DataLink Layer)的内容。

  1. Roll Call Polling (类hub)
  2. Hub Polling / Token Passing (P2P)

人家都叫Controlled Access。

Errors normally appear in ???, which is when more than one data bit is changed by the error-causing condition.

A: burst

我tm写的DataLink Layer……找了一圈也没看见这个in burst的说法,背一下吧

_____ controls errors by detecting and correcting them at the receiving end without retransmission of the original message.

Select one:

a. Hamming code

b. Wave division multiplexing

c. Huffman encoding

d. Hub polling

e. Front end processing

A: Hamming code

Hamming code出现在W5(Phy&DL Layer)的Forward Error Correction的example里。example分别为

  • Hamming code 汉明码 (used e.g. in error correcting memory)
  • Reed-Solomon codes 里德-所罗门码 (CDs, DVDs, Blue-ray, QR Codes, Digital TV broadcast, DSL)

其他的Wave division multiplexing没找到,但是multiplex应该是多路复用和error关系不大

Huffman encoding没找到

Hub polling前面说了是个Controlled Access

Front end processing前端处理?听着就不靠谱,也没找到。

In ARQ, a NAK:

Select one:

a. is sent by the sender at the same time as it sends a data packet

b. refers to non-asynchronous Kermit technique

c. means that the sender should continue with sending the next message

d. is sent by the recipient if the message contains an error

e. is sent by the recipient if the message was received without error

A: d

ARQ(包括NAK)也在W5.

acknowledgement (ACK) negative-acknowledgement (NAK or NACK)

这里干脆吧ARQ(Automatic Repeat Request/automatic repeat query)也看掉。ARQ是一种用于数据传输的错误控制方法,它使用确认(接收方发送的消息,表明它已正确接收到一个数据包)和超时(在接收确认之前经过了指定的时间段)来实现可靠的数据传输 通过不可靠的通信渠道。 如果发送方在超时之前未收到确认,则通常会重新传输数据包,直到发送方收到确认或超过预定义的重传次数为止。(就等于是一直ping你直到ping通或者次数到

A _____ is a user’s connection into a packet switched service.

Select one:

a. packet asynchronous/discrete device

b. packet asymmetric/data transmission device

c. packet analyzer/decoder device

d. packet assembly/disassembly device

e. packet analog/digital device

A: d. packet assembly/disassembly device

W11(Backbones MAN WAN)里WAN Packet Switched Services讲到的packet assembly/disassembly (简称PAD)。如图,背一背吧

_____ refers to changing the shape of a wave in different ways to represent a 1 or a 0.

Select one:

a. demodulation

b. modulation

c. digitizing.

d. sampling

e. shaping

A: a. demodulation

脑补的是调制解调器,网线(01)到电话线(wave)是调制,回来解调。这里要求的是wave → 01所以是解调。(看反了

Web-based e-mail like Hotmail is an example of three-tier client-server architecture that provides access to e-mail messages.

A: T

想的是B/S,通过three-tier client-server architecture关键词查了下看见Wikipedia里说: In the web development field, three-tier is often used to refer to websites, commonly electronic commerce websites

In unix or Linux Operating System, the most common types of files are ____________.

Select one:

a. device file

b. directory file

c. ordinary file and directory file

d. ordinary file

A: d. ordinary file

错两次了不应该

Which of the following technique is used for encapsulation?

Select one:

a. one of the pieces that results when an IP gateway divides an IP datagram into smaller pieces for transmission across a network that cannot handle the original datagram size

b. the technique used by protocols in which a lower level protocol accepts a message from a higher level protocol and places it in the data portion of the low level frame

c. the technique used in best-effort delivery systems to avoid endlessly looping packets

d. all of these options

A: b

encapsulation封装的定义

In which type of routing do computers or routers count the number of hops along a route and periodically exchange information on the hop count with their neighbors?

Select one:

a. circuitous

b. decentralized

c. distance vector

d. link state

e. indirect

A: distance vector

W8 Routing的内容

Distance vector 交换目的地距离,选择最短路径(RIP (Routing Information Protocol) BGP(Border Gateway Protocol))

link state 交换链接质量消息,选最快路径(OSPF)

别的都没出现。

An exception condition in a computer system caused by an event external to the CPU is known as?

Select one:

a. Halt

b. Process

c. Interrupt

d. None of above

A: c

Halt虽然也是停,但真没东西叫这个

An interrupt is a signal to the processor to suspend its current tasks and deal with whatever caused the interrupt. Which of the following method cannot be classified as Interrupts?

Select one:

a. Program/Software triggered

b. Timer triggered

c. I/O operation triggered

d. Other Hardware triggered

e. Page fault triggered

A: e

PageFault是后面(内存)才出现的

A solution to resolve the problem of external fragmentation is to _________________

Select one:

a. permit the logical address space of a process to be non contiguous

b. permit smaller processes to be allocated memory at last

c. permit larger processes to be allocated memory at last

d. All of these options

A: a

解决方案:paging

For purposes of routing, the Internet is divided into ___________.

Select one:

a. wide area networks

b. autonomous networks

c. autonomous systems

d. none of these options

A: c. autonomous systems

W8的内容,自治系统(差不多就ISP的网)

In 802.3, the address consisting of all 1 bits is reserved for ___________________.

Select one:

a. Unicast

b. Multicast

c. Broadcast

d. Ordinary

A: c. Broadcast

802.3是以太网的协议。从Ethernet Frame里根本没找到这个……背吧

In IEEE802.11, the addressing machanism can include upto ________________ addresses.

Select one:

a. four

b. five

c. six

d. none of these options

A: a. four

IEEE802.11 是WLAN的协议。

OC-3072 has a data rate of

Select one:

a. 1.244 Gbps

b. 159.25 Gbps

c. 39.813 Gbps

d. 1.544 Mbps

e. 100 Mbps

OC-X = X * 51.84 Mbps

Both the _____ layer perform error checking.

Select one:

a. presentation and transport

b. application and presentation

c. transport and data link

d. physical and data link

e. network and physical

A: c. transport and data link

_____ is a line-of-sight type of wireless media.

Select one:

a. microwave

b. radio

c. twisted pair

d. coaxial cable

e. fiber optic

A: microwave

直接拿来覆盖范围的,就好像学校到处有的校园网

Which of the following is not true about CSMA/CD?

Select one:

a. It is used in token ring protocol LANs

b. It is a contention-based media access control technique

c. When a collision has occurred, the computers that wish to transmit wait a random amount of time after a colliding message before attempting to retransmit

d. Computers on the circuit ‘listen’ before transmitting

e. The acronym refers to Carrier Sense Multiple Access with Collision Detection

A: a. It is used in token ring protocol LANs

CSMA/CD是W6 Ethernet内容

前面只有hub,hub的逻辑拓扑是shared bus,物理拓扑是star

The probability of detecting an error, provided that one has occurred, using cyclic redundancy checking is about

Select one:

a. >99%

b. 75%

c. 0%

d. 50%

e. exactly 100%

A: a. >99%

cyclic redundancy checking 就是CRC。W5里的。

所以就相当于$ 99% < \frac{\infin-1}{\infin} < 100% $

Breaking a network into smaller parts is called Network Segmentation -> W6

dynamic routing -> W8

drawback: The transmission of status information “wastes” network capacity that could be used to send user messages

Many organizations today are installing traditional wired Ethernet for desktop users and install Wi-Fi as overlay networks

Layer-2地址:L2即DL层,真实网卡MAC地址

Layer-3:L3即Net层,logical address,arp得到L2

802.11b?

802.11g?

802.3