免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1769 | 回复: 0
打印 上一主题 下一主题

arm-linux配置pppoe [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-01-10 15:23 |只看该作者 |倒序浏览

                1.1    pppoe概述
1.1.1什么是PPP
    PPP是点对点协议(Point to Point Protocol)的缩写。它是TCP/IP网络协议包的一个成员。PPP是TCP/IP的扩展,它增加了两个额外的功能组:它可以通过串行接口传输TCP/IP包; 它可以安全登录
当使用作为公共电话系统的部分的串行接口时,必须要注意确保所有通信的真实性。这个终端PPP集合了用户名字和密码安全。因此,一个路由器或者服务器通过 PPP接收到一个请求时,如果这个请求的来源是不安全的,这就需要授权。这个授权是PPP的一部分。因为它的通过串行接口路由TCP/IP包的能力和它的授权能力,ISP(Internet服务提供商)通常使用PPP来允许拨号用户连接到Internet。

1.1.2什么是PPPoE
    PPPoE的意思是通过以太网的点对点协议。PPP通常通过串行通信,例如拨号modem连接。很多DSL Internet服务提供商现在使用通过以太网的PPP协议,因为它的额外的登录和安全性的特性。PPPoE将这些功能带给不使用串行连接来连接他们的用户的ISP。串行的ISP已经在modem通讯中使用PPP。另一方面,DSL提供商使用Ethernet而不是串行通讯。因为这样,就需要PPPoE的额外的功能,允许他们通过使用用户登录来确保通讯的安全和测量每个用户的数据流量。
1.2    pppoe安装
1.2.1安装pppd
    * 首先准备pppd安装软件包ppp-2.4.1。
    * 在linux下将其解压,cd切换到ppp-2.4.1工作目录。
    * 运行命令:make
    * make命令运行,编译之后将产生名为pppd的文件。将pppd文件拷贝到ramdisk中/usr/sbin目录下。
1.2.2安装pppoe
    * 准备rp-pppoe-3.7软件包。
    * 在linux下将其解压,cd切换到rp-pppoe-3.7工作目录中。
    * 运行命令:make
    * make命令运行,编译之后将产生pppoe、pppoe-relay、pppoe-server和pppoe-sniff四个文件。然后拷贝这四个文件到ramdisk中的/usr/sbin中的目录下。
1.3    pppoe配置
    * 在PPPoE目录下,复制options、pap-secerts、pppoe.conf和pppoe.setup文件到ramdisk中的/etc/ppp/options、/etc/ppp/pap-secerts、/etc/ppp/pppoe.conf、/etc/ppp/pppoe.setup和/usr/sbin/pppoe-setup。
    * 在PPPoE目录下,复制Adsl-connect、Adsl-setup、Adsl-start、Adsl-stop文件到ramdisk中的/sbin目录下。
    * 在PPPoE目录下,复制ifcfg-eth0和ifcfg-eth1到ramdisk中的/etc/sysconfig/network-scripts目录下。
    * 在PPPoE目录下,复制libcrypt.so.1和libdl.so.2到ramdisk中的/usr/lib目录下。
    * 切换到ramdisk中的/dev目录下,运行下面命令生成ppp节点设备。
#mknod /dev/ppp c 108 0
#mknod /dev/ptmx c 5 2
#mkdir pts
#cd pts
#mknod 0 c 136 0
#mknod 2 c 136 2
#mknod 3 c 136 3
#mknod 4 c 136 4
#mknod 5 c 136 5
1.4    pppoe编译
    * 切换到arm-linux内核源码/usr/src/arm-linux-2.4.19/目录下。
运行命令make xconfig或make menuconfig,进行内核编译配置。

选择Network device support,然后在Network device support选项下继续选择以下选项:
  PPP (point-to-point protocol) support      
  •    PPP multilink support (EXPERIMENTAL)                       
       PPP support for async serial ports           
       PPP over Ethernet (EXPERIMENTAL)
    按Esc键,继续选择File systems,在File systems下选择以下选项:
  • /dev/pts file system for Unix98 PTYs
    按Esc键,继续选择Character device,在Character device下选择以下选项:
  • Unix98 PTY support
    最后保存退出
    运行命令
    #make clean
    #make dep
    #./mkbootp.sh
    将编译后的镜像烧写到arm目标上。
    1.5    pppoe拨号
    1.5.1测试pppoe是否安装成功

    通过超级终端运行arm目标板。
    切换到/usr/sbin中运行pppd,如果出现乱码,代表pppoe移植成功。

    1.5.2配置pppoe客户端
    在/usr/sbin目录下,运行pppoe-setup进行pppoe客户断的配置。

    # pppoe-setup

    #/usr/sbin/adsl-setup

    当出现
    >>> Enter your PPPoE user name :
    输入ADSL帐号的用户名

    当出现
    >>> 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 ,这是ADSL相连的网卡的名字

    当出现
    >>> Enter the demand value (default no):
    输入 no

    当出现
    >>> Enter the DNS information here:
    输入 server ,这表示使用ADSL拨号自动获得的DNS服务器IP地址
    如果不输入server,可以输入指定的DNS,如北京:202.106.0.20、202.106.47.151

    当出现
    >>> Please enter your PPPoE password:
    输入ADSL帐号的密码

    当出现
    >>> Choose a type of firewall (0-2):
    输入 0 ,不使用防火墙

    当出现
    >>> Accept these settings and adjust configuration files (y/n)?
    如果输入的信息正确,输入 y ,完成配置,否则,输入 n 重新输入。

    1.5.3启动adsl拨号
    当pppoe客户端配置完毕以后,可以启动adsl进行拨号了。
    运行命令:
    # sh /sbin/adsl-start &
    # ifconfig

    eth0      Link encap:Ethernet  HWaddr 00:13:72:27:88:CE
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:1310 errors:0 dropped:0 overruns:0 frame:1
              TX packets:326 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000
              RX bytes:0 (24.9 GiB)  TX bytes:0 (626.9 MiB)
              Interrupt:35
    ppp0      Link encap:Point-Point Protocol
              inet addr:61.48.76.114  P-t-P:24.24.24.24  Mask:255.255.255.255
              UP BROADCAST RUNNING NOARP MULTICAST  MTU:16436  Metric:1
              RX packets:54 errors:0 dropped:0 overruns:0 frame:0
              TX packets:57 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:3
              RX bytes:3990 (3.8 KiB)  TX bytes:7220 (5.7 KiB)
    出现上面中的信息,在输出中应该含有关于 ppp0 的一堆信息,其中还绑定了 IP 地址,说明已经从拨号中获得了IP地址。
    使用ping命令看是否成功。如果ping通,证明pppoe拨号成功。


    1.6    在PC中架设pppoe server(pppoe服务器)

    1.6.1安装pppoe软件包
    架设pppoe服务器,首先需要一台装有linux系统的PC机。在PC上安装pppd和rp-pppoe两个软件包。包名为rp-pppoe-3.3-7和ppp-2.4.1-3。然装完后查看是否安装成功。运行命令:

    [root@localhost sbin]# rpm -qa|grep ppp
    rp-pppoe-3.3-7
    ppp-2.4.1-3

    1.6.2配置pppoe服务器
    1.6.2.1              配置/etc/ppp/options
    第一步配置/etc/ppp/options文件,options文件内容如下:

    # Don't use the modem control lines.
    local
    # Specifies that pppd should use a UUCP-style lock on the serial device
    # to ensure exclusive access to the device.
    lock
    # Set the MRU [Maximum Receive Unit] value to  for negotiation. pppd
    # will ask the peer to send packets of no more than  bytes. The
    # minimum MRU value is 128. The default MRU value is 1500. A value of
    # 296 is recommended for slow links (40 bytes for TCP/IP header + 256
    # bytes of data).
    mru 1492
    # Set the MTU [Maximum Transmit Unit] value to . Unless the peer
    # requests a smaller value via MRU negotiation, pppd will request that
    # the kernel networking code send data packets of no more than n bytes
    # through the PPP network interface.
    mtu 1492

    1.6.2.2              配置pap-secrets、chap-secrets
    需要拨入的用户名需要存在文件pap-secrets和chap-secrets中,其内容相同。
    内容如下(以表格形式呈现):
    客户端用户名
       
    服务器
       
    密码
       
    IP地址
    lumino
       
    *
       
    123456
       
    *
    原文对比:
    # Secrets for authentication using PAP
    # client server secret IP addresses
    "lumino"      *    "123456"   *
    最后一个必须是*

    1.6.2.3             配置/etc/ppp/pppoe-sever-options
    pppoe-server-options内容如下:

    # PPP options for the PPPoE server
    #require-pap
    #login # this is need when auth is enable
    #lcp-echo-interval 10
    #lcp-echo-failure 2
    #DNS1=202.106.47.151
    #DNS2=202.106.0.20

    1.6.3测试pppoe安装是否成功
    在PC中测试pppoe是否安装成功。
    首先切换到目录/usr/sbin下
    运行pppd,如果出现乱码,代表安装已经成功。

    1.6.4启动pppoe拨号服务器
    运行命令:
    pppoe-server -L 192.168.0.6 -R 192.168.0.11
    启动pppoe拨号服务器
    参数 –L 指定pppoe服务器
    参数 –R指定 pppoe客户端
    Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=1467641


    本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/41638/showart_461094.html
  • 您需要登录后才可以回帖 登录 | 注册

    本版积分规则 发表回复

      

    北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
    未成年举报专区
    中国互联网协会会员  联系我们:huangweiwei@itpub.net
    感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

    清除 Cookies - ChinaUnix - Archiver - WAP - TOP