Top Banner
Internet Protocols IPv4 (Internet Protocol) IP Address IP header Subnetting Routing ICMP (Internet Control Message Protocol) IPv6
94

Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

Jan 18, 2018

Download

Documents

Maud Daniels

Connectionless Internetworking Unreliable —Not guaranteed delivery —Not guaranteed order of delivery Packets can take different routes —Reliability is responsibility of next layer up (e.g. TCP) Stateless 健忘的
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

Internet Protocols• IPv4 (Internet Protocol)

—IP Address—IP header—Subnetting—Routing

• ICMP (Internet Control Message Protocol)• IPv6

Page 2: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

IP (Internet Protocol)• IP 位於網際網路層, (OSI 第三層 )• 主要提供多個互連網路間之路由 / 繞送

(Routing) 功能。• 協定特性: Connectionless 、 Unreliable• 為能提供有效路由功能,制定了 IP 定址機制。• 每一 TCP/IP 網路上之主機均有一 32-bit IP 位址。

— 140.131.76.1• RFC 791

—www.rfc-editor.orgIPv4 Address Space:http://www.iana.org/assignments/ipv4-address-space

Page 3: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

Connectionless Internetworking

• Unreliable—Not guaranteed delivery—Not guaranteed order of delivery

• Packets can take different routes—Reliability is responsibility of next layer

up (e.g. TCP)

Stateless 健忘的

Page 4: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

IP Address• 長度: 4 Octets (32-Bit)• 每一 IP 位址包括兩個部份

—網路位址 (Network Address)—主機位址 (Host Address)

• 有時一網路會再分割為多個子網路,此時主機位址又再細分為子網路 (Subnet) 及主機 (Host) 兩個部份。

Network Host

Network HostSubnet

163.22.20.17

Page 5: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

Figure 8.5IPv4 Address Formats

0 ~ 127

128 ~ 191

192 ~ 223

224 ~ 239

240 ~

A

B

C

DE

Page 6: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

IP Addresses - Class A• 32 bit global internet address• Network part and host part• Class A

—Start with binary 0—All 0 reserved (0.0.0.0)—01111111 (127) reserved for loopback—Range 1.x.x.x to 126.x.x.x—All allocated

Page 7: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

IP Addresses - Class B• Start 10• Range 128.x.x.x to 191.x.x.x• Second Octet also included in network

address• 214 = 16,384 class B addresses• All allocated

Page 8: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

IP Addresses - Class C• Start 110• Range 192.x.x.x to 223.x.x.x• Second and third octet also part of

network address• 221 = 2,097,152 addresses• Nearly all allocated

—See IPv6

Page 9: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

Addressing Modes• Unicast

— 163.22.20.16• Multicast (Class D)

— 224.0.0.9— http://www.iana.org/assignments/multicast-addresses

• Broadcast— 255.255.255.255— 163.22.20.255 RIP

Routing Information Protocol

Page 10: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

IP 位址分類

Page 11: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

Special IP Addresses• All-0 host suffix Network Address

— 163.22.20.16/24 163.22.20.0/24— 163.22.20.137/25 163.22.20.?/25— 163.22.20.137: 163.22.20.10001001 163.22.20.10000000— 163.22.20.128/25

• All-0s This computer— 0.0.0.0

• All-0s network This network.— 163.22.20.7/24 0.0.0.7 (Host 7 on this network)

• All-1 host suffix All hosts on the destination net(directed broadcast)

163.22.20.16/24 163.22.20.255• All-1s All hosts on this net (limited broadcast)

— 255.255.255.255 Subnet number cannot be all 1

• 127.*.*.* Loopback through IP layer— 127.0.0.1

Page 12: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

Private IP Addresses• Any organization can use these inside their network• Can’t go on the internet. [RFC 1918]

—10.0.0.0 - 10.255.255.255 (10/8 prefix)—172.16.0.0 - 172.31.255.255 (172.16/12 prefix)—192.168.0.0 - 192.168.255.255 (192.168/16 prefix)

• Network Address Translation (NAT)— Basic NAT (one-to-one NAT)— NAT(NAPT, Network Address Port Translation)

116256

Page 13: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.
Page 14: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

Subnets and Subnet Masks• Allow arbitrary complexity of internetworked

LANs within organization• Insulate overall internet from growth of network

