Four. DHCP Protocol
1. How to obtain an IP address
(1) static configuration: hard-coded
• Manually configure the IP address, subnet mask, default gateway
• Manually configure DNS server names and IP addresses
(2) dynamic configuration: Dynamic Host Configuration Protocol (DHCP)
• Dynamically get parameters from the server, Plug and Play
• Allow address reuse, renew at address
• Support for mobile users to join the network
2. DHCP Protocol
(1) host broadcast DHCP discover(Discovery message)
(2) The DHCP server responds with a DHCPoffer (providing a message)
(3) host request IP address:DHCPrequest(requesting message)
(4) DHCP server assigned IP Address:DHCP ack(acknowledgement message)
(5) Example of working process
(6) Implementation in the application layer
• Request packets encapsulated in a UDP Packet
· IP Broadcast - link layer broadcasts (e.g. Ethernet)
· DHCP Server Construction ACK messages: including those assigned to customers IP address, subnet mask, default gateway, DNS Server Address
Five. NAT
1. Network Address translation Scenario
2. Motivation
(1) only one IP address can be requested from the ISP (IPv4 Address exhaustion)
(2) Change of IP address oflocal network device , no need to advertise outside network
(3) No need to modify the internal network device IP address when changing ISP
(4) Internal network equipment is not visible to the outside network, that is, not directly addressed, to ensure security
3. implementation (16-bit port number field can support 60000+ Parallel connection at the same time)
(1) replace: replace the source IP address and source port number of the outgoing IP datagram with the NAT IP address and the new port number
(2) record: Store replacement information in a NAT translation Table
(3) Replace: replace the IP datagram into the intranet with the source IP address and the source port number According to the NAT conversion table
4. Disputes
(1) Routers should only handle third-tier functions
(2) in violation of the end-to-end communication principle, the application developer must take into account the existence of NAT (e.g. peer-to)
(3) address shortage problem should be solved by IPv6
5. Nat Penetration problem: The client cannot directly access the server using the intranet address,Nat is the only externally visible address
(1) statically configured NAT toforward connection requests for a specific port to the server
(2) automatic configuration with UPnP Internet Gateway Device Protocol
• Learn to NAT public IP address
• In the NAT translation table, delete and remove port mappings
(3) trunking (for example , Skype): clients inside / outside the NAT establish a connection with the relay server, relay server bridging two connected groupings
"Computer Network" chapter fourth Network layer (3)