CN100403725C - 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
- CN100403725C CN100403725C CNB021467595A CN02146759A CN100403725C CN 100403725 C CN100403725 C CN 100403725C CN B021467595 A CNB021467595 A CN B021467595A CN 02146759 A CN02146759 A CN 02146759A CN 100403725 C CN100403725 C CN 100403725C
- Authority
- CN
- China
- Prior art keywords
- address
- link layer
- syn
- given host
- layer information
- 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.)
- Expired - Fee Related
Links
Images
Abstract
The present invention discloses a method for obtaining information at link layers of specific hosts automatically. The method comprises the steps of recording an IP address of the specific host; a router constructing an SYN packet of TCP corresponding to each specific host and transmitting the SYN packets; if the link layer address of the specific host corresponding to the SYN packet is inexistent, the router transmits ARP requests comprising the IP address of the specific host, and the ARP requests are used for obtaining the link layer address; if the route successfully receives ARP response messages, the router can obtain the link layer information corresponding to the host with the specific IP address. The present invention makes uses of TCP/IP protocol stack mature techniques and can conveniently attain the purpose of automatic obtaining the link layer information of the specific hosts. The present invention realizes transmitting the ARP request messages by triggering the router for many times via making use of an SOCKET retransmission mechanism so as to obtain the link layer information, and the present invention can realize multiple triggering and does not need to increase the complexity of 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,, this SYN comprises the IP address of described given host, does not comprise the link layer address of described given host;
Utilize described IP address to send described SYN bag to described main frame, described SYN bag triggers the ARP request that sends
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.
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:
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, SYN (synchronization request) bag of a TCP of router configuration.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 bag is actual only need to comprise the TCP stem, and wherein the SYN sign is changed to 1.
Table 1 TCP stem and SYN bag
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 bag 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 wraps (TCP stem, SYN is masked as 1) |
Table 2 comprises the Frame of SYN bag
7) after main frame receives the SYN bag, because this SYN bag is an invalid packet, so main frame can not done any processing to it.
8) if the SYN bag sends failure, router also can resend this SYN bag 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 bag 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 (9)
1. a 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 SYN (synchronization request) bag that triggers the TCP (transmission control protocol) that sends the ARP request, this SYN comprises the IP address of described given host, does not comprise the link layer address of described given host;
Utilize described IP address to send described SYN bag to described main frame, described SYN bag triggers the ARP request that sends;
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 described transmission SYN bag comprises calls the SOCKET interface.
3. a kind of method of obtaining the given host link layer information automatically according to claim 1 and 2 is characterized in that, 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.
4. a kind of method of obtaining the given host link layer information automatically according to claim 1 and 2 is characterized in that, the IP address of described record given host is specially: by the IP address of the described given host of chain table record.
5. a kind of method of obtaining the given host link layer information automatically according to claim 1 and 2, it is characterized in that, also comprise step, according to the link layer information of described given host described SYN is sealed and to be contained in the Frame, the destination address of described link layer is the link layer address of described given host.
6. a kind of method of obtaining the given host link layer information automatically according to claim 5, it is characterized in that, also comprise step: described given host receives described SYN bag, described SYN bag is not done any processing, this is because the described SYN bag of structure is exactly invalid, only is used to excite ARP.
7. a kind of method of obtaining the given host link layer information automatically according to claim 5 is characterized in that, the form of the SYN bag of the TCP of described structure is as follows:
Wherein, described SYN bag only comprises the TCP stem, and the 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.
8. a kind of method of obtaining the given host link layer information automatically according to claim 7 is characterized in that, described Frame through encapsulation is following form:
Wherein, the destination address of link layer stem is the destination address of described link layer, and source address is the link layer address of router outgoing interface; The destination address of IP stem is the IP address of specifying main frame, and source address is the IP address of router outgoing interface; SYN bag expression TCP stem, SYN is masked as 1.
9. a kind of method of obtaining the given host link layer information automatically according to claim 1, it is characterized in that, also comprise step, if successfully do not receive described arp reply message, described router resends described SYN bag 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 CN1499791A (en) | 2004-05-26 |
CN100403725C true 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) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102546849B (en) | 2010-12-30 | 2014-10-08 | 华为技术有限公司 | Detection method for IP (Internet Protocol) address conflict and network equipment |
CN105940658B (en) * | 2015-01-04 | 2019-04-26 | 华为技术有限公司 | A kind of transmission method of user data, device and terminal |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6049825A (en) * | 1997-03-19 | 2000-04-11 | Fujitsu Limited | Method and system for switching between duplicated network interface adapters for host computer communications |
US6128294A (en) * | 1996-04-05 | 2000-10-03 | Hitachi, Ltd. | Network connecting apparatus |
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
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6128294A (en) * | 1996-04-05 | 2000-10-03 | Hitachi, Ltd. | Network connecting apparatus |
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 |
Non-Patent Citations (2)
Title |
---|
TCP/IP详解卷1:协议. (美)W.Richard Stevens著,范建华等译,第38-39页、图4-2,机械工业出版社. 2000 |
TCP/IP详解卷1:协议. (美)W.Richard Stevens著,范建华等译,第38-39页、图4-2,机械工业出版社. 2000 * |
Also Published As
Publication number | Publication date |
---|---|
CN1499791A (en) | 2004-05-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7965674B2 (en) | Sub-segment based transport layer protocol for wireless medium | |
CN108270682A (en) | A kind of message transmitting method, terminal, the network equipment and communication system | |
CN104025525B (en) | For sending the method and apparatus and exchange apparatus of packet | |
KR100765121B1 (en) | Polling method of Protocol Data Unit of transmission buffer | |
CN1983911B (en) | Method and system for faster detection and retransmission of lost tcp segments | |
CN102377650B (en) | Data transmission processing method, device and system | |
CN102217258B (en) | Detection processing method, data sending terminal, data receiver and communication system | |
RU2451406C2 (en) | Method for performing polling procedure in wireless communication system | |
CN101945341B (en) | Point-to-point transmission protocol of wireless sensor network | |
EP1002408B1 (en) | Communication method and system | |
CN108023683A (en) | A kind of method, apparatus, chip and terminal for sending message | |
CN101933280A (en) | Be used to send the mobile communication system and the method for PDCP status report | |
CN112436994B (en) | Data transmission method and electronic equipment | |
WO2018201498A1 (en) | Data receiving state reporting method and apparatus | |
WO2015196393A1 (en) | Data transmission method and device | |
CN102365834A (en) | Method of receiving a point-to-multipoint service in a wireless communication system | |
US10701189B2 (en) | Data transmission method and apparatus | |
CN101621832B (en) | Method for transmitting PDCP data unit to upper layer | |
WO2020147453A1 (en) | Data transmission method and related apparatus | |
CN101283555A (en) | Method for transmitting messages using proper communication protocol | |
CN104618007B (en) | A kind of synchronous satellite Transmission Control Protocol segmentation connection optimization method | |
JP2008153778A (en) | Packet transfer apparatus | |
CN102769520B (en) | Wireless network congestion control method based on stream control transmission protocol (SCTP) | |
CN104184646A (en) | VPN data interaction method and system and VPN data interaction device | |
CN104852988A (en) | A message forwarding method and device |
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 |