Introduction to Computer Networks
Total Page:16
File Type:pdf, Size:1020Kb
Routing and addressing Rui Valadas Computer networks and its physical elements R1 E1 link R2 H1 server Ethernet H2 switch R4 desktop H3 IP tablet router H4 R3 portable ©Rui Valadas, version 2.0, 28/9/2017 2 Routing • Routing – network function that selects one or more routes (paths) between hosts, to be followed by data packets • Routes are usually computed through distributed algorithms called routing protocols, running on switching equipment and cooperating through the exchange of routing messages R2 R1 R4 H1 H2 R3 ©Rui Valadas, version 2.0, 28/9/2017 3 Forwarding tables • Indicate at each host or router the path to each destination, actually the next network element (the next-hop) • Built and maintained by routing protocols dest. next dest. next H2 R3 H2 R1 dest. next ... ... dest. next ... ... H2 R2 H2 H2 ... ... ... ... R2 R1 R4 H1 H2 R3 dest. next H2 R4 ... ... Can forwarding tables list all host addresses? ©Rui Valadas, version 2.0, 28/9/2017 4 Structure of Internet routing • At a global (worldwide) level, the Internet can be viewed as a network of routing domains, called Autonomous Systems (ASes) • The ASes are connected through Autonomous Systems Border Routers (ASBRs) • Two types of routing protocols: • Inter-domain: between ASes Inter-domain • BGP routing protocol • Intra-domain: inside ASes ASBR • RIP, OSPF ASBR Autonomous ASBR System Intra-domain ASBR routing protocol internal node ©Rui Valadas, version 2.0, 28/9/2017 5 Addressing • Network elements are identified through addresses • Several types of addresses: e.g. MAC and IP • Two types of IP addresses: IPv4 and IPv6 • IP addresses are used for host-to-host communications (end-to- end) • IP addresses are interface identifiers • Is this good or bad? • Multi-homed hosts have one IP address per active interface ©Rui Valadas, version 2.0, 28/9/2017 6 IPv4 addresses • 32 bits • Represented in dotted-decimal notation 10000000 00001010 00000010 00011110 128 . 10 . 2 . 30 ©Rui Valadas, version 2.0, 28/9/2017 7 IPv6 addresses • 128 bits • Represented in hexadecimal notation, with 16-bit blocks (hextets) separated by a colon 0010 ... 0000 1101 1011 1000 ... 1010 0000 ... 0000 0011 2001 : 0db8 : 000d : 000a : 0000 : 0000 : 0000 : 0003 ©Rui Valadas, version 2.0, 28/9/2017 8 IPv6 addresses • Rules for reducing the size of the representation • Example: fedc:0000:0000:0000:0243:0000:0000:abcd • Rule 1 – Leading 0s in any hextet can be omitted • fedc:0:0:0:243:0:0:abcd • Rule 2 – A double colon (::) can represent any single, contiguous string of one or more hextets consisting of all 0s. • fedc::0243:0000:0000:abcd or fedc:0000:0000:0000:0243::abcd • Combining rule 1 and rule 2 • fedc::243:0:0:abcd or fedc:0:0:0:243::abcd • :: is the all-zeros address ©Rui Valadas, version 2.0, 28/9/2017 9 Representing address blocks • A block of contiguous addresses that share the same prefix is usually defined by lowest address and prefix length – slash notation • Prefix – higher-order bits of an address • In IPv4, prefix length can be represented by subnet mask • 32-bit word that for prefix with n bits has the n higher-order bits equal 1, and the remaining ones equal 0 • /24 = 255.255.255.0; /21 = 255.255.248.0 • Trailing zeros can be omitted • 11.0.0.0/24 can be represented as 11/24 123.4.8.0/21 Highest 123 . 4 . 00001 111 . 11111111 = 123.4.15.255 Lowest 123 . 4 . 00001 000 . 00000000 = 123.4.8.0 PREFIX SUFFIX ©Rui Valadas, version 2.0, 28/9/2017 10 Multicast and broadcast addresses • It is convenient to have addresses that target more than one destination • … for group communications (e.g. videoconferencing) • Unicast addresses – identify one interface • Multicast addresses – identify a group of interfaces • Broadcast addresses – identify all interfaces • Multicast addresses • IPv4 – 224/4 • IPv6 – ff00::/8 • Broadcast addresses • IPv4 –addresses with “all ones” suffix, must be constrained in scope • IPv6 – no broadcast addresses ©Rui Valadas, version 2.0, 28/9/2017 11 Public and private addresses • Public addresses – for worldwide communications, must be globally unique • IP addresses are assigned by IANA • Private addresses – for communications inside specific domains, need only be unique inside these domains • Conversion between private and public addresses is done through NAT boxes • Private address blocks • IPv4 – 10/8, 172.16/12, 192.168/16, 169.254/16 • IPv6 – fc00::/7 ©Rui Valadas, version 2.0, 28/9/2017 12 Subnets • Forwarding tables cannot list individual IP addresses - does not scale - IP addresses must be aggregated somehow • Subnet • Logical entity corresponding to an IP address block (IP addresses that share common prefix) • Subnets are delimited by routers (the same subnet cannot span different router interfaces) • Often represented by clouds • To support the organization in subnets IP addresses are structured hierarchically in two levels: • netid – prefix, that identifies subnet • hostid – suffix, that identifies interface within subnet ©Rui Valadas, version 2.0, 28/9/2017 13 R1 E1 link R2 destination what next? 9.0.0.0/8 next is R4 H1 125.6.0.0/16 directly connected server 192.168.0.0/30 directly connected 192.168.0.4/30 next is R2 Ethernet 222.0.0.0/24 directly connected H2 switch R4 desktop H3 R1 R2 IP tablet 192.168.0.0/30 router H4 R3 portable 222.0.0.1 192.168.0.4/30 H1 222.0.0.2 125.6.0.0/16 Subnets H2 222.0.0.0/24 R4 222.0.0.3 9.0.0.254 222.0.0.4 9.0.0.2 9.0.0.1 9.0.0.0/8 R3 H3 H4 ©Rui Valadas, version 2.0, 28/9/2017 14 Subnets Host Host subnet 128.10.0.0/16 128.10.156.8/16 128.10.2.26/16 Ethernet 128.10.2.3/16 128.10.238.111 netid hostid multi-homed Host subnet 192.168.56.0/24 192.168.56.1/24 128.10.238.111/16 Router Token-ring 192.168.56.205/24 192.168.56.38/24 Router 10.0.0.37/8 192.168.56.101/24 Private network Host subnet 10.0.0.0/8 ©Rui Valadas, version 2.0, 28/9/2017 15 Subnets • More than one subnet can be assigned to a link 15.0.0.0/8 128.10.0.0/16 222.222.10.0/24 128.15.0.0/16 192.168.60.0/24 222.222.20/24 Router Router ©Rui Valadas, version 2.0, 28/9/2017 16 The TCP/IP layered architecture • The operation of computer networks • TCP/IP layers involves many protocols, e.g. for routing, 1. physical layer error control, security, mobility, congestion 2. link layer control…. 3. network layer 4. transport layer 5. application layer • Protocols are organized in a layered architecture source host message A packet transmitted over the Internet application message APP is processed by protocols of all five transport message APP TP layers, at the source and destination hosts network message APP TP NET link message APP TP NET LK physical message APP TP NET LK PHY network packet header 17 ©Rui Valadas, version 2.0, 28/9/2017 TCP/IP architecture and routing • Physical, link and network layers - communication among hosts; transport and application layers - communication between application processes running on hosts • The link and network layers provide a two-level routing hierarchy for the end-to-end communication between hosts • To accommodate the heterogeneity of Internet communication technologies • Two types of networks and addresses (layer-3 and layer-2) and switching equipment (routers and switches) Switch Router Router Router 3G/4G satellite link fiber optical Router submarine cable Wi-Fi (quite complex) ©Rui Valadas, version 2.0, 28/9/2017 switched Ethernet 18 Link layer technologies • Layer-2 links provide the basic packet-level connectivity between layer-3 devices (hosts or routers) • Can be classified in: • Point-to-point links - connect two, and only two, layer-3 devices; e.g. E1 or V.35 links • Shared links - abstract layer-2 networks and can potentially connect many layer-3 devices; e.g. Ethernet (switched and non-switched), Token Ring, Wi- Fi, X.25, Frame Relay and ATM • Communications inside layer-2 networks require layer-2 addresses Switch ©Rui Valadas, version 2.0, 28/9/2017 19 IEEE addresses • 48 bit addresses, assigned by IEEE, aka MAC addresses • Expressed in hexadecimal notation • e.g. 88-53-2e-28-8b-dc, or 88:53:2e:28:8b:dc, node or 8853.2e28.8bdc 1a-23-f9-cd-06-9b • Flat (no structure) for routing purposes 88-b2-2f-54-1a-0f • Three types of addresses • Unicast – identifies only one interface node LAN node • Multicast – identifies a group of interfaces • Broadcast – identifies all interfaces 5c-66-ab-90-75-b1 49-bd-d2-c7-56-2a node Organizationally Unique Identifier (OUI) 1st byte 2nd byte 3rd byte 4th byte 5th byte 6th byte 11011101 01110101 11001111 01011111 01000101 01111010 0 - unicast 1 - multicast 0 - globally unique 1 - locally administered ©Rui Valadas, version 2.0, 28/9/2017 20 TCP/IP architecture and routing application application transport transport network network network network link link link link link physical physical physical physical physical Router Switch Router Host Host layer-2 layer-2 layer-2 addresses addresses addresses layer-3 (IP) addresses ©Rui Valadas, version 2.0, 28/9/2017 21 Layer-3 and layer-2 forwarding tables • Forwarding tables are built and maintained by routing protocols to indicate at each switching equipment the path to be followed towards each destination • Layer-3 forwarding tables indicate the outgoing interface and the next-hop router that leads to each destination subnet • Layer-2 forwarding tables indicate only the outgoing interface layer-3 forwarding table layer-2 forwarding table destination next hop int destination int 9.0.0.0/8 125.6.2.2 i2 48:dd:a9:56:b3:47 i1 125.6.0.0/16 dc i2 10:d3:51:23:d5:38 i2 223.2.3.0/24 dc i1 ©Rui Valadas, version 2.0, 28/9/2017 22 End-to-end routing • 1st step