numbers and routing complexity• Site looks to rest of internet like single network• Each LAN assigned subnet number• Host portion of address partitioned into subnet

number and host number• Local routers route within subnetted network• Subnet mask indicates which bits are subnet

number and which are host number

Page 15: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

網路遮罩 (Net Mask, Subnet Mask)• 網路遮罩,將一 IP 位址中之代表網路及子網路位址之位元設為 1 ,其餘設為 0 即為網路遮罩。

—Class A 255.0.0.0—Class B 255.255.0.0—Class C 255.255.255.0

• 網路遮罩與 IP 位址利用邏輯 AND 便可得到網路位址。

Page 16: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.
Page 17: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

Examples of Subnetworking

192.168.17.x

00100000

01100000

01000000

00111001

Page 18: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

Question• 一個原為 Class C 之 IP 網路,均分成多個子網路遮罩為 255.255.255.224 的子網路後,將減少 ____ 個可配置的主機位址。 (96 研 )• Hints:

— Class C: 255.255.255.0— 224: 11100000 — host all 0’s: Network ID— host all 1’s: Broadcast address

Page 19: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

• Host: 10.10.4.26• Subnet mask: 255.255.255.0• Default Gateway: 10.10.4.254

• Send a packet destined to 10.10.4.35— 10.10.4.35 AND 255.255.255.0 ?= 10.10.4.26 AND

255.255.255.0 Yes, the same subnet—Send to 10.10.4.35 directly

• Send a packet destined to 10.10.6.3—10.10.6.3 AND 255.255.255.0 ?= 10.10.4.26 AND

255.255.255.0 No, the different subnets—Send to default gateway (10.10.4.254)

Page 20: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

IPv4 Header

Page 21: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

Header Fields (1)• Version

—Currently 4• IHL (Internet header length)

—In 32 bit words—Including options

• DS/ECN (or Type of service)• Total length

—Of datagram, in octets

DS: Differentiated ServiceECN: Explicit Congestion Notification

Page 22: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

Header Fields (2)• Identification

—Sequence number—Used with addresses and user protocol to

identify datagram uniquely• Flags

—More bit• Indicates that this is not the last fragment

—Don’t fragment• Fragmentation offset

• Position of fragment of user data in original datagram

• In multiples of 64 bits (8 octets)

0 DF MF

Page 23: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

Fragmentation and Re-assembly• Different packet sizes• When to re-assemble

—At destination• Results in packets getting smaller as data traverses

internet—Intermediate re-assembly

• Need large buffers at routers• Buffers may fill with fragments• All fragments must go through same router

– Inhibits dynamic routing

Page 24: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

Figure 8.2Fragmentation Example

Page 25: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

Header Fields (3)• Time to live• Protocol

—Next higher layer to receive data field at destination

• Header checksum—Reverified and recomputed at each router—16 bit ones complement sum of all 16 bit

words in header—Set to zero during calculation

Page 26: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

Datagram Lifetime• Datagrams could loop indefinitely• Datagram marked with lifetime

—Time To Live field in IP—Hop count

• Decrement time to live on passing through a each router

—Time count• Need to know how long since last router

• Once lifetime expires (TTL = 0)—Router discards the datagram—Router sends ICMP Time Exceeded to the source.

Page 27: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

Traceroute• To provide a trace of the path the packet took to

reach the destination.• Operates by first sending out a packet with a Time

To Live (TTL) of 1. The first hop then sends back an ICMP error message indicating that the packet could not be forwarded because the TTL expired.

• The packet is then resent with a TTL of 2, and the second hop returns the TTL expired. This process continues until the destination is reached.

• Record the source of each ICMP TTL exceeded message

RFC 1393

http://www.visualroute.com/

Page 28: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

C:\>tracert www.google.com

Tracing route to www.l.google.com [72.14.235.104]over a maximum of 30 hops:

