路由器运作原理以及网络互连技术

版权声明:如果喜欢的话,可以撩我哟,此处没有联系方式,想要就自己找哈。 https://blog.csdn.net/qq_39384184/article/details/84677149

Introduction

What is IP ?

  • IP stands for Internet Protocol.
  • Key tool used today to build scalable(可升级的), heterogeneous(混杂) internetworks.
  • It runs on all the nodes in a collection of networks
  • Defines the infrastructure(基础设施) that allows these nodes and networks to function as a single logical internetwork

IP Service Model

Packet Delivery Model

  • Connectionless model for data delivery.
  • Best-effort delivery (unreliable service).

Global Addressing Scheme

  • Provides a way to identify all hosts in the network.

How Layer 3 Routers Work ?

  • Layer 3 router uses store and forward scheme to forward incoming IP packets (datagrams).
    • IP Address Lookup (Forwarding Table constructed by routing protocols, such as RIP, OSPF, BGP, etc).
    • IP/MAC mapping table.
  • Forward IP packet into next hop if the destination IP is found in the Forwarding Table. Otherwise, forward to default port.
  • Wire-speed forwarding design.
  • Not Plug-and-Play.
  • Forward Table:

在这里插入图片描述

  • Mapping Table:

在这里插入图片描述


IP and Routers

IP Datagram Header Format

在这里插入图片描述

  • Type of Service of IP)
Precedence Delay Throughput Reliability O O bits
3 1 1 1
  • Precedence
    • 111 Network Control
    • 110 Internetwork Control 101 CRITIC/ECP
    • 100 Flash Override
    • 011 Flash
    • 010 Immediate
    • 001 Priority
    • 000 Routine
  • Delay
    • 0 Normal
    • 1 Low
  • Throughput
    • 0 Normal
    • 1 High
  • Reliability

.

  • Flags
O DF MF bits
1 1
  • DF
    • 0 May Fragment
    • 1 Don’t Fragment
  • MF
    • 0 Last Fragment
    • 1 More Fragment

IP Addresses

  • Properties

    • Globally unique 32 bits address
    • Hierarchical(分级): network + host
    • Class A type (1/2)

    在这里插入图片描述

    • Class B type (1⁄4)

    在这里插入图片描述

    • Class C type (1/8)

    在这里插入图片描述

Intra-LAN and Inter-LAN Communications

  • B -> Y (Intra LAN):
    • Send the frame to the destination directly.

在这里插入图片描述

  • B -> A (Inter-LAN):
    • Send the frame to attached Router first.
    • Router will forward to the destination.

在这里插入图片描述

IP Datagram Forwarding

  • Strategy
    • every datagram contains destination’s address.
    • if directly connected to destination network, then forward to host.
    • if not directly connected to destination network, then forward to some router.
    • forwarding table maps network number(网络号) into next hop.
    • each host has a default router.
    • each router maintains a forwarding table.

IP Fragmentation and Reassembly(重组)

  • MTU (Maximum Transmission Unit)

    • Ethernet (1518 bytes)
    • IEEE 802.11 Wireless (2312 bytes)
    • FDDI (4500 bytes)
  • Strategy

    • Fragmentation occurs in a router when it receives a datagram that it wants to forward over a network which has MTU < datagram.
    • Reassembly is done at the receiving host.
    • All the fragments carry the same identifier.
    • Fragments are self-contained datagrams.
    • IP does not recover from missing fragments.

Router Characteristics

  • Network Layer Routing
    • Network layer protocol dependent.
    • Filter MAC broadcast and multicast packets.
    • Easy to support mixed media.
    • Packet fragmentation and reassembly.
    • Filtering on network (IP) addresses and information.
    • Accounting.
  • Direct Communication Between Endpoints and Routers
    • Highly configurable and hard to get right.
    • Handle speed mismatch.
    • Congestion(拥塞) control and avoidance.
  • Routing Protocols
    • Interconnect layer 3 networks and exploit arbitrary topologies.(利用随机拓扑)
    • Determine which route to take.
    • Static routing.
    • Dynamic routing protocol support:
      • RIP: Routing Information Protocol.
      • OSPF: Open Shortest Path First.
    • Provides reliability with alternate(备用) routes.
  • Router Management
    • Troubleshooting capabilities(故障排除功能).

