1 Circuit Switched Switched Network Network Circuit G. Bianchi, - - PDF document

1
SMART_READER_LITE
LIVE PREVIEW

1 Circuit Switched Switched Network Network Circuit G. Bianchi, - - PDF document

Lecture 8. Lecture 8. Internet Network Layer: Internet Network Layer: IP Fundamentals IP Fundamentals G. Bianchi, G. Neglia Outline Outline Layer 3 functionalities Internet Protocol (IP) characteristics IP packet (first look)


slide-1
SLIDE 1

1

  • G. Bianchi, G. Neglia

Lecture 8. Lecture 8.

Internet Network Layer: Internet Network Layer:

IP Fundamentals IP Fundamentals

  • G. Bianchi, G. Neglia

Outline Outline

Layer 3 functionalities Internet Protocol (IP) characteristics IP packet (first look) IP addresses Routing tables: how to use ARP

  • G. Bianchi, G. Neglia

Layer 3 functionalities Layer 3 functionalities

This layer handles the routing of the data: i.e. delivery data to the correct destination Layer 3 functionalities are spread all over the network in ad hoc apparatus (routers) in your PC (as routing software)

slide-2
SLIDE 2

2

  • G. Bianchi, G. Neglia

Circuit Circuit Switched Switched Network Network

  • G. Bianchi, G. Neglia

Packet Packet Switched Switched Network Network

Router C Router B Router F Router D

Internet routing

Router E

A G

  • G. Bianchi, G. Neglia

Internet Protocol (IP) Internet Protocol (IP)

RFC 791 (1981) RFC 791 (1981) Connectionless datagram delivery service Best-effort Unreliable no guarantees of reception & packet order error-handling algorithm: throw away packet!

Upon buffer congestion Upon error check failed

slide-3
SLIDE 3

3

  • G. Bianchi, G. Neglia

IP functions in your PC IP functions in your PC

  • G. Bianchi, G. Neglia

IP IP datagram datagram format format

20 20 bytes bytes header header (minimum) (minimum)

3 7 15 31 Type of Service TOS Total Length Options (if any) 32 bit destination IP address Data (if any) Version Header length 16 bit identification 32 bit source IP address Time to Live TTL Protocol 13 bit fragment offset Header checksum flags 3 bit Padding (0s)

  • G. Bianchi, G. Neglia

IP address IP address

32 bit string Bit-wise notation the natural notation dotted notation: 4 x 8 bits each 8 bit = 0:255 integer intended for humans

10010011101000110001010000001001 10010011 . 10100011 . 00010100 . 00001001

147 . 163 . 20 . 9

Dotted Notation is often misleading, as it may hide address properties

slide-4
SLIDE 4

4

  • G. Bianchi, G. Neglia

Notation conversion Notation conversion bin bin -

  • > dotted

> dotted

147.163.20.9 (www.diepa.unipa.it)

binary 128 64 32 16 8 4 2 1 decimal 10010011 1 1 1 1 128+16+2+1=147 10100011 1 1 1 1 128+32+2+1 = 163 00010100 1 1 16+4 = 20 00001001 1 1 8+1 = 9

10010011.10100011.00010100.00001001

  • G. Bianchi, G. Neglia

Notation conversion Notation conversion dotted dotted -

  • > bin

> bin

131.175.21.1 (morgana.elet.polimi.it)

decimal 128 64 32 16 8 4 2 1 binary 131 1 1 1 128+2+1=10000011 175 1 1 1 1 1 1 128+32+8+4+2+1 = 10101111 21 1 1 1 16+4+1 = 00010101 1 1 1 = 00000001

10000011.10101111.00010101.00000001

  • G. Bianchi, G. Neglia

Need for network name Need for network name

Host b Host a Host c Host d Host e Host f All other worldwide networks Host g a => left, b => left, c => right, d => right e => left, f => left g => left, ...

in 2000 100M nodes!

R1 R2

slide-5
SLIDE 5

5

  • G. Bianchi, G. Neglia

Need for network name Need for network name

Host b Host a Host c Host d Host e Host f All other worldwide networks Host g R1 R2 X => left, Y => right, Z => left, W => left, ... Network X Network Y Network W Network Z

  • G. Bianchi, G. Neglia

Need for network name Need for network name

Host b Host a Host c Host d Host e Host f All other worldwide networks Host g R1 R2 X=>left, Y=>right, everything else =>R2 knows Network X Network Y Network W Network Z