1 <1 ms <1 ms <1 ms gateway.puli34-10-10.ncnu.edu.tw [10.10.34.254] 2 <1 ms <1 ms <1 ms ip253.puli01.ncnu.edu.tw [163.22.1.253] 3 <1 ms <1 ms <1 ms ip090.puli18-10-10.ncnu.edu.tw [10.10.18.90] 4 <1 ms <1 ms <1 ms ip094.puli18.ncnu.edu.tw [163.22.18.94] 5 23 ms 1 ms 1 ms ip098.puli255-64-203.ncnu.edu.tw [203.64.255.98] 6 2 ms 3 ms 3 ms 140.128.251.38 7 * * 5 ms bb-MOE-CHT.TANet.edu.tw [192.83.196.111] 8 6 ms 6 ms 6 ms 202.169.174.58 9 28 ms 28 ms 28 ms 202.169.174.4510 31 ms 30 ms 29 ms 202.40.161.111 * * * Request timed out.12 62 ms 63 ms 62 ms 218.100.16.2413 63 ms 63 ms 63 ms 216.239.43.6814 62 ms 64 ms 62 ms 66.249.95.19815 63 ms 64 ms 63 ms 72.14.232.16216 65 ms 63 ms 69 ms 72.14.232.22117 77 ms 73 ms 70 ms 72.14.232.21718 64 ms 73 ms 64 ms tw-in-f104.google.com [72.14.235.104]

Trace complete.

tracert

Page 29: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.
Page 30: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

http://www.visualroute.com/

VisualRoute

Page 31: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

Protocol• Protocol: 8 bits

—Identifies contents of data field—1 = ICMP—6 = TCP—17 =UDP

http://www.iana.org/assignments/protocol-numbers

IPHeader

Data FieldICMP, TCP, or UDP Message

Page 32: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

Header Fields (4, 5, 6)• Source address• Destination address• Options

—Security—Source routing (Strict, Loose)—Route recording—Stream identification—Timestamp

• Padding—To fill to multiple of 32 bits long

Page 33: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

Data Field• Carries user data from next layer up• Integer multiple of 8 bits long (octet)• Max length of datagram (header plus

data) 65,535 octets

Page 34: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

Routing• End systems and routers maintain routing tables

—Indicate next router to which datagram should be sent—Static

• May contain alternative routes—Dynamic

• Flexible response to congestion and errors• Source routing

—Source specifies route as sequential list of routers to be followed

—Security—Priority

• Route recording

Page 35: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

Internet Protocol Operation* A BRouter X makes a decision:1. B is in one of the networks to

which X is attached. send2. B is in a remote network.

Additional routers must be traversed. routing

3. X does not know the destination address. Error message

Page 36: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

Routers and the IP Addressing Principle

• Routers have two or more addresses. One for each interface.

Page 37: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

Routing Table

IF ((Mask[i] & Destination Addr) = = Destination[i]) Forward to NextHop[i]

Page 38: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

Routing TableRow

DestinationNetwork or

SubnetMask (/Prefix)* Metric

(Cost)

Next-Hop

RouterInterface

1 128.171.0.0 255.255.0.0 (/16) 47 G2

2 172.30.33.0 255.255.255.0 (/24) 0 Local1

3 192.168.6.0 255.255.255.0 (/24) 12 G2

Routers Base Routing Decisions on Their Routing Tables.

Each Row Represents a Route to a Network or Subnet

For Each Arriving Packet,The Packet’s Destination IP Address

Is Matched Against theDestination Network or Subnet Field in Every Row

C:\> route print

Page 39: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

Routing Table

RowDestinationNetwork or

SubnetMask (/Prefix)* Metric

(Cost)

Next-Hop

RouterInterface

1 128.171.0.0 255.255.0.0 (/16) 47 G2

2 172.30.33.0 255.255.255.0 (/24) 0 Local1

3 192.168.6.0 255.255.255.0 (/24) 12 G2

Each Row Represents a Route to a Network or Subnet.

All packets to that network or subnet are governed by that one row.

So there is one rule for a range of IP addresses.This reduces the number of rows that must be considered.

Page 40: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

Routing Table

Row 1If Destination IP Address = 172. 30.33.6

Mask = 255.255. 0.0Result = 172. 30. 0.0

Destination Network or Subnet = 128.171. 0.0No match!

RowDestinationNetwork or

SubnetMask (/Prefix)* Metric

(Cost)

Next-Hop

RouterInterface

1 128.171.0.0 255.255.0.0 (/16) 47 G2

2 172.30.33.0 255.255.255.0 (/24) 0 Local1

3 192.168.6.0 255.255.255.0 (/24) 12 G2

Page 41: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

Routing Table

RowDestinationNetwork or

SubnetMask (/Prefix)* Metric

(Cost)

Next-Hop

