Chinaunix首页 | 论坛 | 博客
  • 博客访问: 89443
  • 博文数量: 22
  • 博客积分: 2000
  • 博客等级: 大尉
  • 技术积分: 505
  • 用 户 组: 普通用户
  • 注册时间: 2007-11-21 17:13
文章分类

全部博文(22)

文章存档

2011年(1)

2008年(21)

我的朋友

分类: 系统运维

2008-07-03 12:49:19

2.2 术语

数据:

Ethernet上:Ethernet frame

EthernetIP层之间:IP packet

IPUDP之间:UDP datagram

IPTCP之间:TCP segment

network application中:application message

 

2.3 数据流

See fig2. 也与fig1相符

从上到下:n-to-1. 多对一

从下到上:1-to-n

 

2.4 两个网络接口

ip这层是n-to-n,无论上到下or下到上

 

“Forwarding”: sending an IP packet out onto another network.

用于forward ippacketscomputer叫做 ip-router。(看来路由器必须要有两个物理接口啊!)因转发不用接触到tcpudp层,所以有的路由器不实现tcpudp module

 

2.5 IP Creates a Single Logical Network

数据在协议栈中,每往下传就加一层header。到目的地后,每往上传就剥一层header

 

2.6 Physical Network Independence

新加个hardware,只要新装个driver即可,不影响层之间

 

2.7 Interoperability

就是两台机之间一定可连

 

3. Ethernet

An Ethernet address is 6 bytes(网卡mac地址)。The computer also has a 4-byte IP address.

每个设备听是不是发给自己的,同时也听是不是广播"FF-FF-FF-FF-FF-FF"

 

CSAM/CD (Carrier Sense and Multiple Access with Collision Detection)载波侦听多路访问/冲突检测:每次只能一个设备transmit,可以一起receive。所以如果同一时刻两个设备发,则检测到冲突,两设备都等一个random时段,再次transmit

 

3.1 A Human Analogy

Each person can hear the words when another is talking (Carrier

Sense). Everyone in the room has equal capability to talk (Multiple

Access), but none of them give lengthy speeches because they are

polite. If a person is impolite, he is asked to leave the room

(i.e., thrown off the net).

No one talks while another is speaking. But if two people start

speaking at the same instant, each of them know this because each

hears something they haven’t said (Collision Detection).

 

4. ARP

要发ip packet 出去的时候,怎么确定目的地的Ethernet address?可用arpip address –> Ethernet address.

4.1 ARP Table for Address Translation

4.3 ARP Request/Response Pair

arp表中找不到Ethernet address时的情况

当在表中找不到时,要广播发送ARP request

---------------------------------------

|Sender IP Address 223.1.2.1 |

|Sender Enet Address 08-00-39-00-2F-C3|

---------------------------------------

|Target IP Address 223.1.2.2 |

|Target Enet Address |

---------------------------------------

TABLE 2. Example ARP Request

 

收到的结点都比较是否是自己的ip,若是,则单播response,交换了sendertarget

---------------------------------------

|Sender IP Address 223.1.2.2 |

|Sender Enet Address 08-00-28-00-38-A9|

---------------------------------------

|Target IP Address 223.1.2.1 |

|Target Enet Address 08-00-39-00-2F-C3|

---------------------------------------

 

arp表中找不到Ethernet address时的情况:

1. An ARP request packet with a broadcast Ethernet address is sent out on the network to every computer.

2. The outgoing IP packet is queued.

3. The ARP response arrives with the IP-to-Ethernet address translation for the ARP table.

4. For the queued IP packet, the ARP table is used to translate the IP address to the Ethernet address.

5. The Ethernet frame is transmitted on the Ethernet.

 

如果没有那个ip address,也就没有response,这种情况就丢弃ip packet。上层协议分不清得不到ip address是因为网络坏了还是没有这个ip地址。

 

有的实现在等ethernet address的时候,不把ip packet queue,而是直接丢弃。依赖于上层的tcp or udp来用超时重传来恢复。

5. Internet Protocol

5.1 Direct Routing

同一个network之内的routing

5.2 Indirect Routing

不同networks之间的routing,跨过了路由器,需要路由器来转发。

如图7D节点的协议栈不同之处在于:它有3arp module 3ethernet drivers 1ip module

如果AE通信,sourceipethernet address当然是A的,destination ip addressE的,但是destination Ethernet addressD的。因为需要D来转发。

----------------------------------------

|address       source destination|

----------------------------------------

|IP header        A      E |

|Ethernet header A     D |

----------------------------------------

TABLE 6. Addresses in an Ethernet frame for an IP packet from A to E (before D)

D’s IP module receives the IP packet and upon examining the destination IP address, says "This is not my IP address," and sends the IP packet directly to E.

