程序代写 IP 10.0.0.1 – cscodehelp代写

IP/MAC Address Translation
Outline ARP
RARP DHCP NAT

Copyright By cscodehelp代写 加微信 cscodehelp

Address Translation Problem
• We need a means for mapping IP addresses into MAC (physical) addresses
– Destination host
– Next hop router
– We can then encapsulate (surpirse!) IP datagrams inside a frame with link level address
• Possible mapping techniques
– Encode physical address in host part of IP address
• Make physical address the same as the host portion of IP address
• Obviously not possible using IPv4 and Ethernet
– Build a table of IP/MAC pairs
• How is it maintained?

Address Resolution Protocol (ARP)
ARP is part of the TCP/IP specification
Enable each host to build table of IP to physical
address bindings
– Dynamic binding protocol – no static entries in table
– Allows new nodes to be easily added to broadcast network
Simple idea: broadcast request if an IP address not in table
– Supported by link level technology
– Determine host B’s physical address PB from it IP address IB
1. Host A broadcasts an ARP request containing IB to all hosts on LAN
2. Host B responds with an ARP reply containing the pair (IB ,PB )

ARP Packet format
Internet Protocol (IPv4) over Ethernet ARP packet
Octet offset
Hardware type (HTYPE)
Protocol type (PTYPE)
Hardware address length (HLEN)
Operation (OPER)
Sender hardware address (SHA) (first 2 bytes)
(next 2 bytes)
(last 2 bytes)
Sender protocol address (SPA) (first 2 bytes)
(last 2 bytes)
Target hardware address (THA) (first 2 bytes)
(next 2 bytes)
(last 2 bytes)
Target protocol address (TPA) (first 2 bytes)
(last 2 bytes)
Protocol address length (PLEN)

ARP Packet Format
• ARP Packet Details
– HardwareType: type of physical network (e.g., Ethernet)
– ProtocolType: type of higher layer protocol (e.g., IP)
– HLEN & PLEN: length of physical and protocol addresses
• Provides for flexibility to handle a variety of network technologies
– Operation: request or response
– Source/Target-Physical/Protocol addresses
– Table entries timeout in about 10 minutes (caching is important)
– Update table with source when you are the target
– Update table even if there is already an entry
– Do not refresh table entries upon reference
– IP addresses are assigned independently of a systems HW addresses

Gratuitous ARP
• Sending a message when none was normally required
– Usually to verify some problem (IP conflict) or to update some change in IP-MAC mapping
• Can lead to updates in the cache entries of other devices that receive this message
• Useful in Mobile IP (when hosts move networks)
• Can be subject to attacks

Determining an IP Address at Startup
• Howdoesamachinewithoutpermanentstorage determine its IP address?
– OS images with specific IP’s cannot be used on multiple machines
– Critical for network appliances or embedded systems
• Use the network to obtain an IP from a remote server
– System must use its physical address to to communicate
– Requests address from server which maintains table of IP’s
– System doesn’t know the server – sends broadcast request for address

Reverse Address Resolution Protocol
Primarily for diskless workstations to obtain IP address – Obsolete now
RARP operates much like ARP
– A requestor broadcasts is RARP request
– Servers respond by sending response directly to requestor
– Requestor keeps IP delivered by first responder
– Requestor keeps sending requests until it gets an IP
Clearly there is a need for redundant RARP servers for reliability
– Timeouts can be used to activate backup RARP servers
• Backup servers reply to a RARP request if they don’t hear the RARP response from the primary server after some time

Alternatives to RARP
• RARP has shortcomings
– Most are subtle and all deal with fact that RARP operates at link layer
• BOOTstrap Protocol (BOOTP) was developed as an alternative to RARP – moves process to network level
– Uses UDP/IP packets to carry messages
• Hosts are still identified by MAC address
– How can UDP running over IP be used by a computer to discover its IP address?
• Uses special case IP address 255.255.255.255 – limited broadcast – not forwarded by routers
• Forces IP to broadcast on LAN before host IP is known
• BOOTP server responds using limited broadcast
• Request transmission via random timeout to avoid synchronization

