android4.2 添加 kernal 对 PPP 的支持

本文介绍如何在内核层面配置PPTP协议支持,并通过mtpd程序建立PPTP VPN连接。包括内核配置步骤、mtpd命令参数详解及成功连接后的网络设置。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

 

 

 

Kernel stack, also known as the kernel stack memory or the kernel's thread stack, is a crucial component in an operating system (OS) that manages the memory space used by threads executing within the kernel context. The kernel stack is essentially a portion of the memory specifically allocated for storing stack frames, which are temporary memory areas that hold information about the function calls and local variables for each thread running at the kernel level. Each thread created by the kernel has its own kernel stack, where data structures like function return addresses, saved registers, and other thread-specific information are stored. When a kernel function is invoked, the necessary data is pushed onto the stack to keep track of the current execution state, and upon return, the state is restored from the stack. Here are some key points about the kernel stack: 1. **Synchronization**: Since kernel stack accesses are critical sections, they must be protected by appropriate synchronization mechanisms to prevent race conditions or data corruption. 2. **Memory Management**: The OS kernel ensures efficient management of the kernel stack space, allocating and deallocating it as needed. 3. **Exception Handling**: Kernel stacks help in handling exceptions and traps that occur during kernel-level operations, allowing the system to return control to the correct context. 4. **Isolation**: The kernel stack is typically separated from user-space stacks to provide an additional layer of security and to prevent malicious code from accessing sensitive kernel data.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值