How to use the Pcap interface to contract from the data link layer?

Source: Internet
Author: User
Note that this is the 1.0 series of tcpcopy.

First, please understand the 1.0 series architecture related content:http://blog.csdn.net/wangbin579/article/details/8949315
http://blog.csdn.net/wangbin579/article/details/8950282


having understood the rationale, let's explain how to use the Pcap interface to send request packets


in the online system, the following methods are used to compile tcpcopy
./configure--pcap-send
The representative uses the PCAP mechanism to contract, also is avoids the IP layer, from the data Link layer contract;



tcpcopy Run command: sudo./tcpcopy-x online port number @ Online machine exit card address-test machine IP Address: Test machine port @ Next hop network card address-s run intercept machine IP address-o export NIC device-I Grab Packet network card equipment
Example:
sudo./tcpcopy-x 80@00:13:21:b2:5e:42-122.55.176.148:18080@00:0f:1f:03:f2:e6-s 10.110.12.162-o eth1-i eth0
This means that the Tcpcopy capture online 80-port application request to the 122.55.176.148 machine's 18080 port.

Specifically, from the network card device number eth0 above the request packet, from the 00:13:21:B2:5E:42 network card address (the corresponding network card device number for eth1) sent out, the purpose of the requested packet was replicated network card address for 00:0f:1f:03:f2:e6 (because it is the same network segment, The next hop MAC address is the MAC address of the test machine, and intercept runs on the 10.110.12.162 machine to capture the routed response packets.

Note: 1 The online machine's export network card address must not only match the export network card number of-O, and it is best to test the machine's IP address needs of the network card address to match


2 in the case of the same network segment, the purpose of the test machine the network card address is best to match the IP address of the test machine; under different network segments, the destination MAC address is the next hop address (can be obtained by tcpdump means to get the next hop MAC address, if the grab package file is not shown, Can only be obtained by other means.


3 The purpose of setting up the network card address is to solve the routing problem of the packet, because send the packet from the data link layer, no longer enjoy the routing function provided by the IP layer, but make the explicit


4 The comments section is for the 0.9 series comment, not the 1.0 series


5 This document update time is 2014.8.25









Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.