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

推荐订阅源

The Hacker News
The Hacker News
B
Blog RSS Feed
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
宝玉的分享
宝玉的分享
L
LangChain Blog
Google DeepMind News
Google DeepMind News
酷 壳 – CoolShell
酷 壳 – CoolShell
F
Full Disclosure
T
The Blog of Author Tim Ferriss
月光博客
月光博客
有赞技术团队
有赞技术团队
Last Week in AI
Last Week in AI
aimingoo的专栏
aimingoo的专栏
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Stack Overflow Blog
Stack Overflow Blog
WordPress大学
WordPress大学
MongoDB | Blog
MongoDB | Blog
小众软件
小众软件
博客园 - Franky
B
Blog
博客园_首页
C
CERT Recently Published Vulnerability Notes
Hugging Face - Blog
Hugging Face - Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
K
Kaspersky official blog
I
Intezer
P
Proofpoint News Feed
博客园 - 叶小钗
S
Schneier on Security
P
Privacy & Cybersecurity Law Blog
Recorded Future
Recorded Future
NISL@THU
NISL@THU
A
Arctic Wolf
Know Your Adversary
Know Your Adversary
C
Cyber Attacks, Cyber Crime and Cyber Security
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
The Register - Security
The Register - Security
C
Cisco Blogs
大猫的无限游戏
大猫的无限游戏
S
Secure Thoughts
T
The Exploit Database - CXSecurity.com
Forbes - Security
Forbes - Security
Project Zero
Project Zero
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Cisco Talos Blog
Cisco Talos Blog
D
Docker
Blog — PlanetScale
Blog — PlanetScale
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
人人都是产品经理
人人都是产品经理

披萨盒的赛博日志

谈谈工作了半年的感受 使用策略模式重构复杂业务分支 像 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

披萨盒

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

个人主页