Chapter 6: Network Layer Introduction to Networks Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 1 © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 2 Dermot Clarke DIT Sept’ 2013 Network Layer Network Layer Presentation_ID © 2006, Cisco Systems, Inc. All rights reserved. Presentation_ID.scr 1 Dermot Clarke DIT Sept’ 2013 Network Layer Protocols Network Layer in Communication The Network layer, or OSI Layer 3, provides services to exchange the data over the network between identified end devices. (i.e. End to End communications) ? Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 3 Cisco Confidential 4 Dermot Clarke DIT Sept’ 2013 Network Layer in Communication The Network Layer End to End Transport processes Addressing end devices Encapsulation Routing De-encapsulating Presentation_ID © 2006, Cisco Systems, Inc. All rights reserved. Presentation_ID.scr © 2008 Cisco Systems, Inc. All rights reserved. 2 Dermot Clarke DIT Sept’ 2013 Network Layer in Communication Network Layer Protocols Common Network Layer Protocols Internet Protocol version 4 (IPv4) Internet Protocol version 6 (IPv6) Legacy Network Layer Protocols Novell Internetwork Packet Exchange (IPX) AppleTalk Connectionless Network Service (CLNS/DECNet) Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 5 © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 6 Dermot Clarke DIT Sept’ 2013 Characteristics of the IP protocol Characteristics of IP Presentation_ID © 2006, Cisco Systems, Inc. All rights reserved. Presentation_ID.scr 3 Dermot Clarke DIT Sept’ 2013 Characteristics of the IP protocol IP - Connectionless IP is connectionless, it requires no initial exchange of control information to establish an end-to-end connection, nor does it require additional fields in the PDU header to maintain this connection. Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 7 Dermot Clarke DIT Sept’ 2013 Characteristics of the IP protocol IP – Best Effort Delivery Unreliable in this context does not mean that IP works properly sometimes and does not function well at other times. Unreliable means simply that IP does not have the capability to manage, and recover from, undelivered or corrupt packets. The Transport Layer will look after reliability if required. Presentation_ID © 2006, Cisco Systems, Inc. All rights reserved. Presentation_ID.scr © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 8 4 Dermot Clarke DIT Sept’ 2013 Characteristics of the IP protocol IP – Media Independent It is the responsibility of the OSI Data Link layer to take an IP packet and prepare it for transmission over the communications medium. Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 9 © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 10 Dermot Clarke DIT Sept’ 2013 IPv4 Packet Encapsulating IP Presentation_ID © 2006, Cisco Systems, Inc. All rights reserved. Presentation_ID.scr 5 Dermot Clarke DIT Sept’ 2013 IPv4 Packet IPv4 Packet Header Version, Differentiated Services (DS), Time-to-Live (TTL),Protocol, Source IP Address, Destination IP Address Byte 1 Version Byte 2 IP Header Length Byte 3 Differentiated Services Total Length DSCP ECN Identification Time To Live Byte 4 Flag Protocol Fragment Offset Header Checksum Source IP Address Destination IP Address Options (optional) Presentation_ID Padding © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 11 Dermot Clarke DIT Sept’ 2013 IP V4 Packet Header Protocol (8 bits) This filed indicates the data payload type that the packet is carrying. The Protocol field enables the Network layer to pass the data to the appropriate upper-layer protocol. Example values are: 01 ICMP; 06 TCP; 17 UDP Type-of-Service (8 bits) The field is used to determine the priority of each packet. This value enables a Quality-of-Service (QoS) mechanism to be applied to high priority packets, such as those carrying telephony voice data. Fragment Offset (13 bits) The fragment offset field identifies the order in which to place the packet fragment in the reconstruction. More Fragments flag (1 bit) The More Fragments flag bit is set (MF = 1), it means that it is not the last fragment of a packet. Don't Fragment flag (1 bit) If the Don't Fragment flag bit is set (DF = 1), then fragmentation of this packet is NOT permitted. Version (4 bits) : Contains the IP version number (4). Header Length (IHL) (4 bits) Specifies the size of the packet header. Packet Length (16 bits) This field gives the entire packet size, including header and data, in bytes. Identification (16 bits) This field is used for uniquely identifying fragments of an original IP packet. Header Checksum (16 bits) The checksum field is used for error checking the packet header. Options (variable length) There is provision for additional fields in the IPv4 header to provide other services but these are rarely used. Presentation_ID © 2006, Cisco Systems, Inc. All rights reserved. Presentation_ID.scr © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 12 6 Dermot Clarke DIT Sept’ 2013 IPv4 Packet Sample IPv4 Headers Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 13 Cisco Confidential 14 Dermot Clarke DIT Sept’ 2013 Network Layer in Communication Limitations of IPv4 IP Address depletion Internet routing table expansion Lack of end-to-end connectivity Presentation_ID © 2006, Cisco Systems, Inc. All rights reserved. Presentation_ID.scr © 2008 Cisco Systems, Inc. All rights reserved. 7 Dermot Clarke DIT Sept’ 2013 Network Layer in Communication Introducing IPv6 Increased address space Improved packet handling Eliminates the need for NAT Integrated security 4 billion IPv4 addresses 232 ≈4,000,000,000 2128 ≈ 340 undecillion IPv6 addresses 340,000,000,000,000,000,000,000,000,000,000,000,000 ≈ 6.67x 1027 IPv6 addresses per square meter on the planet. Every human on planet 5x1028 IP addresses. Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 15 Dermot Clarke DIT Sept’ 2013 Introducing IPv6 Feature IPv6 IPv4 Easier management of networks IPv6 networks provide autoconfiguration capabilities. They are simpler, flatter and more manageable, especially for large installations. Networks must be configured manually or with DHCP. IPv4 has had many overlays to handle Internet growth, which demand increasing maintenance efforts. End-to-end connective integrity Direct addressing is possible due to vast address space - the need for network address translation devices is effectively eliminated. Widespread use of NAT devices means that a single NAT address can mask thousands of nonroutable addresses, making end-toend integrity unachievable. Unconstrained address abundance 3.4 x 1038 = 340 trillion trillion trillion addresses - about 670 quadrillion addresses per square millimetre of the Earth's surface. 4.29 x 109 = 4.2 billion addresses far less than even a single IP address per person on the planet. Improved security features IPSEC is built into the IPv6 protocol, usable with a suitable key infrastructure. Security is dependent on applications - IPv4 was not designed with security in mind. Presentation_ID © 2006, Cisco Systems, Inc. All rights reserved. Presentation_ID.scr © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 16 8 Dermot Clarke DIT Sept’ 2013 IPv6 Packet Encapsulating IPv6 Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 17 Cisco Confidential 18 Dermot Clarke DIT Sept’ 2013 Host Routing Tables Host Packet Forwarding Decision Presentation_ID © 2006, Cisco Systems, Inc. All rights reserved. Presentation_ID.scr © 2008 Cisco Systems, Inc. All rights reserved. 9 Dermot Clarke DIT Sept’ 2013 Host Routing Tables Default Gateway Hosts must maintain their own, local, routing table to ensure that network layer packets are directed to the correct destination network. The local table of the host typically contains: Direct connection R Local network route Local default route Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 19 Cisco Confidential 20 Dermot Clarke DIT Sept’ 2013 Host Routing Tables Sample IPv4 Host Routing Table Presentation_ID © 2006, Cisco Systems, Inc. All rights reserved. Presentation_ID.scr © 2008 Cisco Systems, Inc. All rights reserved. 10 Dermot Clarke DIT Sept’ 2013 Host Routing Tables Sample IPv6 Host Routing Table Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 21 Dermot Clarke DIT Sept’ 2013 Router Routing Tables Router Packet Forwarding Decision Presentation_ID © 2006, Cisco Systems, Inc. All rights reserved. Presentation_ID.scr © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 22 11 Dermot Clarke DIT Sept’ 2013 Router Routing Tables IPv4 Router Routing Table 192.168.10.0/24 .10 PC1 .1 G0/1 .10 PC2 10.1.1.0/24 G0/0 .1 .10 209.165.200.224 /30 R1 .225 S0/0/0 .1 .226 R2 .1 .10 10.1.2.0/24 192.168.11.0/24 R1#show ip route Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area * - candidate default, U - per-user static route, o - ODR P - periodic downloaded static route Gateway of last resort is not set D D C L C L C L R1# 10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks 10.1.1.0/24 [90/2170112] via 209.165.200.226, 00:00:05, Serial0/0/0 10.1.2.0/24 [90/2170112] via 209.165.200.226, 00:00:05, Serial0/0/0 192.168.10.0/24 is variably subnetted, 2 subnets, 3 masks 192.168.10.0/24 is directly connected, GigabitEthernet0/0 192.168.10.1/32 is directly connected, GigabitEthernet0/0 192.168.11.0/24 is variably subnetted, 2 subnets, 3 masks 192.168.11.0/24 is directly connected, GigabitEthernet0/1 192.168.11.1/32 is directly connected, GigabitEthernet0/1 209.165.200.0/24 is variably subnetted, 2 subnets, 3 masks 209.165.200.224/30 is directly connected, Serial0/0/0 209.165.200.225/32 is directly connected, Serial0/0/0 Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. The routing table stores information about connected and remote networks. Cisco Confidential 23 Dermot Clarke DIT Sept’ 2013 Router Routing Tables Directly Connected Routing Table Entries 192.168.10.0/24 .10 PC1 .1 G0/1 .10 PC2 64.100.0.1 G0/0 .1 R1 .225 S0/0/0 .1 .226 R2 .1 C .10 10.1.2.0/24 192.168.11.0/24 A 10.1.1.0/24 .10 209.165.200.224 /30 C B 192.168.10.0/24 is directly connected, GigabitEthernet0/0 A Identifies how the network was learned by the router. B Identifies the destination network and how it is connected. C Identifies the interface on the router connected to the destination network. Presentation_ID © 2006, Cisco Systems, Inc. All rights reserved. Presentation_ID.scr © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 24 12 Dermot Clarke DIT Sept’ 2013 Router Routing Tables Remote Network Routing Table Entries 192.168.10.0/24 .10 PC1 .1 G0/1 .10 PC2 64.100.0.1 G0/0 .1 R1 .225 S0/0/0 .1 .226 R2 .1 .10 10.1.2.0/24 192.168.11.0/24 D 10.1.1.0/24 .10 209.165.200.224 /30 10.1.1.0/24 [90/2170112] via 209.165.200.226, 00:00:05, Serial0/0/0 A Identifies how the network was learned by the router. (D=EIGRP) B Identifies the (remote) destination network. C Identifies the administrative distance (trustworthiness) of the route source. D Identifies the metric to reach the remote network. E Identifies the next hop IP address to reach the remote network. F Identifies the amount of elapsed time since the network was discovered. G Identifies the outgoing interface on the router to reach the destination network. Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 25 © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 26 Dermot Clarke DIT Sept’ 2013 Routers Anatomy of a Router Presentation_ID © 2006, Cisco Systems, Inc. All rights reserved. Presentation_ID.scr 13 Dermot Clarke DIT Sept’ 2013 Anatomy of a Router A Router is a Computer Router CPU and OS Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 27 Dermot Clarke DIT Sept’ 2013 Anatomy of a Router Router Memory Memory Volatile / Non-Volatile RAM Volatile • • • • Running IOS Running configuration file IP routing and ARP tables Packet buffer ROM Non-Volatile • • • Bootup instructions Basic diagnostic software Limited IOS NVRAM Non-Volatile • Startup configuration file Non-Volatile • • IOS Other system files Flash Presentation_ID © 2006, Cisco Systems, Inc. All rights reserved. Presentation_ID.scr Stores © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 28 14 Dermot Clarke DIT Sept’ 2013 Anatomy of a Router Inside a Router Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. 29 Cisco Confidential Dermot Clarke DIT Sept’ 2013 Anatomy of a Router Router Backplane Double-wide eHWIC slots eHWIC 0 AUX port LAN interfaces Console RJ45 Two 4 GB flash card slots Presentation_ID © 2006, Cisco Systems, Inc. All rights reserved. Presentation_ID.scr USB Ports Console USB Type B © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 30 15 Dermot Clarke DIT Sept’ 2013 Anatomy of a Router LAN and WAN Interfaces Serial interfaces (WAN links) LAN interfaces Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 31 © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 32 Dermot Clarke DIT Sept’ 2013 Router Boot-up Cisco IOS Presentation_ID © 2006, Cisco Systems, Inc. All rights reserved. Presentation_ID.scr 16 Dermot Clarke DIT Sept’ 2013 Router Boot-up Bootset Files Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 33 Dermot Clarke DIT Sept’ 2013 Router Boot-up Router Bootup Process 1.Perform the POST and load the bootstrap program 2.Locate and load the Cisco IOS software 3.Locate and load the startup configuration file or enter setup mode System Bootstrap, Version 15.0(1r)M15, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport <output omitted> Presentation_ID © 2006, Cisco Systems, Inc. All rights reserved. Presentation_ID.scr © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 34 17 Dermot Clarke DIT Sept’ 2013 Router Boot-up Show Versions Output Router# show version Cisco IOS Software, C1900 Software (C1900-UNIVERSALK9-M), Version 15.2(4)M1, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2012 by Cisco Systems, Inc. Compiled Thu 26-Jul-12 19:34 by prod_rel_team ROM: System Bootstrap, Version 15.0(1r)M15, RELEASE SOFTWARE (fc1) Router uptime is 10 hours, 9 minutes System returned to ROM by power-on System image file is "flash0:c1900-universalk9-mz.SPA.152-4.M1.bin" Last reload type: Normal Reload Last reload reason: power-on <Output omitted> Cisco CISCO1941/K9 (revision 1.0) with 446464K/77824K bytes of memory. Processor board ID FTX1636848Z 2 Gigabit Ethernet interfaces 2 Serial(sync/async) interfaces 1 terminal line DRAM configuration is 64 bits wide with parity disabled. 255K bytes of non-volatile configuration memory. 250880K bytes of ATA System CompactFlash 0 (Read/Write) <Output omitted> Technology Package License Information for Module:'c1900' ----------------------------------------------------------------Technology Technology-package Technology-package Current Type Next reboot -----------------------------------------------------------------ipbase ipbasek9 Permanent ipbasek9 security None None None data None None None Configuration register is 0x2142 (will be 0x2102 at next reload) Router# Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 35 Cisco Confidential 36 Dermot Clarke DIT Sept’ 2013 Network Layer Configuring a Cisco Router Presentation_ID © 2006, Cisco Systems, Inc. All rights reserved. Presentation_ID.scr © 2008 Cisco Systems, Inc. All rights reserved. 18 Dermot Clarke DIT Sept’ 2013 Configure Initial Settings Router Configuration Steps 192.168.10.0/24 PC1 PC2 .10 G0/0 .1 .1 G0/1 .10 R1 .226 .225 S0/0/0 10.1.1.0/24 .10 209.165.200.224 /30 .1 R2 .1 .10 10.1.2.0/24 192.168.11.0/24 Router> enable Router# configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router(config)# hostname R1 R1(config)# R1(config)# enable secret class R1(config)# R1(config)# line console 0 R1(config-line)# password cisco R1(config-line)# login R1(config-line)# exit R1(config)# R1(config)# line vty 0 4 R1(config-line)# password cisco R1(config-line)# login R1(config-line)# exit R1(config)# R1(config)# service password-encryption R1(config)# Presentation_ID OR Router> en Router# conf t Enter configuration commands, one per line. End with CNTL/Z. Router(config)# ho R1 R2(config)# R1(config)# banner motd # Enter TEXT message. End with the character '#'. *********************************************** WARNING: Unauthorized access is prohibited! *********************************************** # R1(config)# R1# copy running-config startup-config Destination filename [startup-config]? Building configuration... [OK] R1# © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 37 Dermot Clarke DIT Sept’ 2013 Configure Interfaces Configure LAN Interfaces 192.168.10.0/24 PC1 PC2 .10 10.1.1.0/24 G0/0 .1 .1 G0/1 .10 .10 209.165.200.224 /30 R1 .225 S0/0/0 .1 .226 R2 .1 .10 10.1.2.0/24 192.168.11.0/24 R1# conf t Enter configuration commands, one per line. End with CNTL/Z. R1(config)# R1(config)# interface gigabitethernet 0/0 R1(config-if)# ip address 192.168.10.1 255.255.255.0 R1(config-if)# description Link to LAN-10 R1(config-if)# no shutdown %LINK-5-CHANGED: Interface GigabitEthernet0/0, changed state to up %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to up R1(config-if)# exit R1(config)# R1(config)# int g0/1 R1(config-if)# ip add 192.168.11.1 255.255.255.0 R1(config-if)# des Link to LAN-11 R1(config-if)# no shut %LINK-5-CHANGED: Interface GigabitEthernet0/1, changed state to up %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/1, changed state to up R1(config-if)# exit R1(config)# Presentation_ID © 2006, Cisco Systems, Inc. All rights reserved. Presentation_ID.scr © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 38 19 Dermot Clarke DIT Sept’ 2013 Configure Interfaces Verify Interface Configuration 192.168.10.0/24 PC1 PC2 .10 10.1.1.0/24 G0/0 .1 .1 G0/1 .10 .10 209.165.200.224 /30 R1 .1 .226 .225 S0/0/0 R2 .1 10.1.2.0/24 192.168.11.0/24 R1# show ip interface brief Interface IP-Address GigabitEthernet0/0 192.168.10.1 GigabitEthernet0/1 192.168.11.1 Serial0/0/0 209.165.200.225 Serial0/0/1 unassigned Vlan1 unassigned R1# R1# ping 209.165.200.226 .10 OK? Method Status YES YES YES YES YES manual manual manual NVRAM NVRAM Protocol up up up up up up administratively down down administratively down down Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 209.165.200.226, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/9 ms R1# Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 39 Dermot Clarke DIT Sept’ 2013 Configuring a Cisco Router Configuring the Default Gateway on PC Presentation_ID © 2006, Cisco Systems, Inc. All rights reserved. Presentation_ID.scr © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 40 20 Dermot Clarke DIT Sept’ 2013 Configuring the Default Gateway Default Gateway on a Host .10 PC1 192.168.10.0/24 .1 G0/0 .10 PC2 R1 G0/1 .1 PC4 .10 PC1 .10 PC3 192.168.11.0/24 .10 192.168.10.0/24 .1 G0/0 .11 PC2 R1 G0/1 .1 .10 PC3 .11 PC4 Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. 192.168.11.0/24 Cisco Confidential 41 Dermot Clarke DIT Sept’ 2013 Configuring the Default Gateway Default Gateway on a Switch S1#show running-config Building configuration... ! <output omitted> service password-encryption ! hostname S1 ! Interface Vlan1 ip address 192.168.10.50 ! ip default-gateway 192.168.10.1 <output omitted> PC1 PC2 .10 192.168.11.0/24 192.168.10.0/24 .1 G0/0 S1 .11 .50 R1 .1 G0/1 S2 If the default gateway were not configured on S1, response packets from S1 would not be able to reach the administrator at 192.168.11.10. The administrator would not be able to mange the device remotely. Presentation_ID © 2006, Cisco Systems, Inc. All rights reserved. Presentation_ID.scr © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 42 21 Dermot Clarke DIT Sept’ 2013 Presentation_ID © 2006, Cisco Systems, Inc. All rights reserved. Presentation_ID.scr © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 43 22