原本是要看tcp/ip协议栈,找到了https://github.com/chobits/tapip这个。然后需要支持tun,完了开始安装。
TUN/TAP是一个虚拟网络设备,用于实现用户态程序和内核网络协议栈之间的数据交互。
1、安装环境
我的系统是ubuntu16.04 VMWare虚拟机,原来是这个版本。
2、环境检查
modinfotun
modinfo:ERROR: Module tun not found
结论:没有安装。
3、安装过程预总结
1> ubuntu 16.04、ubuntu 18.04、ubuntu 22.04的标准镜像中默认没有tun模块。
2> 使用sudo apt-get install linux-source方式下载源码,使用Tab补全,我选的第二个;
另外觉得可以只编译一个模块,参考文末4>,可以大幅减少编译耗时,不过不要高兴太早;modprobe tun时会这样——modprobe: ERROR: could not insert 'tun': Exec format error;用dmesg | grep