RouterInterface

1 128.171.0.0 255.255.0.0 (/16) 47 G2

2 172.30.33.0 255.255.255.0 (/24) 0 Local1

3 192.168.6.0 255.255.255.0 (/24) 12 G2

Row 1If Destination IP Address = 172. 30. 33.6

Mask = 255.255.255.0Result = 172. 30. 33.0

Destination Network or Subnet = 172. 30. 33.0This row is a match!

Page 42: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

Routing Table

RowDestinationNetwork or

SubnetMask (/Prefix)* Metric

(Cost)

Next-Hop

RouterInterface

1 128.171.0.0 255.255.0.0 (/16) 47 G2

2 172.30.33.0 255.255.255.0 (/24) 0 Local1

3 192.168.6.0 255.255.255.0 (/24) 12 G2

Row 3If Destination IP Address = 172. 30. 33.6

Mask = Result =

Destination Network or Subnet = Is this row is a match?

Page 43: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

Routing• For Each Incoming IP Packet

—Destination IP address is matched against every row in the routing table.

—If the routing table has 10,000 rows, 10,000 comparisons will be made for each packet.

—There can be multiple matching rows for a destination IP address, corresponding to multiple alternative routes.

—After all matches are found, the best match must be selected.

Page 44: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

only one row matches

• If only one row matches, it will be selected as the best row match.—Destination IP address = 192.168.6.7

RowDestinationNetwork or

SubnetMask (/Prefix)* Metric

(Cost)

Next-Hop

RouterInterface

3 192.168.0.0 255.255.0.0 (/16) 12 G2

Page 45: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

Default Route

• The default row always matches—Mask 0.0.0.0 applied to anything results in 0.0.0.0.—This always matches the Network/Subnet value

0.0.0.0.—The router specified for this row (H) is the default

router.

RowDestinationNetwork or

SubnetMask (/Prefix)* Metric

(Cost)

Next-Hop

RouterInterface

15 0.0.0.0 0.0.0.0 (/0) 5 H3

Page 46: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

Multiple Matches - 1

• If there are multiple matches, the row with the longest length of match is selected—This is Row 7 for 128.171.17.56 (24 bit match)—Row 1’s length of match is only 16 bits—Longer matches often are routes to a

particular subnet within a network

RowDestinationNetwork or

SubnetMask (/Prefix)* Metric

(Cost)

Next-Hop

RouterInterface

1 128.171.0.0 255.255.0.0 (/16) 47 G2

7 127.171.17.0 255.255.255.0 (/24) 55 H3

Page 47: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

Multiple Matches - 2

• If there are multiple rows with the same lengths of match, the metric column compares alternative routes.—If the metric is cost, the smallest metric wins (20)—If the metric is speed, the largest metric wins (34)

RowDestinationNetwork or

SubnetMask (/Prefix)* Metric

(Cost)

Next-Hop

RouterInterface

5 172.29.8.0 255.255.255.0 (/24) 34 F1

8 172.29.8.0 255.255.255.0 (/24) 20 H3

Page 48: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

The Situation• The router first evaluated the IP destination

address of the arriving packet against all rows and noted the matching rows.

• The router then selected the best-match row.

• Now, the router examines the interface and next-hop router fields in the best-match row to determine what to do with the packet.

Page 49: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

Interface and Next-Hop RouterRouterForwardingPacket

PossibleNext-HopRouter

PossibleNext-HopRouterPossible

DestinationHost

Packet to Router Bon Interface 5Router A Router B

Router C

IP Subnet onInterface (Port 5)

Packet must be sent toa particular host orrouter on the subnetout a particularinterface (port).

Page 50: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

Interface and Next-Hop Router

• The Interface specifies the “out” port on the router.—A subnet is attached to this interface.

• NHR column specifies a specific NHR on that subnet.—For Row 5, send packet to NHR F on the

subnet out Interface 1.

RowDestinationNetwork or

SubnetMask (/Prefix)* Metric

(Cost)

Next-Hop

RouterInterface

5 172.29.8.0 255.255.255.0 (/24) 34 F1

Page 51: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

Next-Hop: Local

• If Next-Hop Router Field says Local, —Then the destination host in on the subnet

attached to the interface (1).—Instead of sending the packet to a next-hop

router on the subnet, the router will send the packet to its destination address.