Differences Between Bridges and Routers

在这里插入图片描述


IP Subnetting

Add another level to address/routing hierarchy(等级制度): subnet.

Subnet masks define variable partition(可变区域) of host part of class A and B addresses.

在这里插入图片描述

Forwarding Algorithm:

D = destination IP address
for each entry < SubnetNum, SubnetMask, NextHop>
    D1 = (SubnetMask) AND (D)
    if D1 = SubnetNum
        if NextHop is an interface
            deliver datagram directly to destination
        else
            deliver datagram to NextHop (a router)
  • A default router is used if nothing matches。
  • Not necessary for all ones in subnet mask to be contiguous(邻近).
  • Can put multiple subnets on one physical network.
  • Subnets not visible from the rest of the Internet.

Classless Addressing

Classless Inter-Domain Routing (CIDR, 无类别域间路由): A technique that addresses(解决) two scaling concerns(扩展问题) in the Internet:

  • The growth of backbone routing table(骨干路由表) as more and more network numbers need to be stored in them.
  • Potential exhaustion(耗尽) of the 32-bit address space.

CIDR uses aggregate routes(聚合路由):

  • Uses a single entry in the forwarding table to tell the router how to reach a lot of different networks.
  • Breaks the rigid boundaries(刚性边界) between address classes.

The convention(惯例) is to place a “/X” after the prefix where X is the prefix length in bits.

  • For example, the 20-bit prefix for all the networks 192.4.16 through 192.4.31 is represented as 192.4.16/20(16个 Class C).
  • By contrast(对比), if we wanted to represent a single class C network number 192.4.16, which is 24 bits long, we would write it 192.4.16/24(一个 Class C).

Routing protocols to handle this classless address

  • It must understand that the network number may be of any length.
  • Represent network number with a single pair <length, value>.
  • All routers must understand CIDR addressing.
  • CIDR means that prefixes may be of any length, from 2 to 32 bits.
  • Longest prefix matching.
    • It is also possible to have prefixes in the forwarding tables that overlap.
    • For example, we might find both
      • 171.69/16 (a 16 bit prefix) and
      • 171.69.10/24 (a 24 bit prefix)
    • in the forwarding table of a single router.

Address Resolution Protocol (ARP)

  • Map IP addresses into physical (MAC) addresses.
    • destination host, or next hop router.
  • ARP (Address Resolution Protocol)
    • table of IP to physical address bindings.
    • broadcast request if IP address not in table.
    • target machine responds with its physical address.
    • table entries are discarded(丢弃) if not refreshed.
  • ARP Packet Format
    • HardwareType: type of physical network (e.g., Ethernet)
    • ProtocolType: type of higher layer protocol (e.g., IP)
    • HLEN & PLEN: length of physical and protocol addresses
    • Operation: request or response
    • Source/Target Physical/Protocol addresses

在这里插入图片描述

Host Configurations

  • Most host Operating Systems provide a way to manually configure the IP information(手动配置) for the host.
  • Automated Configuration Process is required.

Dynamic Host Configuration Protocol (DHCP)

  • DHCP server is responsible for providing configuration information to hosts.
  • There is at least one DHCP server for an administrative domain.
  • DHCP server maintains a pool of available addresses.
  • DHCP:
    • Newly booted or attached host sends DHCP DISCOVER
      message to a special IP address (255.255.255.255, 广播)
    • DHCP relay agent unicasts the message to DHCP server and waits for the response. (DHCP 中继代理将消息单播到 DHCP 服务器并等待回应。)

