How does one develop a simple VPN Server using Python?
Source: Internet
Author: User
When the brain holes open during running, I want to write a simple VPN Server by myself. I searched for a lot of ready-made libraries or components, but I'm curious about how to implement it if I want to develop it in Python? When the brain holes open during running, I want to write a simple VPN Server by myself. I searched for a lot of ready-made libraries or components, but I'm curious about how to implement it if I want to develop it in Python? Reply: If you only implement a simple VPN for personal use, it is indeed very simple. A maximum of several hundred lines of code are supported.
Because all major operating system kernels have built-in TUN/TAP support, the application layer can easily establish point-to-point tunnel and generate a virtual Nic through corresponding interfaces. Then you can use tools such as iptables to set system data forwarding. Basically, the current VPN is also implemented in this way.
About TUN/TAP:
Https://zh.m.wikipedia.org/wiki/Tun
A very simple Linux C implementation version:
Https://github.com/cloudwu/mptun
Similar to Python implementation, the basic process is to enable/dev/net/tun to operate the TUN interface, and set up a data forwarding channel to forward data such as TCP or UDP.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service