RowDestinationNetwork or

SubnetMask (/Prefix)* Metric

(Cost)

Next-Hop

RouterInterface

2 172.30.33.0 255.255.255.0 (/24) 0 Local1

Page 52: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

IP Forwarding Process

Page 53: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

Address Resolution Protocol• RFC 826• To map network addresses to the

hardware addresses used by a data link protocol

• To translate IP addresses to Ethernet MAC addresses

• Use data-link broadcast• ARP Request, ARP Reply

Page 54: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.
Page 55: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

ARP AnnouncementGratuitous ARP

Page 56: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

ARP Spoofing (ARP Poisoning)• Send fake, or 'spoofed', ARP messages to

an Ethernet LAN.• Generally, to associate the attacker's MAC

address with the IP address of another node (such as the default gateway).

• Passive sniffing, Man-in-the-middle attack, Denial-of-service attack

• http://www.oxid.it/downloads/apr-intro.swf

Page 57: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

C:\>arp -aInterface: 10.10.34.169 --- 0x2 Internet Address Physical Address Type 10.10.34.231 00-12-cf-28-cd-20 dynamic 10.10.34.234 00-12-cf-29-c6-80 dynamic 10.10.34.235 00-12-cf-28-1e-20 dynamic 10.10.34.254 00-08-e3-dd-b3-1f dynamic

arp -aarp -d 10.10.34.235arp -d *arp –s 157.55.85.212 00-aa-00-62-c6-09

C:\>arp -s 10.10.34.235 00-12-cf-28-1e-20

C:\>arp –a

Interface: 10.10.34.169 --- 0x2 Internet Address Physical Address Type 10.10.34.235 00-12-cf-28-1e-20 static 10.10.34.254 00-08-e3-dd-b3-1f dynamic

ARP Cache Default cache time-outs: Two-minute (unused entries)

Ten-minute (used entries)

Page 58: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

ICMP• Internet Control Message Protocol (RFC

792)• Transfer of (control) messages from

routers and hosts to hosts• Feedback about problems

—e.g. time to live expired• Encapsulated in IP datagram

—Not reliable

Page 59: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

ICMP Message Formats

Page 60: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

ICMP TypeEcho Request / Echo ReplyDestination UnreachableSource QuenchRedirectTime ExceededParameter ProblemTimestamp Request / Timestamp ReplyAddress Mask Request / Address Mask Reply

8 / 0345

1112

13 / 1417 / 18

Page 61: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

Ping• Most basic tool for internet management

• Based on ICMP ECHO_REQUEST message

• Available on all TCP/IP stacks

• Useful for measuring • Connectivity

• Packet Loss

• Round Trip Time

• Can do auto-discovery of TCP/IP equipped stations on single segment

Page 62: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

pingUsage: ping [-t] [-a] [-n count] [-l size] [-f] [-i TTL] [-v TOS] [-r count] [-s count] [[-j host-list] | [-k host-list]] [-w timeout] destination-list

Options: -t Ping the specified host until stopped. To see statistics and continue - type Control-Break; To stop - type Control-C. -a Resolve addresses to hostnames. -n count Number of echo requests to send. -l size Send buffer size. -f Set Don't Fragment flag in packet. -i TTL Time To Live. -v TOS Type Of Service. -r count Record route for count hops. -s count Timestamp for count hops. -j host-list Loose source route along host-list. -k host-list Strict source route along host-list. -w timeout Timeout in milliseconds to wait for each reply.

Page 63: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

ExampleC:\>ping -n 10 -l 256 www.im.ncnu.edu.tw

Pinging euler.im.ncnu.edu.tw [163.22.20.16] with 256 bytes of data:

Reply from 163.22.20.16: bytes=256 time=1ms TTL=253Reply from 163.22.20.16: bytes=256 time=1ms TTL=253Reply from 163.22.20.16: bytes=256 time=1ms TTL=253Reply from 163.22.20.16: bytes=256 time=1ms TTL=253Reply from 163.22.20.16: bytes=256 time=1ms TTL=253Reply from 163.22.20.16: bytes=256 time=1ms TTL=253Reply from 163.22.20.16: bytes=256 time=1ms TTL=253Reply from 163.22.20.16: bytes=256 time=1ms TTL=253Reply from 163.22.20.16: bytes=256 time=1ms TTL=253Reply from 163.22.20.16: bytes=256 time=1ms TTL=253