Internet Control Message Protocol (ICMP)

  • Defines a collection of error messages that are sent back to the source host whenever a router or host is unable to process an IP datagram successfully.
    • Destination host unreachable due to link /node failure.
    • Reassembly process failed.
    • TTL had reached 0 (so datagrams don’t cycle forever).
    • IP header checksum failed.
  • ICMP-Redirect
    • From router to a source host
    • With a better route information
    • 需要路由器向源发送ICMP重定向的情况有两种:
      1. 当路由器从某个接口收到数据包后,还要将数据包从同一个接口发往目的地,就是路由器收到数据包的接口正是去往目的地的出口时,则会向源发送ICMP重定向,通告对方直接将数据包发向自己的下一跳即可,不要再发给自己。
      2. 数据包的源IP和自己转发时的下一跳IP地址是同网段时,则会向源发送ICMP重定向,通告对方直接将数据包发向自己的下一跳。
      • 注:路由器在向数据源发送ICMP重定向的同时,也会正常转发收到的数据包,并不会中断网络。
      • 说明:ICMP重定向是基于接口配置的,默认为开启状态。

Routing protocols

Forwarding:

  • to select an output port based on destination address and routing table.
  • Forwarding table
    • Used when a packet is being forwarded.
    • An entry in the forwarding table contains the mapping from a network number to an outgoing interface and some MAC information, such as Ethernet Address of the next hop.

Routing:

  • process to build the routing table.
  • Routing table
    • Built by the routing algorithm.
    • Generally contains mapping from network numbers to next hops.

在这里插入图片描述

The basic problem of routing is to find the lowest-cost path between any two nodes.
- Where the cost of a path equals the sum of the costs of all the edges that make up the path.

Distributed and dynamic protocol:

  • Distance Vector
  • Link State

Distance Vector protocol

Each node constructs a one dimensional array (a vector) containing the “distances” (costs) to all other nodes and distributes that vector to its immediate neighbors.

  • Example Network:

在这里插入图片描述

  • Assume that each node knows the cost of the link to each of its directly connected neighbors, Initial distances stored at each node (global view):

在这里插入图片描述

  • Initial routing table at node A:

在这里插入图片描述

  • Final routing table at node A:

在这里插入图片描述

  • Final distances stored at each node (global view):

在这里插入图片描述

  • Every T seconds each router sends its routing
    table
    to its neighbors.
  • Each router then updates its routing table based
    on the new information.
  • Problems include:
    • fast response to good news.
    • slow response to bad news.
    • Too many messages to update.
  • When a node detects a link failure:
    • it may recover,
    • or encounter a Count-to-infinity problem.
    • In fact, some relatively small number is used to approximate the infinity, For example, the maximum number of hops to get across a certain network is less than 16.
    • One technique to improve the time to stabilize(稳定) routing is called split horizon(水平分割):
      • When a node sends a routing update to its neighbors, it does not send those routes it learned from each neighbor back to that neighbor.

Link State protocol

Strategy: Send to all nodes (not just neighbors) information about directly connected links (not entire routing table).

Link State Packet (LSP)

  • ID of the node that created the LSP.
  • Cost of link to each directly connected neighbor.
  • Sequence number (SEQNO).
  • Time-to-live (TTL) for this packet.

Reliable Flooding

  • Store most recent LSP from each node.
  • Forward LSP to all nodes but one that sent it.
  • Generate new LSP periodically; increment SEQNO.
  • Start SEQNO at 0 when reboot.
  • Decrement TTL of each stored LSP; discard when TTL=0.

Example of reliable flooding of LSP packets From node A

在这里插入图片描述

Shortest Path Routing

  • OSPF (Open Shortest Path First).
  • Each router computes its routing table directly from the LSP’s it has collected using the Dijkstra’s algorithm.
  • Find the shortest path from the router to each other node.

想了解更多关于计算机网络架构与网络安全:计算机网络架构与网络安全专栏

猜你喜欢

转载自blog.csdn.net/qq_39384184/article/details/84677149