IP defines a service model to solve heterogenity, an important part is the global addressing scheme, which enables 2 nodes uniquely identify each other.
SSH -X
what ssh -X does is enable X11 forwading. X11 was designed from the beginning to be able to run programs across a network, without needing things like remote desktops. For a while, X11 clients were popular, all the applications run on some server somewhere. Start up a proxy X11 server on the remote machine.
Routing
In virtual circuit, only the connection request packets need routing, for datagrams all packets need routing.
开始是路由过程,学习网络结构并记录到路由表里面,后面每个包的转发使用转发表,使用最长prefix Trie算法。
Forwarding consists of taking a packet, looking at its destination address, consulting a table, and sending the packet in a direction determined by that table.The entry usually includes output interface && its corresponsding MAC address. We saw several examples of forwarding in the preceding section. Routing is the process by which forwarding tables are built.
Forwarding table contains Mapping from nerwork prefix to the next hop in the network and the Ethernet address.
Routing table routing alrorithms precursor to build forwarding table.
两种查找表是否需要不同的实现?
the forwarding table needs to be structured to optimize the process of looking up an address when forwarding a packet, while the routing table needs to be optimized for the purpose of calculating changes in topology.
intradomain routing protocols, interior gateway protocols (IGPs)
所有router存在同一个administrative control下。
静态方法的缺陷:
1.处理不了节点failure
2.考虑不到新的nodes、links
3.edge cost can’t change
Distance vector
Each node maintains a vector to all other nodes and send it to its neighbors. Each node knows the cost to its neighbor initially.通知相邻接点自己的距离向量,与当前向量比较,进行更新。最终每个节点也仅仅知道自己的路由信息(distributed).periodic updates/trigger updates.
实现方法:
周期函数持续扫描,超过时间将entry从表中移除。entry包含下一跳,目标地址,TTL元素。每次reconfirm收到neighbor的消息,重置这个entry的TTL。(利用neighbor的cost进行更新,每次比较cost+1)
RIP
RIP is the canonical example of a routing protocol built on the distance-vector algorithm just described. Many unix system based on this.
和理想距离向量的区别:
Rather than advertising the cost of reaching other routers, the routers advertise the cost of reaching networks.The majority of the packet is taken up with haddress, mask, distancei triples. RIP can only run on fairly small network, optimize minimum hops, as each segment with cost of 1.
Link state
Assumption:Every node knows how to reach its directly connected neighbors, and if we make sure that the totality of this knowledge is disseminated to every node, then every node will have enough knowledge of the network to build a complete map of the network. (从局部最优推广到全局最优). 2 mechanism: reliable dissemination of link-state information, and the calculation of routes from the sum of all the accumulated link-state knowledge.
Reliable flooding
each node creates an update packet, also called a linkstate packet (LSP), which contains the following information:
- The ID of the node that created the LSP
- A list of directly connected neighbors of that node, with the cost of the link to each one
- A sequence number
- A time to live for this packet
Summary of difference
In distance-vector, each node talks only to its directly connected neighbors, but it tells them everything it has learned (i.e., distance to all nodes). In link-state, each node talks to all other nodes, but it tells them only what it knows for sure (i.e., only the state of its directly connected links)
CheckSum for IP packet header
Consider the entire header as a sequence of 16-bit word and do he addition, thus need to use the short type, which is 16 bits/2 bytes. Should use 1’s comlementary addition, the carry in bits should be added back to the right most bit. The principle is that you compare the original checksum contained in the packet and calculated again when you transmit this packet and compare their value.