Ping statistics for 163.22.20.16: Packets: Sent = 10, Received = 10, Lost = 0 (0% loss0% loss),Approximate round trip timesround trip times in milli-seconds: Minimum = 1ms, Maximum = 1ms, Average = 1ms

Page 64: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.
Page 65: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.
Page 66: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

DHCP(Dynamic Host Configuration Protocol)

DHCP allows IP addresses to be allocated on a temporary basis (a lease).

When the lease for an IP address expires, the address can be reused by a different node.

This is useful in environments supporting mobile users who connect to the network with a laptop from many different places.

This helps alleviate the problem of limited IP addresses and simplifies TCP/IP client configurations.

Page 67: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

動態主機組態協定 (DHCP)

• Dynamic Host Configuration Protocol • 自動設定電腦的

— IP 位址 (163.22.20.223)— 子網路遮罩 (255.255.255.0)— 預設通訊閘 (163.22.20.254)— 領域名稱伺服器 (163.22.2.1)—…

• winipcfg (Win 98/Me)• ipconfig /all (Win 2000/XP)

Page 68: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

12

3

控制台 網路和網際網路連線

Page 69: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.
Page 70: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

ipconfigipconfigipconfig /allipconfig /releaseipconfig /renew

C:\>ipconfig

Windows IP Configuration

Ethernet adapter 區域連線 :

Connection-specific DNS Suffix . : ncnu.edu.tw IP Address. . . . . . . . . . . . : 10.10.34.169 Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : 10.10.34.254

Page 71: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.
Page 72: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.
Page 73: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

領域名稱系統 (DNS)

• 提供主機名稱與 IP 位址之轉換 www.im.ncnu.edu.tw 163.22.20.16• 由 DNS 伺服器提供• RR-DNS (Round Robin DNS)

—www.yahoo.com: (8 台伺服器 )—66.218.71.90, 66.218.71.80, 66.218.71.95, …

• DDNS (Dynamic DNS)—主機名稱 浮動 IP 位址

Page 74: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

ipconfig /displaydnsipconfig /flushdnsnslookup

C:\>nslookupDefault Server: academic.ncnu.edu.twAddress: 163.22.2.1

> www.cnn.comServer: academic.ncnu.edu.twAddress: 163.22.2.1

Non-authoritative answer:Name: www.cnn.comAddresses: 64.236.29.120, 64.236.91.21, 64.236.16.20, 64.236.16.52 64.236.16.84, 64.236.24.12, 64.236.24.20, 64.236.24.28

> 163.22.20.16Server: academic.ncnu.edu.twAddress: 163.22.2.1

Name: euler.im.ncnu.edu.twAddress: 163.22.20.16Aliases: 16.20.22.163.in-addr.arpa

>

Page 75: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

NCNUNCNUCampus Campus NetworkNetwork

DHCPServer

DNSServer

ProxyServers

TANet HiNet

Web Filter

(1)

www.abc.com

(2)

(3) (4)

(5)

SourceSwitch/RouterDHCP ServerDNS ServerProxy Server/FilterTANet / HiNet / ISPsDestination

全球資訊網(WWW)

Router

Switch

Page 76: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

電子郵件 (E-Mail)• 用戶端 Outlook / Outlook Express• SMTP 伺服器 – 送信

—無需密碼,用戶需在規定的網路內送信—Open Relay / Spam Mail

• POP 伺服器– 收信—需密碼,沒有限制網路

• 常見問題—用戶沒在規定的網路內送信—信箱爆滿 (Quota)

Page 77: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

NCNUNCNUCampus Campus NetworkNetwork

DHCPServer

DNSServer

SMTPServers

TANet HiNet

POPServer

pop.ntu.edu.tw

VirusScan

(1) (2)

(3)

(4)

(5)

(6)SenderSwitch/RouterDHCP ServerDNS ServerSMTP Server/Virus ScanPOP ServerTANet / ISPsReceiver

電子郵件 (E-Mail) – 送

Router

Switch

Page 78: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

NCNUNCNUCampus Campus NetworkNetwork

DHCPServer

DNSServer

SMTPServers

TANet HiNet

POPServer

smtp.ntu.edu.tw

VirusScan

(3) (4) (2)

(1)

(5)