Where is network name?

  • G. Bianchi, G. Neglia

IP Address Structure IP Address Structure

partitioned into two fields partitioned into two fields

  • 32 bit IP address

Dotted notation: AAA.BBB.CCC.DDD - no physical meaning! A more correct notation should be: NNNNN-HHHHH

slide-6
SLIDE 6

6

  • G. Bianchi, G. Neglia

IP Address Structure IP Address Structure

partitioned into two fields partitioned into two fields

  • 32 bit IP address

3-2 3-5 3-8

! "#$ $"

  • G. Bianchi, G. Neglia

Dotted notation Dotted notation vs vs IP address structure IP address structure

Dotted Notation AAA.BBB.CCC.DDD

no physical meaning!

  • ften misleading!

– it may hide address properties

More correct notation: NNNNN-HHHHH

Physical meaning (network prefix, host #)

Prefix size is variable, Not implicit in the IP address (from 1993)

Separator must be provided externally

  • G. Bianchi, G. Neglia

Example Example

IP address 147.163.22.130 Bitwise notation: Network prefix: Externally provided Example: first 22 bits network ID, last 10 bits host ID Network prefix notation:

/22 (modern notation) Netmask (traditional notation) Netmask dotted decimal: 255.255.252.0

10010011.10100011.00010110.10000010 11111111.11111111.11111100.00000000 10010011.10100011.00010110.10000010

slide-7
SLIDE 7

7

  • G. Bianchi, G. Neglia

Network Address Network Address

Local Host Interface: 147.163.21.9/22

10010011.10100011.00010101.00001001

147.163.21.9 Network Address

10010011.10100011.00010100.00000000

Network prefix Hostid

Dotted notation for the network address 147.163.20.0

Pure Convenience (not only for men)!

  • G. Bianchi, G. Neglia

Naming in IP: networks Naming in IP: networks

Network 143 Host 2 Host 1 Network 542 Host 12 Host 2 Network xxx Network yyy All other worldwide networks Network name:

  • %%%%%%%%%%%%%%

Special IP addresses, with all 0’s in host part All existing (physical) networks have different names!

  • G. Bianchi, G. Neglia

Naming in Naming in IP IP: hosts : hosts

  • !

&'&()*+' !((,+*-+.'*-*!/ 0+112-+3!002***

3-2 3-5 3-8

! "#$ $" "#% # % "4

  • "
  • %
slide-8
SLIDE 8

8

  • G. Bianchi, G. Neglia

IP address 147.163.22.130 Network prefix: /22 (equivalently: 255.255.252.0) It is an IP address for a HOST Simple: not all 0’s in host part Which belongs to network 147.163.20.0/22 Simple: just set 0’s in host part

Example Example

10010011.10100011.00010110.10000010 10010011.10100011.00010110.10000010 10010011.10100011.00010100.00000000

  • G. Bianchi, G. Neglia

Naming in Naming in IP IP: broadcast : broadcast

3-2 3-5 3-8

  • "
  • !56

Means: all the hosts on the considered network! Used to send a “broadcast” information (to all the Attached hosts)

Example: network 147.163.20.0/22 What is the IP address to use for broadcasting? Simple: just set all 1’s in host part Broadcast address: 147.163.23.255

10010011.10100011.00010111.11111111

  • G. Bianchi, G. Neglia

Test Test

147.163.0.128 (prefix: /26) Network? Host? Broadcast? 147.163.0.128 (prefix: /24) Network? Host? Broadcast? 147.163.14.3 (prefix: /30) Network? Host? Broadcast? 174.163.20.255 (prefix: /22) Network? Host? Broadcast?

Think in binary! And everything becomes trivial….

slide-9
SLIDE 9

9

  • G. Bianchi, G. Neglia

Second role of an IP address: routing Second role of an IP address: routing

Routing = ability to forward packets to destination Routing = ability to forward packets to destination Network 143 143-1 Host 2 Host 1 143-2 143-3 542-1 Network 542 Host 12 542-3 Host 2 542-2 "

  • 7
  • 5%%89

"# ! #$

& #

  • !+3
  • G. Bianchi, G. Neglia

Packet Packet Routing Routing (at (at local local host host) )

!

  • +3":5#:;:":5<

%

7+3#,,,

  • ":5#:
  • !=

>= 321-2

( +3*?

  • 2

!@

  • G. Bianchi, G. Neglia

NetAddress NetAddress computation (Masking) computation (Masking)

Is on the same network?

Local Host Interface: 147.163.21.9 Destination IPaddr: 147.163.22.130

10010011.10100011.00010110.10000010

147.163.22.130 147.163.21.9

10010011.10100011.00010101.00001001 Netaddresses are equal! They are on the same network! How does IP software really work?

slide-10
SLIDE 10

10

  • G. Bianchi, G. Neglia

NetAddress NetAddress computation (Masking) computation (Masking)

Network mask associated to the network address string of 1s in network address, 0s in host address

Local Host Interface: 147.163.21.9

10010011.10100011.00010101.00001001

147.163.21.9 Netmask

11111111.11111111.11111100.00000000

Netaddress Hostid

Dotted notation for the netmask 255.255.252.0

  • G. Bianchi, G. Neglia

NetAddress NetAddress computation (Masking) computation (Masking)

Is on the same network?

Destination IPaddr: 147.163.22.130

10010011.10100011.00010110.10000010

147.163.22.130 147.163.21.9 255.255.252.0 Netmask: 255.255.252.0

11111111.11111111.11111100.00000000

Bitwise AND

10010011.10100011.00010100.00000000

Network Address: 147.163.20.0

=? =

10010011.10100011.00010100.00000000

=

They are on the same network!

  • G. Bianchi, G. Neglia

Inside the LAN Inside the LAN

43-5 43-3 A 2 43-1

Who is IP 43-1?

43-1 ff:ff:ff:ff:ff:ff

43-0 = 43-0 (it is on this net)

Physical transmission: a) resolve IP address in physical network address, b) encapsulate packet in datalink frame, and c) deliver according to local networking technology 43-1

slide-11
SLIDE 11

11

  • G. Bianchi, G. Neglia

Host configuration (Windows) Host configuration (Windows)

  • G. Bianchi, G. Neglia

Possible Possible netmask netmask values values

“magic “magic netmask netmask numbers” numbers” 1 1 1 1 1 1 1 1 = 255 1 1 1 1 1 1 1 = 254 1 1 1 1 1 1 = 252 1 1 1 1 1 = 248 1 1 1 1 = 240 1 1 1 = 224 1 1 = 192 1 = 128

128 64 32 16 8 4 2 1 Examples: /21

  • 255.255.248.0

/29

  • 255.255.255.248
  • G. Bianchi, G. Neglia

Going Going through a through a Router Router

43-1 43-3 A ! A (+3 321-2

Who is IP 43-3? MAC ff:04.a

321-2 ff:04.a

321-0 != 43-0 (not on this net!) Send to 43-3: he knows more…

Physical transmission: a) resolve IP address in physical network address, b) encapsulate packet in datalink frame, and c) deliver according to local networking technology 43-5

