android4.2 添加 kernal 对 PPP 的支持

来源:互联网 发布:天庭淘宝店851 编辑:程序博客网 时间:2024/06/06 21:43

1、修改内核配置

  Networking support (NET [=y]) 
  -> Networking options
    -> Network packet filtering framework (Netfilter) (NETFILTER [=y])
      -> Core Netfilter Configuration 
        -> Netfilter connection tracking support 
        <*> PPtP protocol support 

  Device Drivers
  -> Network device support (NETDEVICES [=y])
    -> PPP (point-to-point protocol) support (PPP [=y])
      <*>   PPP (point-to-point protocol) support
      <*>     PPP BSD-Compress compression
      <*>     PPP Deflate compression
      [*]     PPP filtering
      <*>     PPP MPPE compression (encryption) (EXPERIMENTAL)
      [*]     PPP multilink support (EXPERIMENTAL)
      <*>     PPP over Ethernet (EXPERIMENTAL)
      <*>     PPP on L2TP Access Concentrator
      <*>     PPP on PPTP Network Server
      <*>     PPP support for async serial ports
      <*>     PPP support for sync tty ports 

如果没有可以在下面的地址下载
https://android.googlesource.com/kernel/common/+/android-3.10/drivers/net/ppp/


2、使用mtpd程序 连接vpn 以pptp为例

   mtpd eth0 pptp [xxx.xxx.xxx.xxx] 1723 name [xxx] password [xxx] linkname vpn refuse-eap nodefaultroute usepeerdns idle 1800 mtu 1400 mru 1400 +mppe &

   链接成功 会多一个ppp0

   ppp0  Link encap:Point-to-Point Protocol
         inet addr:10.10.77.102  P-t-P:10.10.77.1  Mask:255.255.255.255
         UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1396  Metric:1
         RX packets:33 errors:0 dropped:0 overruns:0 frame:0
         TX packets:2332 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:3
         RX bytes:2651 (2.5 KiB)  TX bytes:344945 (336.8 KiB)

   添加路由,并配置好dns

   busybox route add -net 0.0.0.0 dev ppp0


   root@android:/ # ping www.google.com
   PING www.google.com (216.58.203.36) 56(84) bytes of data.
   64 bytes from hkg12s10-in-f4.1e100.net (216.58.203.36): icmp_seq=1 ttl=56 time=107 ms
   64 bytes from hkg12s10-in-f4.1e100.net (216.58.203.36): icmp_seq=2 ttl=56 time=207 ms
   64 bytes from hkg12s10-in-f4.1e100.net (216.58.203.36): icmp_seq=3 ttl=56 time=118 ms
   64 bytes from hkg12s10-in-f4.1e100.net (216.58.203.36): icmp_seq=4 ttl=56 time=116 ms
   64 bytes from hkg12s10-in-f4.1e100.net (216.58.203.36): icmp_seq=5 ttl=56 time=112 ms




0 0
原创粉丝点击