SenderTANet / ISPsSwitch/RouterSMTP Server/Virus ScanPOP ServerReceiver*DHCP ServerDNS Server

Router

Switch

電子郵件 (E-Mail) – 收

Page 79: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

IPv6 - Version Number• IP v 1-3 defined and replaced• IP v4 - current version• IP v5 - streams protocol

—Connection oriented internet layer protocol• IP v6 - replacement for IP v4

—During development it was called IPng • Next Generation

Page 80: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

Why Change IP?• Address space exhaustion

—Two level addressing (network and host) wastes space

—Network addresses used even if not connected to Internet

—Growth of networks and the Internet—Extended use of TCP/IP—Single address per host

• Requirements for new types of service

Page 81: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

IPv6 RFCs• 1752 - Recommendations for the IP Next

Generation Protocol• 2460 - Overall specification• 3513 - addressing structure• others (find them)• www.rfc-editor.org• http://www.ietf.org/html.charters/ipv6-

charter.html

Page 82: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

IPv6 Enhancements (1)• Expanded address space

—128 bit• Improved option mechanism

—Separate optional headers between IPv6 header and transport layer header

—Most are not examined by intermediate routes• Improved speed and simplified router processing• Easier to extend options

• Address autoconfiguration—Dynamic assignment of addresses

Page 83: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

IPv6 Enhancements (2)• Increased addressing flexibility

—Anycast - delivered to one of a set of nodes—Improved scalability of multicast addresses

• Support for resource allocation—Replaces type of service—Labeling of packets to particular traffic flow—Allows special handling—e.g. real time video

Page 84: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

Figure 8.9IPv6 Header

Page 85: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

IPv6 Header Fields (1)• Version

—6• Traffic Class (DS/ECN)

—Classes or priorities of packet—Still under development—See RFC 2460

• Flow Label—Used by hosts requesting special handling

Page 86: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

IPv6 Header Fields (2)• Payload length

—Includes all extension headers plus user data• Next Header

—Identifies type of header• Extension or next layer up

— IPv4’s Protocol• Hop Limit

— IPv4’s TTL

Page 87: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

IPv6 Packet with Extension Headers

Page 88: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

Extension Headers• Hop-by-Hop Options

—Require processing at each router• Routing

—Similar to v4 source routing• Fragment• Authentication• Encapsulating security payload• Destination options

—For destination node

Page 89: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

IPv6 Addresses• 128 bits long• Assigned to interface• Single interface may have multiple unicast

addresses• Three types of address

Page 90: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

Types of IPv6 Addresses• Unicast

—Single interface• Anycast

—Set of interfaces (typically different nodes)—Delivered to any one interface—the “nearest”

• Multicast—Set of interfaces—Delivered to all interfaces identified

Page 91: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

Text Representation of IPv6 Addresses

• x:x:x:x:x:x:x:x• hexadecimal values of the eight 16-bit pieces

of the address.—FEDC:BA98:7654:3210:FEDC:BA98:7654:3210—1080:0:0:0:8:800:200C:417A

RFC 3513

Page 92: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

IPv6 Address Representation (2)• The use of "::" indicates multiple groups of 16-bits

of zeros. • Unicast address

—1080:0:0:0:8:800:200C:417A—1080::8:800:200C:417A

• Multicast address —FF01:0:0:0:0:0:0:101 FF01::101

• Loopback address—0:0:0:0:0:0:0:1 ::1

• unspecified addresses (Absence of address)—0:0:0:0:0:0:0:0 ::

Page 93: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

IPv6 Address Representation (3)• IPv4 and IPv6 mixed address

—x:x:x:x:x:x:d.d.d.d—x: IPv6, d: IPv4—Eg.

• 0:0:0:0:0:FFFF:129.144.52.38• ::13.1.68.3• ::FFFF:129.144.52.38

Page 94: Internet Protocols IPv4 (Internet Protocol) —IP Address —IP header —Subnetting —Routing ICMP (Internet Control Message Protocol) IPv6.

Address Type Identification

Address type Binary prefix IPv6 notation

Unspecified 00...0 (128 bits) ::/128

Loopback 00...1 (128 bits) ::1/128

Multicast 1111 1111 FF00::/8

Link-local unicast 1111 1110 10 FE80::/10

Site-local unicast 1111 1110 11 FEC0::/10

Global unicast (everything else)