真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

嵌入式linux實(shí)現(xiàn)pppoe撥號上網(wǎng)-創(chuàng)新互聯(lián)

一.交叉編譯內(nèi)核

10年積累的成都網(wǎng)站建設(shè)、成都網(wǎng)站制作經(jīng)驗(yàn),可以快速應(yīng)對客戶對網(wǎng)站的新想法和需求。提供各種問題對應(yīng)的解決方案。讓選擇我們的客戶得到更好、更有力的網(wǎng)絡(luò)服務(wù)。我雖然不認(rèn)識你,你也不認(rèn)識我。但先網(wǎng)站設(shè)計(jì)后付款的網(wǎng)站建設(shè)流程,更有泰順免費(fèi)網(wǎng)站建設(shè)讓你可以放心的選擇與我們合作。

make menuconfig  -> Device Drivers -> Network device support  -> PPP (point-to-point protocol)  中,選中所有ppp選項(xiàng)。退出,保存配置,修改Makefile重新執(zhí)行make zImage. 將arch/mips/boot/下的zImage下載到開發(fā)板上重啟系統(tǒng)。

二.交叉編譯pppoe server

下載ppp-2.4.5.tar.gz 、rp-pppoe-3.10.tar.gz 在 /opt 目錄下。

tar -zxvf ppp-2.4.5.tar.gz
cd ppp-2.4.5

[root@root  ppp-2.4.5 ]# ./configure  CC=mipsel-linux-gcc AR=mipsel-linux-ar BANLIB=mipsel-linux-ranlib  --host=mipsel

-------------------------------------------------------------------------

Configuring for Linux

Creating Makefiles.

 Makefile <= linux/Makefile.top

 pppd/Makefile <= pppd/Makefile.linux

 pppstats/Makefile <= pppstats/Makefile.linux

 chat/Makefile <= chat/Makefile.linux

 pppdump/Makefile <= pppdump/Makefile.linux

 pppd/plugins/Makefile <= pppd/plugins/Makefile.linux

 pppd/plugins/rp-pppoe/Makefile <= pppd/plugins/rp-pppoe/Makefile.linux

 pppd/plugins/radius/Makefile <= pppd/plugins/radius/Makefile.linux

 pppd/plugins/pppoatm/Makefile <= pppd/plugins/pppoatm/Makefile.linux

 pppd/plugins/pppol2tp/Makefile <= pppd/plugins/pppol2tp/Makefile.linux

-------------------------------------------------------------------------

再直接 make CC=mipsel-linux-gcc

編譯成功后在pppd目錄下會生成pppd把這文件拷貝到usr/sbin目錄下。

cd /opt
tar -zxvf rp-pppoe-3.10.tar.gz
cd rp-pppoe-3.10/src

[root@root  src]# ./configure  CC=mipsel-linux-gcc AR=mipsel-linux-ar BANLIB=mipsel-linux-ranlib  --host=mipsel

-------------------------------------------------------------------------

checking whether the C compiler works... yes

checking for C compiler default output file name... a.out

checking for suffix of executables...

checking whether we are cross compiling... yes

checking for suffix of object files... o

checking whether we are using the GNU C compiler... yes

checking whether /opt/crosstool/mipsel-linux/bin/mipsel-linux-gcc accepts -g... yes

checking for /opt/crosstool/mipsel-linux/bin/mipsel-linux-gcc option to accept ISO C89... none needed

checking for mipsel-ranlib... no

checking for ranlib... ranlib

configure: WARNING: using cross tools not prefixed with host triplet

checking how to run the C preprocessor... /opt/crosstool/mipsel-linux/bin/mipsel-linux-gcc -E

checking for grep that handles long lines and -e... /bin/grep

checking for egrep... /bin/grep -E

checking for ANSI C header files... yes

checking for sys/wait.h that is POSIX.1 compatible... yes

checking for Linux 2.4 kernel-mode PPPoE support... cross-compiling, default:
no
checking packing order of bit fields... no defaults for cross-compiling

-------------------------------------------------------------------------

解決方法:進(jìn)入src下直接./configure,然后修改下面的makefile和libevent下的makefile,gcc為mipsel-linux-gcc

直接 make
編譯成功后configs目錄下是rp-pppoe所需的配置文件,把這些文件全部復(fù)制到目標(biāo)機(jī)的/etc/ppp目錄下(沒有就自己建一個)。

src目錄下會產(chǎn)生pppoe,pppoe-server,pppoe-sniff,pppoe-relay。把這些程序下載到目標(biāo)機(jī)/usr/sbin目錄下。

三.配置

1)rp-pppoe-3.10/configs目錄下是rp-pppoe所需的配置文件,把這些文件全部復(fù)制到目標(biāo)機(jī)的/etc/ppp目錄下(沒有就自己建一個)。
2)撥號相關(guān)的腳本程序共有6個,在rp-pppoe-3.10/scripts中。
pppoe-setup:配置程序,把輸入的帳號密碼等信息存入配置文件。
pppoe-start:撥號程序,連接網(wǎng)絡(luò)。
pppoe-stop:斷開。
pppoe-status:查看連接狀態(tài)。
pppoe-connect:連接網(wǎng)絡(luò),被pppoe-start所調(diào)用。
pppoe-init:初始化,被其他程序調(diào)用。
把這些腳本也放到/usr/sbin目錄下。

四.測試

./pppoe-setup (下面是一些說明供參考)

