IP addresses

advertisement
IP addresses. For any host, computer on a TCP/IP
network, a unique id (32 bits in IPv4) written as a
collection of 4 decimal numbers (dotted quad)
between 0 to 255.
Ex. IP address: 132.64.48.56. Every device must
have a unique IP address. All devices pertaining to a
common network must reflect a common network
portion of address that must be registered with the
Internet community provided by some Internet
Service Provider (ISP)
IP address class:
Class A: 0 + 7 network ID bits + 24 host ID bits
Class B: 10 + 14 network ID bits + 16 host ID bits
Class C: 110 + 21 network ID bits + 8 host ID bits
Class D: 1110 + 28 multicast address bits
Address formats:
network. local.local.local (for class A IDs)
network.network.network.local (for class C IDs)
IP address of a device  MAC address (physical ID)
MAC address is a permanently stamped address. IP
address is stored in a configuration file in the local
disk.
Subnets:
A single network may be split into a multiple
networks for internal use but appear as a single
network to outsider. This is the concept of subnets.
Subnet mask. An address such that when added to
network address (in bitwise-and) splits the address
into network + subnet + host address.
e.g. IP address: 12.11.10.9 subnet mask 255.254.0.0
Since the leading bit begins with 0, it’s a Class A
network with address 12.0.0.0
00001100 00001011 00001010 00001001 IP
+ 11111111 11111110 00000000 00000000 Subnet
___________________________________________
00001100 00001010 | 00000000 00000000
Network is extended by 7 more bits. Therefore, this is
subnet 10.
The remaining host part is 0.1.10.9 is the host
address.
IP and subnet masks are often presented together in
this format. e.g. Network address = 154.4.32.0 ,
subnet mask = 255.255.224.0. In this case, the
network address can be written as 154.4.32.0/19
indicating subnet has 19 bits for the network portion
of address, and has remaining 13 bits for host part.
Therefore, total number of subnets = 23 -2 = 6
Total numbe of hosts per subnet = 213  2  8190
Example. Address on a packet is 132.15.47.8. The
subnet mask is 255.255.252.0/22. If we AND the
two, we get the following:
Address: 132.15.0010 1111| 0000 1000
Subnet: 255.255.1111 1100| 0000 0000
Network: 132.15.00101100| 0000 0000
It’s on network 132.15.44.0, on the subnet 3 and it’s
for the host numbered 8.
Classless Interdomain Routing (CIDR)
Classfull addresses waste a lot of addresses. Ideally,
we could bunch similar network addresses together
and reduce ARP table considerably. Each
organization gets a number (variable) of subnets
specified by A / m where A is a 32-bit number
denoting the address space and m is a number
between 1 and 32. In this scheme, the organization
receives 2 m nets all sharing the first 32  m bits of
A.
Example. The network 142.31/16 corresponds to all
216 addresses in the range
[142.31.0.0, 142.31,255,255]
Another solution. IPv4 is replaced by IPv6 (RFC
1833). http://playground.sun.com/ipv6/INET-IPngPaper.html
Basic elements:
a. Expanded routing and addressing capability.
Instead of 32 bits address, 128 bits address.
b. Provides “anycast address” (a set of interfaces,
one of which (generally the nearest one) receives
packets sent to “anycast address” – for control
purpose)
c. Lower header cost
d. Improved support for options for more efficient
forwarding, more flexible option set, …
e. Added QoS/Real-time service capabilities
f. Support for authentication, data integrity, and
confidentiality.
g. IPv6 does away with network-layer fragmentation
and reassembly. End hosts are expected to perform
path-MTU (Maximum Transmission Unit, the packet
size). All IPv6 networks must handle an MTU of at
least 1280 bytes.
CIDR Lookups: Longest Prefix Match (LPM)
Example of a LPM to compress a router table.
‘000’
‘001’
‘010’
‘011’
‘100’
‘101’
‘110’
‘111’
A
A
A
B
A
B
B
B
00*
010
011
100
101
11*
A
A
B
A
B
B
0*
011
100
1*
A
B
A
B
We can compress a router table by using ranges
instead of distinct network addresses.
Router needs to implement a prefix match to check if
the address being looked up falls in the range A / m
for each entry in its forwarding table.
e.g. Consider the IPv4 routing table below.
148.13.0.0/16
148.13.20.16/28
……
……
Router needs to lookup for an address 148.13.20.19,
and both entries in routing table match. Both entries
contain the looked up address. In such cases, the
longest prefix of the candidate routes is
148.13.20.16/28, since its subnet mask /28 is higher
than other entry’s mask /16 making the route more
specific.
Some distinct networks:
a. 127.0.0.0 is used for loop-back address
(typically in the form of 127.0.0.1)
b. When host address is either all 0s (4.2BSD) or
all 1s (Unix OS standard), it’s considered a
broadcast message.
c. For mobile objects, two addresses: Home
address (permanent), and a care-of address. Used
only for forwarding IP datagrams and admin
functions. Higher layers never use them.
d. Care-of addresses two types: Foreign agent
address, and Co-located care of address where
mails are sent directly to the device on a foreign
net.
Network Address Translation (NAT)
IP addresses are scarce. One solution: Dynamic
allocation of addresses by ISPs when its clientsystem is online, take it away when not online and
reassign it to another caller.
Doesn’t work for systems which are mostly online
such as business computers. Also, home users with
ADSL connectivity providing Internet over cable.
Modem
Broadband
cable
Computer
Router
Computer
Computer
With a permanent IP
address here!
So, how do we handle this when not enough
addresses are in store?
Solution. A quick-fix short-term solution, NAT (RFC
3022).
1. Each company receives an IP ( or a few) address
for Internet traffic.
2. Inside, they are allowed to use private IPs within
these ranges:
10.0.0.0 – 10.255.255.255/8 (16,777, 216 hosts)
172.16.0.0 – 172.31. 255.255/12 (1,048,576 hosts)
192.168.0.0 – 192.168.255.255/16 (65,536 hosts)
3. An outgoing traffic would remove the local IP
address and insert the assigned address instead.
10.0.10.25
138.67.42.12
Packet
NATBox/Fir
ewall
4. Since both TCP/UDP end-to-end connections
contain the source port & destination port
specifications, sender after specifying the source
port indicates where to receive incoming packets
belonging to this connection. At the same time,
it tells which port to dump it on the receiver
side.
TCP/IP includes a protocol suit ARP (Address
Resolution Protocol) to map IP addresses to physical
addresses by network administrators. The constructed
table is called ARP cache.
ARP centers about the address dichotomy (IP
address, MAC or device address). Example. Consider
the following:
A1
A2
A3
A4
A5
A6
R3
R1
E1
R2
E3
E2
Two networks. Served by two routers R1 and R2, and
a router R3. A1 wants to send a packet to A3. A3 is
known to A1 as a3@sunyit.edu . How is it handled?
1. A1 issues gethost(a3@sunyit.edu)
2. Local DNS (Domain Name System) server picks
up the logical address & returns its IPA3 to A1
3. A1 sends a broadcast on the net asking who
owns IPA3 . A3 will respond to it sending A1 its
machine address.
This protocol to find the mapping IP  M where
M is machine address is called ARP (Address
Resolution Protocol, RFC 826).
What if A1 wants to send to A6? Using ARP will
fail since A6 will not see the broadcast, and routers
don’t relay broadcasts. One solution: In the ARP
table, make an entry like (other_nets, R1) and send
all non-local packets to R1. This is proxy ARP.
From R1, the packet goes to R2, if it is on the
network indicated. Otherwise, it might go to other
router by default.
RARP = Reverse Address resolution Protocol permits
the inverse mapping from MAC to corresponding IP
address. Hosts such as diskless workstations only
know their MAC addresses when booted but not their
IP addresses. This must be obtained from an RARP
server source. (RFC 903 for details).
Download