slide-12
SLIDE 12

12

  • G. Bianchi, G. Neglia

Network 321 321-12 321-2 Network 43 43-1 321-2

Net 321?? Not this net! Go to host 43-3

43-3 321-2

Net 321?? Yes, I’m attached to! translate 321-1 in phy net address & deliver

Network 175 175-1 175-2

Router Router operation

  • peration:

: Direct Direct Forwarding Forwarding

  • G. Bianchi, G. Neglia

Network 175 Network 321 175-1 175-2 321-12 321-2 Network 43 43-1 175-2

Net 175?? Not this net! Go to host 43-3

151-6 175-2

Net 175?? Not here. But my tables say that router 151.4 knows. Go there (with 151 net technology)

43-3 151-4 Network 151 INTERNET = arbitrary networks interconnected via routers

Router Router operation

  • peration:

: Indirect Indirect Forwarding Forwarding

  • G. Bianchi, G. Neglia

Layered view Layered view

IP N.i. 1 application transport IP network interface 3

Logical network 14000-0

application transport IP network interface

Host B

29999-6

N.i. 2 IP N.i. 2 N.i.3

  • dest. addr. 29999-6

Host A

14000-4

Router Indirect forwarding Router Direct forwarding Logical network 29999-0 Logical network 111-0

Datagrams travel from router to router (indirect forwarding) until a router is on the same network of dest host (direct forwarding)

slide-13
SLIDE 13

13

  • G. Bianchi, G. Neglia

Inter Inter -

  • Net example

Net example

Ethernet IP TCP UDP ATM PPP FDDI IP FDDI IP TCP UDP Atm Ethernet ATM IP

ATM switch host host

