Openwrt pppoe dialing-MAC address cloning

Source: Internet
Author: User

[Reprinted with the source: Qian guozheng's column http://blog.csdn.net/qianguozheng/article/details/38322705]

In implementing any large project, we will encounter various problems. Of course, if we perform sufficient tests, we will be much more convenient.


Preface


MAC address cloning is mainly used to solve the problem of binding a MAC address to a carrier.

Okay, let's go back to the topic. How can I clone this MAC address.

The LAN port in openwrt is used to clone MAC addresses, so the related settings for MAC address cloning also exist. What we need to do is move to pppoe.


However, the problem arises. After copying it, the MAC address of the WAN port is the MAC address set for programming, but it cannot be dial-up.


Analysis


First, we need to capture packets and analyze the connection process of pppoe.

The Connection established by pppoe is divided into two processes: 1. pppoe discovery process. 2. PPP link creation process.

However, during the establishment of the PPP link, the MAC address before the router (not the cloned MAC address) will appear, and then the cloned address will appear. The connection is repeated and the number cannot be dialed.

Later, by reading the source code of pppd, we found that

The dynamic link library of rp-pppoe.so realizes pppoe discovery process.

The pppd process establishes PPP links. During the LCP process, it is found that the write function is used to send data packets, and the MAC address is automatically filled in by the system. Here, we need to carefully study the socket establishment process, how to modify the MAC address of eth0 is not allowed in my current time. I can only take the discount method and modify the MAC address of eth0.


Summary


In this case, the problem is solved, but this is not the end point. Bugs need to be fixed in various situations, such as when the Mac is empty, when the system is restarted, and when the network is restarted.

In all these cases, we need to keep eth0.2 (the vlan I divide varies with different systems, and the three VLANs in my system are so complicated) consistent with the MAC address of eth0.


[Reprinted with the source: Qian guozheng's column http://blog.csdn.net/qianguozheng/article/details/38322705]

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.