>> Enter your PPPoE user name: ——此處輸入撥號帳號的用戶名
>> Enter the Ethernet interface connected to the ADSL modem For Solaris, this is likely to be something like /dev/hme0. For Linux, it will be ethn, where n is a number. (default eth0): ——輸eth0(視情況而定)
>> Enter the demand value (default no): ——輸no
>> Enter the DNS information here: ——輸IP(eg:69.45.45.34)(視當(dāng)?shù)剡\(yùn)營商的DNS服務(wù)器IP而定)
>> Please enter your PPPoE password: ——輸網(wǎng)通用戶口令
>> Choose a type of firewall (0-2): ——輸0 (0為不要防火墻)
>> Accept these settings and adjust configuration files (y/n)? ——輸y

執(zhí)行pppoe-start后。如果這個時候就使用pppoe-start開始連接的話,很大情況下你會得到timeout的提示,那我們該怎么做呢?需要在dev目錄下創(chuàng)建一個pts的文件夾,進(jìn)入pts,創(chuàng)建節(jié)點(diǎn)mknod 0 c 136 0; mknod 1 c 136 1。每次鏈接都需要建立,蠻麻煩的吧,所以還是把這幾條指令寫進(jìn)啟動腳本吧。相信這樣的話,一般您都會得到一個connected!的提示,說明ADSL已撥號成功,可以ping 下baidu看通不。

五.修改腳本

為了方便不用pppoe-setup,自己寫一個腳本pppoe.sh為傳參形式,把參數(shù)寫入到指定的文件內(nèi) 例如:

[root@root scripts]# ./pppoe.sh pppoe-name  eth3  pppoe-passwd

#!/bin/sh

U="$1"
E="$2"
PWD1="$3"

PPPD="/usr/sbin/pppd"
CONFIG="/etc/ppp/pppoe.conf"

if [ ! -r "$CONFIG" ] ; then
  echo "Oh, dear, I don't see the file '$CONFIG' anywhere.  Please"
  echo "re-install the PPPoE client."
  exit 1
fi

# Must have pppd
if [ ! -x $PPPD ] ; then
  echo "Oops, I can't execute the program '$PPPD'.  You"
  echo "must install the PPP software suite, version 2.3.10 or later."
  exit 1
fi

sed -i "s/USER=.*/USER=$U/" $CONFIG
sed -i "s/ETH=.*/ETH=$E/" $CONFIG
sed -i "s/FIREWALL=.*/FIREWALL=NONE/" $CONFIG
sed -i "s/DNSTYPE=.*/DNSTYPE=SERVER/" $CONFIG
sed -i "s/PIDFILE=.*/PIDFILE=/var/run/pppoe-$E.pid/" $CONFIG
sed -i "s/DEMAND=.*/DEMAND=no/" $CONFIG
sed -i "s/DNS1=.*/DNS1=""/" $CONFIG
sed -i "s/DNS2=.*/DNS2=""/" $CONFIG
sed -i "s/PEERDNS=.*/PEERDNS=yes/" $CONFIG
cp $CONFIG $CONFIG-bak

if [ -r /etc/ppp/pap-secrets ] ; then
  cp /etc/ppp/pap-secrets /etc/ppp/pap-secrets-bak
else
  cp /dev/null /etc/ppp/pap-secrets-bak
fi
if [ -r /etc/ppp/chap-secrets ] ; then
  cp /etc/ppp/chap-secrets /etc/ppp/chap-secrets-bak
else
  cp /dev/null /etc/ppp/chap-secrets-bak
fi

egrep -v "^$U|^\"$U\"" /etc/ppp/pap-secrets-bak > /etc/ppp/pap-secrets
echo "\"$U\"  *    \"$PWD1\"" >> /etc/ppp/pap-secrets
egrep -v "^$U|^\"$U\"" /etc/ppp/chap-secrets-bak > /etc/ppp/chap-secrets
echo "\"$U\"  *    \"$PWD1\"" >> /etc/ppp/chap-secrets

[root@root scripts]#/usr/sbin/pppoe-connect /etc/ppp/pppoe.conf

Using interface ppp0

Connect: ppp0 <--> /dev/pts/13

Warning - secret file /etc/ppp/chap-secrets has world and/or group access

CHAP authentication succeeded: Access granted

CHAP authentication succeeded

local  IP address 192.168.2.2

remote IP address 192.168.2.1

primary  DNS address 8.8.8.8

secondary DNS address 4.4.4.4

[root@root scripts]#/usr/sbin/pppoe-status

pppoe-status: Link is up and running on interface ppp0

ppp0    Link encap:Point-to-Point Protocol

     inet addr:192.168.2.2  P-t-P:192.168.2.1  Mask:255.255.255.255

     UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1492  Metric:1

     RX packets:7 errors:0 dropped:0 overruns:0 frame:0

     TX packets:30 errors:0 dropped:0 overruns:0 carrier:0

     collisions:0 txqueuelen:3

     RX bytes:61 (61.0 B)  TX bytes:1447 (1.4 KiB)

[root@root scripts]#route -n

Kernel IP routing table

Destination  Gateway    Genmask     Flags Metric Ref  Use Iface

192.168.2.1  0.0.0.0    255.255.255.255 UH   0    0    0 ppp0

0.0.0.0     192.168.2.1 0.0.0.0     UG   0    0    0 ppp0

-----------------------------------------------------------------------

另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價比高”等特點(diǎn)與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。


網(wǎng)站標(biāo)題:嵌入式linux實(shí)現(xiàn)pppoe撥號上網(wǎng)-創(chuàng)新互聯(lián)
文章分享:http://weahome.cn/article/ecsdo.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部