Dynamic Configuration
• BOOTP was designed for relatively static environment where each host has a permanent network connection
– Net manager creates a BOOTP config file with parameters for each host – file is typically stable for long periods
• Wireless networking enables environments much more dynamic
– BOOTP does not provide for dynamic address assignment
• Dynamic configuration is the primary method for IP address allocation used today
– Not only facilitates mobility but also efficient use of IPs

Dynamic Host Configuration Protocol
• DHCP extends BOOTP
– Still supports static allocation
– Supports automatic configuration where addresses are permanent but assigned by DHCP
– Supports temporary allocation
• Relies on existence of a DHCP server
– Repository for host configuration information
– Maintains a pool of available IP’s for use on demand
– Considerably reduces administration overhead
• Autoconfiguration of course depends on administrative policy
– Uses UDP to send messages
• Uses a relay agent to communicate with servers off LAN (same as BOOTP)
– Relay agent is statically configured with DHCP server address

DHCP – high level

DHCP State Diagram

DHCP Implementation
• State machine (6 states) which determines DHCP operation – Host boots into INITIALIZE state
• To contact the DHCP server(s) a client sends DHCPDISCOVER message to IP broadcast address and moves to SELECT state
– Unique header format with variable length options field
– UDP packet sent to well known BOOTP port 67
• Server(s) respond with DHCPOFFER message
– Client can receive 0 or more responses and responds to one
• Client moves to REQUEST state to negotiate IP lease with 1 server – Sends DHCPREQUEST message to server which responds with DHCPACK
• Client is then in BOUND (normal) state

DHCP Implementation contd.
• From BOUND, client can issue DHCPRELEASE and return to INITIALIZE state
– This is simply client deciding it no longer needs the IP
• When lease reaches 50% of lease expiration time, it issues DHCPREQUEST to extend lease of current IP with server and moves to RENEW state
– Receipt of DHCPACK moves client back to BOUND state
– Receipt of DHCPNACK moves client back to INITIALIZE state
• If no response is received by 87.5% of lease expiration time, the client resends the DHCPREQUEST and moves to REBIND state
– Receipt of DHCPACK moves client back to BOUND state
– Receipt of DHCPNACK or timeout moves client back to INITIALIZE state

DHCP Details
• Without relay agent, DHCP would not scale since it would require large number of servers (one per LAN)
• Addresses which are leased over a given period of time and must be updated
– This means that DHCP requests might have to be made multiple times by the same system (RENEW requests)
• DHCP does not interact with DNS
– Binding between IP assigned by DHCP and host name must be made independently
• Possible result 1: No host name given
• Possible result 2: Host is automatically assigned a preallocated domain name with its IP
• Possible results 3: Hosts are assigned permanent names
– Requires additional mechanisms which do not yet exist

Network Address Translation (NAT)
Little over 4 Billion IP Addresses
– Not enough IP Addresses to go around!
What happens if you are assigned less IP addresses than the number of hosts on the network?

• Replaces one IP address with another
Source IP 10.0.0.1
Dest IP 200.100.10.1
150.150.0.1 Source IP
200.100.10.1
Dest IP 200.100.10.1
150.150.0.1 19
200.100.10.1
200.100.10.1
150.150.0.1

• Replaces one IP address with another

NAT Types – Static NAT

NAT Types – Dynamic NAT

NAT Types – NAPT (Network & Port)

Common NAT (NAPT) Network and Port Address Translation

Network Address Translation
• UseoneIPaddressformultipledevices
• Devices IP addresses are only seen in local network
• External network (i.e., Internet) sees one IP for all
• thedevices
• Solves “too many devices” problem

• NAT Gateway translates internal addresses to external ones
• ExternalIPAddress+port=>InternalAddress+ Port
• Keeps NAT Translation Table Cache of mappings
• Uses cache to forward incoming packets
• Saves new entries for outgoing packets

161.12.16/24 R2

程序代写 CS代考 加微信: cscodehelp QQ: 2235208643 Email: kyit630461@163.com

Leave a Reply

Your email address will not be published. Required fields are marked *