Digression: Originally wanted to follow the internet level from the bottom up review these agreements, but today really have to break the case, DHCP has to say!
Host from one network to another network, then the structure of IP address will change, today's mainstream has the following several modification scenarios:
(a) Change of address:
The host changes its address when moving to a new network, where a DHCP protocol is needed to associate it with a new network, so if you do, you need to manually modify the commands that may be required as follows
1 sudo vim/etc/network/interface
For each modification, if you want the IP address generated after the modification to take effect, in most cases we need to restart the host
1 /etc/init.d/network restart
And to do so, the DNS tables must be updated so that other hosts on the internet can know their changes
(ii) two addresses:
The use of two addresses is a more feasible method, the host has the original address to become the attribution address , there is a temporary address called the transfer address , the former is permanent, so that it is permanently associated with the attribution network.
Each time when the host movement, the change is the temporary address is the transfer address, the following focus on this aspect of the content.
The attribution address and the referral address correspond to the attribution network and the Referral network , the bridge between the attribution network and the field network is the Internet, and the attribution network and the Internet need a attribution agent , the transfer network and the Internet connection need a Referral Agent , the so-called proxy is the router, but the function of the agent is done in the application layer, so two agents are more emphasis on the function as a host.
When the host is moved to a field network, the field network needs to dynamically assign an IP address to the host, and this IP address assignment is done by DHCP, (when the field host is acting as a foreign agent, the transfer address becomes the address of the same address, Hosts that use the same-address-forwarding addresses can move to any network without worrying about the availability of proxies.
Regarding the communication process with the remote host, the mobile host needs to undergo three processes: agent Discovery , registration and transfer of data :
1. Agent Discovery
# #移动主机在外地网络进行代理发现的基础条件是已知归属代理地址 # #
The process of agent discovery is mainly divided into two stages:
A. Agent Notices
Send an ICMP message (type value 16: User information Answer) the data in the message is the transfer address, only the foreign agent can use this field.
Code bit meaning:
0 need to be registered, no address is transferred
1 agent busy, do not accept registration now
2 Proxy acting as attribution agent
3 agent acts as a foreign agent
4 Proxy using the smallest package
5 proxies use generic route selection encapsulation
6 Agent Support Header compression
7 Reserved
B. Agent Inquiry
Sends an ICMP inquiry message that, when the mobile host has moved to a new network without receiving an agent notification, it can initiate a proxy query to let the agent know that it needs help.
2. Registration
After the mobile host is moved to the field network, and the foreign agent has been discovered, it must be registered. The four elements registered are as follows:
A. Mobile host must be proxied to a foreign host
B. The mobile host must register with its attribution agent, which is usually done by the foreign agent as the mobile host.
C. If the deadline is reached, then the mobile host must be re-registered
D. If the mobile host is back to the attribution network, it must be unregistered
During the registration process, registration requests and registration answers are required, and the information is encapsulated in the UDP protocol, and the agent processes the registration request and answers using the well known port 434, the mobile host uses any ephemeral port.
The content of the message needs to indicate the attribution address, the attribution proxy address, the forwarding address and the identification (used to match the request and the response)
3. Data transfer
The process of data transmission has already set up the mobile IP communication environment, the communication process is divided into roughly two kinds:
A. When the remote address sends the message to the mobile address, the source address is the address of the remote host itself, the destination address is the IP address of the mobile host, in short, it is considered that the mobile host in the attribution network. In essence, it's the attribution agent. Using ARP proxy technology to use the attribution physical address to receive the data frame grouping on the link layer and then forward the packet to the field network where the mobile host resides.
B. When sending information from a mobile host to a remote host, it is sent as normal, sending packets to the attribution address after the mobile host Shard, using the address of the remote host as the destination address.
(iii) With respect to the DHCP protocol:
In most cases, four kinds of information is necessary for a single host:
(1) IP address
(2) Subnet mask
(3) Gateway IP
(4) DNS IP
Also as IP address assignment/Feedback protocol has RARP and BOOTP, the difference is that the appearance of DHCP is more consistent with the above 4 necessary information dynamically allocated (unlike BOOTP, BOOTP for table Static) protocol.
DHCP clients and DHCP servers can be on the same network or in different networks, and when the client and server are on the same network, the following actions are performed:
(1) The DHCP server issues a passive open command on UDP port 67, waiting for a customer request.
(2) The client in the UDP68 port issued an active Open command, this message is naturally loaded into the header of the UDP message, and then using the IP address for encapsulation, where the IP address source IP is 0, the destination Address 1 (limited broadcast, only in the local network propagation)
(3) The server uses broadcast or Tan Bolai to respond to this customer, it uses UDP Source port 67 and destination Port 68, the process of reply here can use IP address pull, and do not need ARP resolution address.
When the DHCP client and the DHCP server are in different networks, the following actions are performed:
(1) The server side and the client do the same before, but because of the limited broadcast, no router will receive the IP datagram.
(2) Set up a host as a relay agent in the network, the relay agent knows the unicast IP address of the DHCP server, and then the DHCP server and relay Agent complete the communication at the application layer, and the relay agent transmits it to the DHCP client.
Through the format of the DHCP message, we can notice the error control of DHCP and the classification of the type carefully.
DHCP server assignment IP procedures are divided into two types: static and dynamic allocation
static Assignment : queries the permanent IP address corresponding to the DHCP client by accessing the table in the DHCP server
Dynamic allocation : Through the database to implement the IP address pool, when the request is received dynamically assigned an IP address, the length of time can be negotiated.
< see TCP/IP First volume > About Network Layer and protocol details---IP protocol (2)--Mobile IP and DHCP