CN1499791A - Method for obtaining information at link layer of specific host automatically - Google Patents
Method for obtaining information at link layer of specific host automatically Download PDFInfo
- Publication number
- CN1499791A CN1499791A CNA021467595A CN02146759A CN1499791A CN 1499791 A CN1499791 A CN 1499791A CN A021467595 A CNA021467595 A CN A021467595A CN 02146759 A CN02146759 A CN 02146759A CN 1499791 A CN1499791 A CN 1499791A
- Authority
- CN
- China
- Prior art keywords
- link layer
- address
- syn
- message
- host
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Landscapes
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
The method includes recording IP address of host; route constructs SYN packet in TCP for each pointed host, and sends the SYN packet; if address of pointed host corresponding to SYN packet in link layer is not existed, route sends out ARP request including IP address of pointed host in order to obtain address in link layer; if route receives reply message from ARP successfully, then information of link layer corresponding to pointed IP address of host can be obtained. Information at link layer of specific host can be obtained automatically by using mature technology of TCP/lP protocol stack. Retransmission mechanism of SOCKET is utilized to trigger route to send request message of ARP in multiple times to obtain information in link layer. Thus, multiple times of trigging can be realized without need of increasing complexity for state maintenance.
Description
Technical field
The present invention relates to a kind of data communication technology, be specifically related to a kind of by using the method for obtaining the given host link layer information automatically of TCP/IP technology.
Background technology
IP (Internet Protocol) route technology uses routing table to realize that the routing table list item comprises destination address to the forwarding of IP grouping, next jumping, and outgoing interface is transmitted sign etc.When IP grouping arrives, router adopt destination address the method for long coupling determine next jumping and the outgoing interface transmitted, send out grouping to next redirect then.
As shown in Figure 1, when router sends to the main frame that directly links to each other to the IP grouping by outgoing interface, need obtain the link layer information of this main frame, i.e. the link layer address of destination host.Obtaining of the link layer address of main frame is to realize by ARP (address resolution protocol) agreement.Router broadcast sends the ARP request message that comprises the IP address, and the main frame that receives this message can check whether the IP address that wherein comprises is identical with the IP address of this machine.If identical, it can send comprise link layer address the arp response message to router.Router receives this message, promptly can obtain the link layer address information of main frame.
Generally, router does not initiatively send the ARP request message, but event driven by some.When receiving the IP message of need transmitting as router, it can send the link layer address that ARP asks to obtain the opposite end, or the user uses PING (PING program) program, also can drive when the IP address of PING opposite end and send the ARP request message.
No matter adopt above-mentioned which kind of method that a defective is all arranged, obtaining of link layer information is not instant.In some cases, need in time obtain the router address of opposite end in the time of configuration router, adopt the way of PING can realize above-mentioned purpose, but when the host number of router connection is bigger, or manually can't intervene the time, this method then is impracticable.Transmit datagram and also can drive the ARP request that sends, but when in some tactful routes, needing to realize that forcing to transmit some is grouped into a certain main frame, the destination address and the host address of IP grouping this moment may be also inequality, even send the IP address that the ARP request message also can not comprise destination host like this, therefore also can't obtain the link layer information of main frame.
Summary of the invention
The purpose of this invention is to provide the method that a kind of router obtains the given host link layer information automatically.
According to content of the present invention, a kind of router obtains the method for given host link layer information automatically, and described router is connected with main frame, and this method may further comprise the steps:
Record given host IP address;
For each given host, the SYN of a TCP of router configuration bag, and call the SOCKET interface and send this SYN bag;
Do not exist if SYN wraps the link layer address of corresponding given host, router sends the ARP request, wherein comprises the IP address of this given host, is used to obtain link layer address;
If router successfully receives arp reply message, then can get access to assigned ip address of host link corresponding layer information.
Further, this method comprises that also the step router finally is encapsulated in the SYN message in the Frame according to the link layer information of this given host, and the destination address of its link layer is the link layer address of given host.
In addition, comprise that also the step main frame receives this SYN message, because this SYN message is an invalid packet, main frame is not done any processing to it.
Wherein, adopt the IP address of chain table record given host.
Wherein, the SYN of the TCP of described structure bag as following form: 0 15 16 31
Source port number | The destination slogan | |||||||
Serial number | ||||||||
Confirm number | ||||||||
The TCP head length | Keep | ?U ?R ?G | ?A ?C ?K | ?P ?S ?H | ?R ?S ?T | ?S ?Y ?N | ?F ?I ?N | Window size |
Verification and | Urgent pointer |
In addition, described Frame through encapsulation is following form:
Link layer stem (destination address is the link layer address of destination host, and source address is the link layer address of router outgoing interface) | IP stem (destination address is the IP address of destination host, and source address is the IP address of router outgoing interface) | SYN message (TCP stem, SYN is masked as 1) |
The present invention has utilized ICP/IP protocol stack mature technology, can reach the purpose of obtaining the given host link layer information automatically easily, and send the ARP request message owing to utilized the SOCKET retransmission mechanism to realize repeatedly triggering router, obtain link layer information, can realize repeatedly triggering and do not need to increase the complexity of state-maintenance.
Description of drawings
Fig. 1 is for describing the schematic diagram of existing router and main frame annexation;
Fig. 2 is for describing the schematic diagram of the IP address of using chain table record destination host among the present invention;
Fig. 3 is for describing the schematic diagram of SOCKET retransmission mechanism exponential backspace among the present invention.
Embodiment
For making those skilled in the art better understand the present invention, specifically describe the present invention below in conjunction with accompanying drawing.
In the application,, can obtain assigned ip address link corresponding layer information timely automatically, adopt following step in order to satisfy the needs of particular arrangement:
1) record need obtain the host IP address of link layer information: for specific configuration, when carrying out configuration order, router can write down the host IP address that need obtain link layer information, among the present invention, use the chained list of the IP address of chain table record destination host as shown in Figure 2 to preserve these IP address informations.
2) need obtain the main frame of link layer information for each, the SYN of a TCP of router configuration (synchronization request message) bag.The form of SYN bag is as shown in table 1 below.Because among the present invention, what mainly need is the arp reply information of main frame, to obtain link layer address, the SYN message is actual only need to comprise the TCP stem, and wherein the SYN sign is changed to 1.0????????????????????????????????????????????15?16???????????????????????????????????????31
Source port number | The destination slogan | |||||||
Serial number | ||||||||
Confirm number | ||||||||
The TCP head length | Keep | ?U ?R ?G | ?A ?C ?K | ?P ?S ?H | ?R ?S ?T | ?S ?Y ?N | ?F ?I ?N | Window size |
Verification and | Urgent pointer |
Table 1 TCP stem and SYN message
Wherein, 6 flag bits are arranged in the TCP stem.A plurality of in them can be set to 1 simultaneously.Their effect is as follows: URG urgent pointer (urgent pointer) is effective; The ACK acknowledged sequence number is effective; PSH recipient should give application layer with this message segment as early as possible; RST rebuilds connection; The synchronous sequence number of SYN is used for initiating a connection; FIN makes a start and finishes the transmission task.
3) router calls the SOCKET interface and sends this SYN bag, and the destination address of transmission is the IP address that need obtain the main frame of link layer information.
4) when sending this packet, do not exist,, wherein comprise the IP address of this destination host, be used to obtain link layer address so router can send the ARP request because this SYN wraps the link layer address of corresponding destination host.
5), then can get access to assigned ip address of host link corresponding layer information if router successfully receives arp reply information.
6) router finally is encapsulated in the SYN message in the Frame according to the link layer information of this destination host, and the destination address of its link layer is the link layer address of destination host.Through the Frame after the encapsulation is the form of table 2.
Link layer stem (destination address is the link layer address of destination host, and source address is the link layer address of router outgoing interface) | IP stem (destination address is the IP address of destination host, and source address is the IP address of router outgoing interface) | SYN message (TCP stem, SYN is masked as 1) |
Table 2 comprises the Frame of SYN message
7) after main frame receives the SYN message, because this SYN message is an invalid packet, so main frame can not done any processing to it.
8) if the SYN message sends failure, router also can resend this SYN message every the preceding paragraph time.Among the present invention, a key character that adopts SOCKET to send grouping is to retransmit automatically, it adopts the method for exponential backspace to realize retransmitting, be that each retransmit interval is 2 times of a preceding retransmit interval, as shown in Figure 3, after reaching the maximum retransmit interval, then retransmit interval remains unchanged, and sends message at interval according to maximum retransmit all the time.According to the realization of TCP/IP, this retransmission processes can reach more than 9 minutes.Can in long time, repeatedly trigger router like this and send the link layer information that ARP asks to obtain destination host.
In addition, we also can adopt direct structure IP message to send, or directly send the link layer information that ARP asks to obtain destination host, but the shortcoming of these modes is to send once request, if can not obtain link layer information then can not initiate the ARP request again.If want repeatedly to trigger, each list item in the then corresponding chained list that comprises host IP address must be safeguarded a retransmission timer, resends message again after timer triggers.The complexity of Wei Huing will inevitably increase greatly like this.
Therefore the advantage that adopts SOCKET to send the SYN message comprises two aspects:
1) makes full use of the SOCKET retransmission mechanism, realized the function of retransmission timer, can repeatedly trigger the ARP request message.
2) SOCKET has hidden the details that the bottom technology realizes, only need fill some simple information like this when sending message, and the mechanism of bottom is very easily with respect to using more.
Be understood that, owing to adopted the mature technology of the agreement of TCP/IP, and utilized the SOCKET retransmission mechanism to realize repeatedly triggering router transmission ARP request message and obtained link layer information, the present invention can well realize obtaining the purpose of given host link layer information.
The above only is a possible embodiments of the present invention, and is non-so promptly limit to interest field of the present invention, and the equivalence that all utilizations specification of the present invention and accompanying drawing content are done changes, and all reason is with being contained in the claim scope of the present invention.
Claims (10)
1, a kind of method of obtaining the given host link layer information automatically is characterized in that, may further comprise the steps:
The IP address of record given host;
For each given host, construct the message bag of a TCP (transmission control protocol);
Send described message bag, the destination address of transmission is the IP address that need obtain the described given host of link layer information; Because the route of destination address does not exist, send the ARP request so can trigger, wherein comprise the IP address of described given host, be used to obtain link layer address;
If successfully receive ARP (address resolution protocol) response message, therefrom extract assigned ip address of host link corresponding layer information;
If successfully do not receive arp reply message, determine unreachable to the assigned ip address of host at present.
2, a kind of method of obtaining the given host link layer information automatically according to claim 1 is characterized in that, the step of the message bag of a TCP of described structure (transmission control protocol) comprises a SYN of structure (sync packet) bag.
3, a kind of method of obtaining the given host link layer information automatically according to claim 2 is characterized in that, the step of described transmission SYN bag comprises calls the SOCKET interface.
According to claim 2 or 3 described a kind of methods of obtaining the given host link layer information automatically, it is characterized in that 4, the SYN bag of a TCP of described structure and/or described transmission ARP request and/or the described arp reply message that receives are finished by router.
5, according to claim 2 or 3 described a kind of methods of obtaining the given host link layer information automatically, it is characterized in that, also comprise step, carry out configuration order, need obtain the described host IP address of link layer information by router records; With the IP address of the main frame of the described link layer information that obtains by the chain table record.
6, according to claim 2 or 3 described a kind of methods of obtaining the given host link layer information automatically, it is characterized in that, also comprise step, link layer information according to described given host is encapsulated in described SYN message in the Frame, and the destination address of described link layer is the link layer address of described given host.
7, a kind of method of obtaining the given host link layer information automatically according to claim 6, it is characterized in that, also comprise step: main frame receives described SYN message, described SYN message is not done any processing, this is because the described SYN message of structure is exactly invalid, only is used to excite APR.
8, according to claim 2 or 3 described a kind of methods of obtaining the given host link layer information automatically, it is characterized in that the form of the SYN bag of the TCP of described structure is as follows: 0 15 16 31
Source port number The destination slogan
Serial number
Confirm number
The TCP head length Keep ?U ?R ?G ?A ?C ?K ?P ?S ?H ?R ?S ?T ?S ?Y ?N ?F ?I ?N Window size
Verification and Urgent pointer
Wherein, described SYN message only comprises the TCP stem, and SYN sign is changed to 1, and URG represents that urgent pointer (urgent pointer) is effective; ACK represents that acknowledged sequence number is effective; PSH represents that the recipient should give application layer with this message segment as early as possible; RST represents to rebuild and connects; SYN represents that synchronous sequence number is used for initiating a connection; FIN represents to make a start and finishes the transmission task.
9, a kind of method of obtaining the given host link layer information automatically according to claim 6 is characterized in that, described Frame through encapsulation is following form:
The link layer stem The IP stem The SYN message
Wherein, the destination address of link layer stem is the link layer address of destination host, and source address is the link layer address of router outgoing interface; The destination address of IP stem is the IP address of destination host, and source address is the IP address of router outgoing interface; The SYN message is represented the TCP stem, and SYN is masked as 1.
10, a kind of method of obtaining the given host link layer information automatically according to claim 2, it is characterized in that, also comprise step, if successfully do not receive described arp reply message, described router resends described SYN message behind the interval at the fixed time, if in predetermined number of retransmissions or success not yet after the time, alarm finishes operation.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CNB021467595A CN100403725C (en) | 2002-11-06 | 2002-11-06 | Method for obtaining information at link layer of specific host automatically |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CNB021467595A CN100403725C (en) | 2002-11-06 | 2002-11-06 | Method for obtaining information at link layer of specific host automatically |
Publications (2)
Publication Number | Publication Date |
---|---|
CN1499791A true CN1499791A (en) | 2004-05-26 |
CN100403725C CN100403725C (en) | 2008-07-16 |
Family
ID=34232880
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CNB021467595A Expired - Fee Related CN100403725C (en) | 2002-11-06 | 2002-11-06 | Method for obtaining information at link layer of specific host automatically |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN100403725C (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9166872B2 (en) | 2010-12-30 | 2015-10-20 | Huawei Technologies Co., Ltd. | Method and network device for detecting IP address conflict |
CN105940658A (en) * | 2015-01-04 | 2016-09-14 | 华为技术有限公司 | A user data transmission method, apparatus and terminal |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH09275418A (en) * | 1996-04-05 | 1997-10-21 | Hitachi Ltd | Network connector |
US6049825A (en) * | 1997-03-19 | 2000-04-11 | Fujitsu Limited | Method and system for switching between duplicated network interface adapters for host computer communications |
JP2002281056A (en) * | 2001-03-21 | 2002-09-27 | Toyo Commun Equip Co Ltd | Ethernet (registered trademark) switch |
-
2002
- 2002-11-06 CN CNB021467595A patent/CN100403725C/en not_active Expired - Fee Related
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9166872B2 (en) | 2010-12-30 | 2015-10-20 | Huawei Technologies Co., Ltd. | Method and network device for detecting IP address conflict |
CN105940658A (en) * | 2015-01-04 | 2016-09-14 | 华为技术有限公司 | A user data transmission method, apparatus and terminal |
CN105940658B (en) * | 2015-01-04 | 2019-04-26 | 华为技术有限公司 | A kind of transmission method of user data, device and terminal |
Also Published As
Publication number | Publication date |
---|---|
CN100403725C (en) | 2008-07-16 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7965674B2 (en) | Sub-segment based transport layer protocol for wireless medium | |
CA2442439C (en) | Packet transmission system and packet reception system | |
US8462633B2 (en) | Apparatus and method for moving a receive window in a radio access network | |
JP5523350B2 (en) | Method and apparatus for TCP flow control | |
KR100635012B1 (en) | Method for creating feedback message for ARQ in mobile communication system | |
US20120189023A1 (en) | Method and apparatus for transmitting header-compressed packet based on retransmission mechanism | |
EP1300991A1 (en) | A method for filtering redundant data packets | |
US20040006643A1 (en) | TCP proxy providing application layer modifications | |
CN101030842A (en) | Method and apparatus for rearranging data in mobile telecommunication system | |
CN1710880A (en) | Method and apparatus for discovering path maximum transmission unit (PMTU) | |
WO2010121467A1 (en) | Communication method and equipment of the header compression | |
KR101224334B1 (en) | Apparatus and method of harq assisted arq operation for high rate data transmission | |
WO2007062599A1 (en) | A data retransmission method, device and system | |
CN1933486A (en) | IP communication device and IP communication system therefor | |
JP2008153778A (en) | Packet transfer apparatus | |
CN114268991A (en) | Data transmission method and device, electronic equipment and storage medium | |
CN104852988A (en) | A message forwarding method and device | |
CN112511377B (en) | TCP network acceleration method based on ARQ and UDP protocols | |
CN1617525A (en) | Method for guaranteeing general route package channel transmission reliability | |
US20050100051A1 (en) | Apparatus and method for compressing a header of a packet | |
CN1499791A (en) | Method for obtaining information at link layer of specific host automatically | |
EP3672189A1 (en) | Data transmission method, device and system | |
US7738459B2 (en) | Method, system and apparatus for reliably transmitting packets of an unreliable protocol | |
KR102601348B1 (en) | Data transmission method, transmission device, data reception method and receiving device | |
US9628397B2 (en) | Communication device and related packet processing method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20080716 Termination date: 20151106 |
|
EXPY | Termination of patent right or utility model |