----------------------------------------

|address     source destination|

----------------------------------------

|IP header        A        E |

|Ethernet header D        E |

----------------------------------------

TABLE 7. Addresses in an Ethernet frame for an IP packet from A to E (after D)

 

indirect routingIpEthernet address不匹配。

 

5.3 IP Module Routing Rules

对于outgoting ip packet,从上层来:ip module要判断,是directly还是Indirectly发送,然后查route table,选择a lower network interface

对于incoming ip packet,从下层来:ip module判断是转发还是给上层。如果转发,则看成outgoing ip packet。如果要转发,肯定不发回给来的那个network interface

 

5.4 IP Address

C类地址前三bit110,表示前24-3 bit用于网络地址,故可有2^21 = 2,097,152c类网络地址。

 

5.5 Names

对于小网络:每台机的“hosts”文件记载了name-to-address translation。大网络在server上记载,网络上的机都可访问。

You may notice that "delta" has only one entry in this file even though it has 3 IP addresses(见fig9)。Delta can be reached with any of its IP addresses; it does not matter which one is used.

 

5.6 IP Route Table

对于要出去的ip packet,可在route table中查找路由。Route table 可由管理员用“route”命令来修改。

 

5.7 Direct Routing Details

--------------------------------------------------------------

|network       direct/indirect flag    router   interface number|

--------------------------------------------------------------

|development  direct                                1         |

--------------------------------------------------------------

TABLE 8. Example Simple Route Table

 

5.8 Direct Scenario

在路由表中找到的情况:往interface1发数据包的时候,arp table translation is done

在路由表中找不到的情况:丢弃,发error message

 

5.9 Indirect Routing Details

5.10 Indirect Scenario

Alpha is sending to epsilon, it’s in IP module now. Ip module 首先取出ip地址中network部分,然后在路由表中跟第一列匹配。

找到了,要经过devnetrouter路由器,然后alphaip module就在arp表中找devnetrouter的物理地址,然后把目的地的物理地址改成devnetrouter的,目的地的ip地址还是epsilon,并通过interface1发送出去。

Delta,也就是devnetrouter路由器收到了,并传到了它的ip module了,它发现目的地的ip地址不是自己,所以决定转发。

Delta ipmodule取出目的地ip的网络部分,在路由表中找到匹配,然后发送ip包给epsilon通过interface3.此时的目的地的ip和物理地址都是epsilon的了。

Epsilon收到了,它的ip module发现就是发给自己的,就传到上层。

 

5.11 Routing Summary

源节点不知道中途经过的路由是怎么样的。

 

5.12 Managing the Routes

ICMP (Internet Control Message Protocol) can report some routing problems。小网络可以手动设定路由表,大网络必须自动更新和分发路由表。

如果设备移动,改了ip地址,则“hostfile也要改变,即使中型网络也很难维护,所以要用domain name systemDNS)来解决这个问题。

 

6. User Datagram Protocol

UDP给上层的网络应用提供服务。使用UDP的网络应用有:Network File System (NFS)Simple Network Management Protocol (SNMP)

UDP是无连接的数据包传输服务,不保证delivery

UDPip传来的包,加上了两个值。一个是多个应用之间基于端口(port)的多路传输信息。另一个是验证码(checksum)用于验证数据完整性。

 

6.1 Ports

UDP preserves the message boundary defined by the application. It never joins two application messages together, or divides a single application message into parts.

 

6.2 Checksum

验证码为0:说明sender没有计算验证码,discard

验证码正确:比较是不是自己的端口号,若是,则按队列顺序读取。若队列达到了最大,则discard

 

7. Transmission Control Protocol

TCP提供面向连接的byte stream,用timeoutretransmission保证delivery。最典型的两个tcp协议的应用是ftptelnet。其他的还有x-window systemrcpremote copy),和其他的r系列。Tcp需要更多的cpu和网络带宽。

两台机tcp通信后,它们的tcp modules里都有定义虚电路(virtual circuit)的状态信息。该虚电路是全双工的。可以同时向两个方向传。

TCP packetizes the byte stream at will; it does not retain the boundaries between writes.

滑动窗口,超时重传,握手。

 

8. Network Applications

根据需要选择使用tcp还是udp,但是Tcpudp的不足,可以由应用程序来弥补。

8.1 TELNET:在tcp上的远程登录。

8.3 rsh tcp上的remote shell

8.4 NFSudp上的Network File System,通过mount,使得远程文件系统可以像在本地一样使用。

8.5 SNMPSimple Network Management Protocol (SNMP) uses UDP and is designed for use by central network management stations.如果给出了足够的数据,管理员就可以分析网络问题。The central station就用snmp来收集网络上的数据给管理员,让其来分析解释。

 

阅读(785) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~