PPP IP

ATM network Ethernet Telephone line FDDI

router router router

... ... ... ... ... ... ... ...

1 hop = ATM

network and switch crossing!

  • G. Bianchi, G. Neglia

Internet Internet vs vs specific specific physical physical networking networking technology technology

IP: an overlay networking protocol interconnection of widely heterogeneous networks

seen by TCP/IP as sub networks Routers do not care about specific network technology (LAN, WAN, circuit switching, packet switching, …) but they NEED to have a specific network interface (Routers with

Ethernet interfaces cheap; with FDDI or ATM very expensive…)

Router duties: just select destination (end or intermediate router)! then map IPaddr in physical network address IP datagrams tunneled into underlying network data units specific physical network routing may be extremely complex (router sees this as single hop)

  • G. Bianchi, G. Neglia

Routing table Routing table

20000-5 20000-6 30000-12 30000-7 Net 20000 Net 30000 R1 R2 R3 10000-32 Net 10000

Other nets Net 50000

40000-8

Destination Network Next Hop 20000 Direct forward 30000 Direct forward 10000 20000-5 40000 30000-7 50000 30000-7 default 20000-5 R2 routing table Net 40000 Three cases: 1) direct forwarding 2) Indirect forwarding (explicit) 3) Indirect forwarding via default router (when available) Routing via network Id, not host Id! Otherwise too large tables

slide-14
SLIDE 14

14

  • G. Bianchi, G. Neglia

Routing table lookup Routing table lookup

132.43.3.5 132.43.0.6 208.0.1.12 208.0.1.7 Net 132.43.0.0 Net 208.0.1.0 R1 R2 R3 10.12.1.32 Net 10.0.0.0 Other nets Net 193.33.9.0 208.0.2.8

Dest net /mask Next Hop 132.43.0.0 /16 Direct forward 208.0.1.0 /24 Direct forward 10.0.0.0 /8 132.43.3.5 208.0.2.0 /24 208.0.1.7 193.33.9.0 /24 208.0.1.7 208.1.1.0 /24 132.43.3.5 R2 routing table

Net 208.0.2.0 208.1.1.0

default 132.43.3.5 IP dest: 208.1.1.14 For (rows in rtab) IP_dest&mask == dest_net? Found: 208.1.1.0 Lookup? goto 132.43.3.5

  • G. Bianchi, G. Neglia

Route print ( Route print (DOS,unix DOS,unix) )

shows routing table of your PC shows routing table of your PC

(remember: your PC is a simple IP router) (remember: your PC is a simple IP router)

=========================================================================== Active Routes: Network Destination Netmask Gateway Interface Metric 0.0.0.0 0.0.0.0 10.163.57.1 10.163.57.77 1 10.163.57.0 255.255.255.0 10.163.57.77 10.163.57.77 1 10.163.57.77 255.255.255.255 127.0.0.1 127.0.0.1 1 10.255.255.255 255.255.255.255 10.163.57.77 10.163.57.77 1 127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1 1 224.0.0.0 224.0.0.0 10.163.57.77 10.163.57.77 1 255.255.255.255 255.255.255.255 10.163.57.77 10.163.57.77 1 Default Gateway: 10.163.57.1 ===========================================================================

  • G. Bianchi, G. Neglia

Classful Classful IP Addressing IP Addressing

Originally (from 1981) a rigid two-level address structure

Network number (network prefix) Host number 32 bit IP address 8,16 or 24 bits

slide-15
SLIDE 15

15

  • G. Bianchi, G. Neglia

Primary Address Classes Primary Address Classes

3 standardized classes 3 standardized classes

NET ID (7bit) HOST ID (24 bit) 1 NET ID (14bit) HOST ID (16 bit) 1 NET ID (21bit) HOST ID (8 bit) 1 0

Class A - /8 network prefix Class B - /16 network prefix Class C - /24 network prefix /xx notation: modern notation in principle not necessary for classful IP addressing

  • G. Bianchi, G. Neglia

Additional classes Additional classes

1 Multicast Group ID (28 bit) 1 1

Class D: IP multicasting

1 reserved 1 1

Class E: reserved for experimental use

1

  • G. Bianchi, G. Neglia

Dotted Decimal Ranges Dotted Decimal Ranges

