Skip to content

Instantly share code, notes, and snippets.

View lanceliao's full-sized avatar

Lance Liao lanceliao

View GitHub Profile
@lanceliao
lanceliao / wg-client1.conf
Last active February 18, 2024 02:07
Sample WireGuard configuration files
[Interface]
Address = 10.200.200.3/32
PrivateKey = [Client's private key]
DNS = 8.8.8.8
[Peer]
PublicKey = [Server's public key]
PresharedKey = [Pre-shared key, same for server and client]
Endpoint = [Server Addr:Server Port]
AllowedIPs = 0.0.0.0/0
@lanceliao
lanceliao / dnsmasq-gfwlist.py
Last active August 18, 2023 11:26
将gfwlist转换成带ipset的dnsmasq规则,适用于OpenWrt智能上网
#!/usr/bin/env python
#coding=utf-8
#
# Generate a list of dnsmasq rules with ipset for gfwlist
#
# Copyright (C) 2014 http://www.shuyz.com
# Ref https://code.google.com/p/autoproxy-gfwlist/wiki/Rules
import urllib2
import re
@lanceliao
lanceliao / 1-redsocks2-openwrt.md
Last active April 24, 2023 16:05
在OpenWrt上配置redsocks2

redsocks2是一款透明socks5代理工具,能够实现智能代理的功能,这里是redsocks2在OpenWrt上的配置,配合shadowsocks使用。

redsocks.conf 是配置文件,放在/etc目录,将192.168.1.1改成路由器的地址. redsocks2.sh 为自启动文件,改名为redsocks2放到/etc/init.d目录即可。自启动文件假设redsocks可执行文件在/opt/bin目录。

启动redsocks2: /etc/init.d/redsocks2 start 停止redsocks2: /etc/init.d/redsocks2 stop

redsocks2 git源

@lanceliao
lanceliao / 0-openwrt-auto-mount-readme.md
Last active November 26, 2022 08:58
Auto mount USB storage device by uuid on OpenWrt
  1. Install USB device support;
opkg install kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-usb-storage e2fsprogs fdisk usbutils mount-utils block-mount kmod-fs-ext4 kmod-fs-vfat kmod-nls-utf-8 kmod-nls-cp437 kmod-nls-iso8859-1

reboot
  1. Install blkid, run opkg update && opkg install blkid;
  2. Copy block.sh to directory /lib/functions;
  3. Copy 10-mount and 20-swap to directory /etc/hotplug.d/block;
  4. That's it! run logread -f command then plug in a USB stick to test.
@lanceliao
lanceliao / samba-openwrt.md
Last active May 12, 2022 18:28
Samba on OpenWrt 配置

##安装

opkg update && opkg install samba luci-app-samba

##配置

匿名登录

#/etc/config/samba
config sambashare
@lanceliao
lanceliao / OpenWrt-Package-Downloader.py
Last active June 3, 2020 17:50
Cache all packages from OpenWrt trunk repository
#!/usr/bin/env python
#coding=utf-8
#
# Openwrt Package Grabber
#
# Copyright (C) 2014 http://www.shuyz.com
#
import urllib2
import re
@lanceliao
lanceliao / luci-lighttpd-openwrt.md
Last active February 26, 2020 15:43
Configure LUCI on lighttpd

###Install

opkg install lighttpd lighttpd-mod-cgi

###Configgure

修改/etc/lighttpd/lighttpd.conf

  1. static-file.exclude-extensions = (".php", ".pl", ".fcgi")改成static-file.exclude-extensions = (".php", ".pl", ".fcgi", ".lua")
  1. 开启ipv4转发
vi /etc/sysctl.conf
# 将net.ipv4.ip_forward=0更改为net.ipv4.ip_forward=1
sysctl -p
  1. 安装dnsmasq 和pdnsd解决dns污染

DNS的解析方案为 resolve.conf ==> dnsmasq ==> pdnsd

@lanceliao
lanceliao / shadowsocks.sh
Created August 14, 2014 07:23
Shadowsocks startup script with iptables rules for OpenWrt
#!/bin/sh /etc/rc.common
# Copyright (C) 2006-2011 OpenWrt.org
#
# Shadowsocks startup script with iptables rules for OpenWrt
#
# This file is located in directory /etc/init.d/
# rename this file to shadowsocks before using it
#
# By Lance http://www.shuyz.com
#
@lanceliao
lanceliao / openwrt-usb-serial.md
Created August 19, 2014 11:48
OpenWrt USB转串口模块的调试

###安装

opkg install kmod-usb-serial kmod-usb-serial-pl2303

安装完成之后需要手动载入内核模块:

insmod usbserial
insmod pl2303