海运的博客

n1盒子连接手机4G无线热点做k2p宽带pppoe备份线路并切换

发布时间:February 24, 2021 // 分类:N1,K2P // No Comments

k2p主路由地址:192.168.1.1
n1盒子地址:192.168.1.2
k2p添加低优先级默认路由走n1,此路由只有pppoe断开后才有效:

ip rou add default via 192.168.1.2 dev br-lan metric 1000

n1盒子用netplan配置无线网络默认路由和无线热点的路由优先级,默认情况下走k2p主路由,当路由器pppoe不能连接时打开手机无线热点则自动走手机4g网络连接。

network:
    version: 2
    renderer: networkd
    ethernets:
        eth0:
            addresses:
            - 192.168.1.2/24
            dhcp4: false
            dhcp6: true
            accept-ra: true
            #gateway4: 192.168.1.1
            routes:
                - to: 0.0.0.0/0
                  via: 192.168.1.1
                  metric: 1000
            nameservers:
                addresses:
                - 192.168.1.1
                search: []

    wifis:
      wlan0:
        #防止开机时wlan0未连接导致systemd-networkd-wait-online阻塞系统启动
        optional: true
        dhcp4: yes
        dhcp6: no
        dhcp4-overrides:
            route-metric: 600
        access-points:
            "Phone-ssid":
                password: "www.haiyun.me"

n1盒子开启snat及网络转发:

iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
sysctl -w net.ipv4.ip_forward=1

n1盒子armbian 内核5.3.0编译更新wireguard内核模块

发布时间:September 23, 2020 // 分类: // No Comments

安装交叉编译环境见:ubuntu下交叉编译arm64/armbian内核模块
下载5.3内核及wireguard最新源码,并打补丁到内核。

#git clone -b 5.3 --depth 1 https://github.com/150balbes/Amlogic_s905-kernel.git
git clone -b 5.3 --depth 1 https://github.com/w22gb8/Amlogic_s905-kernel.git
cd Amlogic_s905-kernel/
#git clone https://git.zx2c4.com/wireguard-linux-compat
git clone -b v1.0.20211208 --depth=1 https://github.com/WireGuard/wireguard-linux-compat.git
bash ./wireguard-linux-compat/kernel-tree-scripts/jury-rig.sh .

编译wireguard模块,版本后缀-aml-g12和内核后缀保持一致。

cp ../config-5.3.0-aml-g12 .config
make LOCALVERSION="-aml-g12" modules_prepare
make M=net/wireguard CONFIG_WIREGUARD=m modules
modinfo net/wireguard/wireguard.ko

替换升级wireguard内核模块:

systemctl stop wg-quick@wg0.service 
cp wireguard.ko /lib/modules/5.3.0-aml-g12/kernel/net/wireguard/
modprobe -r wireguard
systemctl start wg-quick@wg0.service 

此内容被密码保护

发布时间:January 22, 2020 // 分类:VPN // No Comments

请输入密码访问

ubuntu下交叉编译arm64/armbian内核模块

发布时间:October 13, 2018 // 分类:N1 // 5 Comments

安装编译环境及下载交叉编译工具:

apt update
apt -y install gcc make pkg-config git bison flex libelf-dev libssl-dev libncurses5-dev bc
wget https://releases.linaro.org/components/toolchain/binaries/latest-7/aarch64-linux-gnu/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu.tar.xz
tar -Jxf gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu.tar.xz 
export ARCH=arm64 
export CROSS_COMPILE=`pwd`/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-

查看内核版本:

uname -r
4.18.7-aml-s9xxx

下载内核源码:

#git clone https://github.com/150balbes/Amlogic_s905-kernel.git
#使用4.18.7内核
#git checkout 20181012
git clone -b 20181012 --depth 1 https://github.com/w22gb8/Amlogic_s905-kernel.git
cd Amlogic_s905-kernel

初始化配置,不做这步直接编译模块会提示错误: fatal error: include/generated/autoconf.h: No such file or directory。

cp config_5.60 .config
make prepare
make scripts

编译指定模块:

make M=net/ipv4/ CONFIG_TCP_CONG_BBR=m modules
make M=drivers/usb/class CONFIG_USB_PRINTER=m modules

编译所有模块:

make modules 
make modules_install INSTALL_MOD_PATH=/

复制模块到目标机器对应目录并加载:

cp tcp_bbr.ko /lib/modules/`uname -r`/kernel/net/ipv4
#echo 'kernel/net/ipv4/tcp_bbr.ko:' >> /lib/modules/`uname -r`/modules.dep
depmod 
modprobe tcp_bbr

加载模块时出现invalid module format的错误,是version magic版本不一致或crc校验不通过,可通过modinfo查看本机模块和新编译模块version magic版本信息,通过dmesg查看log出现以下错误:

sch_fq: version magic '4.18.7 SMP preempt mod_unload aarch64' should be '4.18.7-aml-s9xxx SMP preempt mod_unload aarch64'

可见内核版本后缀不一样,在编译时添加版本后缀:

make LOCALVERSION="-aml-s9xxx"

编译模块时添加版本后缀无效?那就在初始时添加,后续编译时不要再次添加。

make LOCALVERSION="-aml-s9xxx" modules_prepare

参考:
https://serverfault.com/questions/568395/what-is-creating-the-generated-autoconf-h
https://wiki.archlinux.org/index.php/Compile_kernel_module

分类
最新文章
最近回复
  • 海运: 地址格式和udpxy一样,udpxy和msd_lite能用这个就能用。
  • 1: 怎么用 编译后的程序在家里路由器内任意一台设备上运行就可以吗?比如笔记本电脑 m参数是笔记本的...
  • 孤狼: ups_status_set: seems that UPS [BK650M2-CH] is ...
  • 孤狼: 擦。。。。apcupsd会失联 nut在冲到到100的时候会ONBATT进入关机状态,我想想办...
  • 海运: 网络,找到相应的url编辑重发请求,firefox有此功能,其它未知。
  • knetxp: 用浏览器F12网络拦截或监听后编辑重发请求,修改url中的set为set_super,将POS...
  • Albert: 啊啊啊啊啊啊啊啊啊 我太激动了,终于好了英文区搜索了半天,翻遍了 pve 论坛没找到好方法,博...
  • jiangker: good, very helpful to me
  • fengfeng: N1 armbian 能有编译下内核吗。。我要开启can 不懂怎么操作
  • 1: 方法一ngtcp2要改下:./configure PKG_CONFIG_PATH=/usr/l...