Address Class Class A Class B Class C Dotted Decimal ranges 1.xxx.xxx.xxx through 126.xxx.xxx.xxx 128.0.xxx.xxx through 191.255.xxx.xxx 192.0.0.xxx through 223.255.255.xxx Class D (mcast) 224.xxx.xxx.xxx through 239.xxx.xxx.xxx Class E (exper) 240.xxx.xxx.xxx through 255.xxx.xxx.xxx

slide-16
SLIDE 16

16

  • G. Bianchi, G. Neglia

Examples Examples

15.10.10.90

Net ID Host ID

CLASS A

131.175.12.3

Net ID Host ID

CLASS B

195.31.235.10

Net ID Host ID

CLASS C

  • G. Bianchi, G. Neglia

Addressing networks Addressing networks

All 0s host ID = reserved for network name. Examples: CLASS A network: 13.0.0.0 CLASS B network: 131.175.0.0 CLASS C network: 193.32.43.0

Test:

188.66.32.0 = ??? 122.0.0.0 = ???

  • G. Bianchi, G. Neglia

Special Addresses Special Addresses

all 1s host id: broadcast address (all hosts in the network)

  • es. 131.175.255.255 =all hosts attached to the 131.175 net

0.0.0.0 = THIS host on THIS network (0.x.x.x also reserved)

e.g. to boot diskless WS (BOOTP)

127.x.x.x used for loopback (es. 127.0.0.1=localhost) all 1s = 255.255.255.255 = limited broadcast

all nodes on THIS local network

slide-17
SLIDE 17

17

  • G. Bianchi, G. Neglia

Address blocks for private Internets Address blocks for private Internets (RFC 1918) (RFC 1918) IANA IANA-

  • Allocated

Allocated, Non , Non-

  • Internet

Internet Routable Routable, , IP IP Address Address Schemes Schemes

Class Network Address Range A 10.0.0.0-10.255.255.255 B 172.16.0.0-172.31.255.255 C 192.168.0.0-192.168.255.255

To be used by private organizations not connected to the Internet No need to ask to IANA or InterNIC for these addresses. Use Network Address Translator (NAT) when external connectivity needed

  • G. Bianchi, G. Neglia

Network Address Translator Network Address Translator

“Inside” Network “Outside” Network

10.0.0.2 10.0.0.3 NAT Table Inside Local IP Address Global IP Address 10.0.0.2 10.0.0.3 192.69.1.1 192.69.1.2 Source Address

NAT

Internet

10.0.0.2 192.69.1.1

Map external address with Internal ones (may be a subset)

  • G. Bianchi, G. Neglia

Counting up Counting up

32 bit IP address: 232 = 4.294.967.296 theoretical IP addresses class A: 27-2 =126 networks [0.0.0.0 and 127.0.0.0 reserved] 224-2 = 16.777.214 maximum hosts

2.113.928.964 addressable hosts (49,22% of max)

class B 214=16.384 networks 216-2 = 65.534 maximum hosts

1.073.709.056 addressable hosts (24,99% of max)

class C 221=2.097.152 networks 28-2 = 254 maximum hosts

532.676.608 addressable hosts (12,40% of max) Class A Class B C D E The IP address Pie!

slide-18
SLIDE 18

18

  • G. Bianchi, G. Neglia

Routing table lookup Routing table lookup

132.43.3.5 132.43.0.6 208.0.1.12 208.0.1.7 Net 132.43.0.0 Net 208.0.1.0 R1 R2 R3 10.12.1.32 Net 10.0.0.0 Other nets Net 193.33.9.0 208.0.2.8

Destination net Next Hop 132.43.0.0 Direct forward 208.0.1.0 Direct forward 10.0.0.0 132.43.3.5 208.0.2.0 208.0.1.7 193.33.9.0 208.0.1.7 208.1.1.0 132.43.3.5 R2 routing table

Net 208.0.2.0 208.1.1.0

default 132.43.3.5 IP dest: 208.1.1.14 Which class? C Destination net? 208.1.1.0 Lookup? goto 132.43.3.5

  • G. Bianchi, G. Neglia

Net Address computation Net Address computation (Masking) (Masking)

class mask:

Depends on first bits of address (which specify class)

Class A mask: 255.0.0.0 Class B mask: 255.255.0.0 Class C mask: 255.255.255.0

10011111 01100100 00001001 00010010 11111111 11111111 00000000 00000000

DEST IP address: 159.100.9.18 class B Class B Mask: 255.255.0.0

Bitwise AND

Net address 159.100.0.0

10011111 01100100 00000000 00000000