Under the ARM embedded system, I will teach you step by step how to transplant pppoe dial-up client and use pppoe dial-up to access the Internet.

I. Overview

PPPoE (English: Point-to-Point Protocol Over Ethernet), point-to-point protocol on Ethernet, is a network tunnel protocol that encapsulates Point-to-Point Protocol (PPP) in the Ethernet framework. Since the PPP protocol is integrated into the protocol, it can realize authentication, encryption, compression and other functions that traditional Ethernet cannot provide. It can also be used for Ethernet protocols such as cable modem and digital subscriber line (DSL) to provide users with Access service protocol system.
Essentially, it is a protocol that allows the creation of point-to-point tunnels between two Ethernet interfaces in an Ethernet broadcast domain.
Taking pppd commonly used in Linux systems as an example, it supports IP, IPv6 and IPX network layer protocols on the PPP interface.
It uses traditional PPP-based software to manage a connection that uses not a serial line but a directed packet network like Ethernet. This standard connection with login and password facilitates billing by the access provider. Furthermore, the other end of the connection only assigns an IP address when the PPPoE connection is established, thus allowing dynamic reuse of IP addresses.
PPPoE is developed by UUNET, Redback Networks and RouterWare. Published in RFC 2516 description. ( Source: Baidu Encyclopedia )
pppoe dial-up Internet access generally appears in home networks. After the operator connects the broadband to the home, they will configure the pppoe dial-up function on the optical modem, enter the account and password to log in, so that your computer When connecting to the network or other devices, you don’t need to dial up to access the Internet. This is because the optical modem has a dial-up function, and the current optical modem has the function of a router. When connecting to the computer, the dhcp function will be used. Assign an IP address to access the Internet.

2. Transplantation process

The transplantation process mainly consists of the following parts: the kernel needs to support the PPPoE function, compile pppd, and compile pppoe.

1. Kernel configuration

This part is the kernel configuration, which requires the kernel to support pppoe:
use the make menuconfig command to configure the kernel. You can refer to the following configuration and select all options related to pppoe.
Insert image description here
Insert image description here
Insert image description here
After the configuration is complete, remember to recompile and reprogram the kernel into the device.

2. pppd tool compilation

Because cross-compilation is required, the ppp source code needs to be used, which can be downloaded online: https://download.samba.org/pub/ppp/
Insert image description here
The version I downloaded here is the ppp-2.4.1 version; unzip it after the download is complete. Enter the ppp-2.4.1 directory and execute:

./configure
make CC=arm-linux-gcc   // 交叉编译链替换成自己的

After the execution is completed, the pppd executable program will be generated in the pppd directory. Copy pppd to the /usr/sbin directory on the development board, remember to grant execution permissions. After transplanting the kernel and pppd, you can execute pppd on the board. Under normal circumstances, garbled characters will appear, which means the transplant was successful.

3. pppoe tool compilation

The compilation of pppoe is similar to pppd. The compilation steps will be explained in detail below. First of all, I also go online to download the rp-pppoe source code. I can’t log in to the official website address mentioned in the online article. I don’t know if it is still under maintenance. Here is another address for everyone, which may also be the official website: https ://src.fedoraproject.org/repo/pkgs/rp-pppoe/ You can download the source code file of the desired version on this website:
Insert image description here
unzip it after downloading. I downloaded version 3.8, enter rp-pppoe-3.8 /src directory execution:

./configure

After configuration, you need to manually modify the compilation chain in the Makefile file, because configuring the cross-compilation chain in the configure file does not take effect. Change the gcc and ar in the file to your corresponding compilation chain. Remember to modify the Makefile in the libevent directory as well.
After modification, you can compile. After executing make, pppoe-relay, pppoe-server, pppoe-sniff, and pppoe executable programs will be generated. Copy these programs together to the /usr/sbin directory of the development board.
There are also some configuration files copied together. In the scripts directory, copy pppoe-init, pppoe-stop, pppoe-start, pppoe-setup, pppoe-status, and pppoe-connect to the development board's /usr/sbin directory.
Create a new ppp folder in the etc directory of the development board file system, and then copy all the files in the configs folder under the rp-pppoe folder to the newly created ppp.

3. Configure pppoe parameters

After all the tools are copied to the development board, execute pppoe-setup to start configuration:

The first thing that needs to be configured is the account name assigned on the pppoe server, fill it in according to the actual assigned one.
Insert image description here

The second configuration is the network card name, fill it in according to your actual network card name.
Insert image description here

The third is to configure the link to appear on demand, just enter no.
Insert image description here

The fourth is to configure dns. What I filled in here is 114.114.114.114. If you are not sure, you can also fill in server.
Insert image description here

The fifth configuration password:
Insert image description here

The sixth is to configure the firewall, 0 means not to enable the firewall.
Insert image description here

Finally, enter y to save it to the configuration file. The configuration work ends here. You will be prompted to use the pppoe-start command to make a dial-up connection.

4. Create node information

When executing pppoe-start, you need to confirm whether there is a /dev/pts node directory. If not, you need to create it manually.
Enter pts and create nodes mknod 0 c 136 0; mknod 1 c 136 1. What does 136 represent? I looked it up and finally found this in the linux kernel documentation:
Insert image description here

5. pppoe server setup

If you want to test whether the device environment built above can work properly, you need to build a test environment: pppoe server.
I will introduce this work in another article, so stay tuned!

Guess you like

Origin blog.csdn.net/weixin_37926485/article/details/130853993