惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

K
Kaspersky official blog
T
Threat Research - Cisco Blogs
N
News and Events Feed by Topic
Hacker News: Ask HN
Hacker News: Ask HN
Project Zero
Project Zero
Application and Cybersecurity Blog
Application and Cybersecurity Blog
博客园 - 叶小钗
Security Latest
Security Latest
Spread Privacy
Spread Privacy
aimingoo的专栏
aimingoo的专栏
N
News and Events Feed by Topic
Webroot Blog
Webroot Blog
U
Unit 42
Cyberwarzone
Cyberwarzone
小众软件
小众软件
Scott Helme
Scott Helme
Engineering at Meta
Engineering at Meta
Microsoft Security Blog
Microsoft Security Blog
T
The Blog of Author Tim Ferriss
A
About on SuperTechFans
爱范儿
爱范儿
S
Schneier on Security
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Schneier on Security
Schneier on Security
Latest news
Latest news
GbyAI
GbyAI
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Simon Willison's Weblog
Simon Willison's Weblog
The Register - Security
The Register - Security
WordPress大学
WordPress大学
博客园_首页
Blog — PlanetScale
Blog — PlanetScale
PCI Perspectives
PCI Perspectives
Jina AI
Jina AI
AI
AI
NISL@THU
NISL@THU
I
Intezer
G
GRAHAM CLULEY
B
Blog
S
Secure Thoughts
IT之家
IT之家
宝玉的分享
宝玉的分享
Recent Announcements
Recent Announcements
Y
Y Combinator Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
酷 壳 – CoolShell
酷 壳 – CoolShell
有赞技术团队
有赞技术团队
V2EX - 技术
V2EX - 技术
Recorded Future
Recorded Future
Hacker News - Newest:
Hacker News - Newest: "LLM"

披萨盒的赛博日志

谈谈工作了半年的感受 使用策略模式重构复杂业务分支 像 systemd 一样管理 MacOS 后台常驻任务 以ORM看封装的边界 Git Merge VS Git Rebase: 如何优雅地合并分支? OpenLDAP折腾日记 非特权模式容器 ssh 登录问题 在 Linux 开发环境中使用网络代理 白嫖 Aseprite 像素绘图软件 MongoDB 增删改查 Python数据分析工具包-Numpy 解决 CLion 中文乱码问题 搭建 RLCraft 服务器 SpringBoot读取配置文件 Centos 配置 LNMP 环境 部署项目时遇到的坑 浅谈 xhr 请求跨域问题 JavaScript 学习笔记 Eclipse配置Web开发环境 Vue2 基本知识 Ribbon 简单使用 Nacos 简单使用 Spring Cloud Alibaba 环境搭建 什么是RSS?什么是Feed?它们有什么关系? Docker基本使用 TensorFlow启用GPU加速 如何进行内网穿透 Hello World! Git基本使用 Butterfly常用标签外挂
修改Linux内核模块以支持WG
披萨盒 · 2024-12-31 · via 披萨盒的赛博日志

背景

我的服务器系统是OpenCloudOS 9.2,内核为6.6.34-9.oc9.x86_64。

image-20241231093722024

我想在服务器上使用Wireguard,按理说5.6之后的Linux内核应该是内建该模块的,但是该系统中并没有。

image-20241231094103286

于是通过重新编译内核的方式来启用Wireguard的支持。

编译安装内核

内核源码位置

可以使用原本的内核源码:/usr/src/kernels

下载新内核源码:https://www.kernel.org/

如6.12.7的源码包:https://www.kernel.org/pub/linux/kernel/v6.x/linux-6.12.7.tar.gz

安装相应工具包

1
2
3
4
dnf groupinstall -y "Development Tools"
dnf install -y gcc make ncurses-devel bison flex elfutils-libelf-devel openssl-devel bc perl
dnf install -y kernel-devel-$(uname -r) kernel-headers-$(uname -r)
dnf install -y pkgconfig libmnl-devel

配置内核模块

  1. 进入内核源码所在的文件夹,首先复制原内核的配置项
1
cp /boot/config-$(uname -r) .config
  1. 允许Wireguard内核
1
make menuconfig

输入命令后会进入一个配置菜单,Wireguard配置项在Device Drivers --> Network device support --> WireGuard secure network tunnel,输入M(module)或Y(built-in),也可以开启其后的Debugging checks and verbose messages(输入Y)。

其他模块同理,把自己想要的配置都配置完成后通过光标先SaveExit即可。

通过grep命令查看模块是否被正确修改

1
grep WIREGUARD .config

编译安装内核

1
2
3
4
5
6
7
8
# 若之前编译过,先清理一下
make clean
make mrproper

# -j表示使用多个CPU核心进行编译,提高速度
make -j$(nproc)
make modules_install
make install

这步会比较慢,耐心等待即可。

更新引导程序

1
2
grub2-mkconfig -o /boot/grub2/grub.cfg
reboot

重启后可以检查内核是否被成功安装

1
uname -r

检测WireGuard模块

检测wireguard模块是否被包含在内核中

1
ls /lib/modules/$(uname -r)/kernel/drivers/net/wireguard/

加载该模块

1
modprobe wireguard

检测模块是否被加载

1
lsmod | grep wireguard

image-20241231141523880

完成!

版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-ND 4.0 许可协议。转载请注明来源 披萨盒的赛博日志


avatar

披萨盒

反正身体这么好,今天继续笑下去吧

个人主页