您好,欢迎来到伴沃教育。
搜索
您的当前位置:首页树霉派搭建笔记

树霉派搭建笔记

来源:伴沃教育

系统设置工具

raspi-config

设置root密码

sudo passwd root

修复ping权限

ls -lsa /bin/ping
sudo chmod 4711 /bin/ping

网络设置

vi /etc/network/interfaces
auto eth0
iface eth0 inet static
address xxx.xxx.xxx.xxx
netmask 255.255.248.0
gateway xxx.xxx.xxx.xxx
dns-nameservers xxx.xxx.xxx.xxx

启动网卡

sudo ifup eth0
sudo /etc/init.d/networking restart

代理设置

apt-get使用阿里云镜像

redsocks透明代理网关

开启IPV4转发:
sudo vi /etc/sysctl.conf
net.ipv4.ip_forward=1
sysctl -p /etc/sysctl.conf

源码编译Redsocks:
sudo apt install libevent-dev
make

redsocks配置文件:
sudo vi /etc/redsocks.conf

base {
    log_debug = off;
    log_info = on;
    log = "file:/home/pi/redsocks/logs/redsocks.log";
    daemon = off;
    redirector = iptables;
}
redsocks {
    local_ip = xxx.xxx.xxx.xxx;
    local_port = 3128;
    ip = xxx.xxx.xxx.xxx;
    port = 31080;
    type = socks5;
}

iptables配置:

iptables -F
iptables -X
iptables -Z

iptables -P INPUT DROP
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT

iptables -A INPUT -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A INPUT -p icmp -j ACCEPT
iptables -A INPUT -p tcp --dport 22 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A INPUT -p tcp --dport 3128 -m state --state NEW,ESTABLISHED -j ACCEPT

iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -j MASQUERADE
iptables -t nat -N REDSOCKS

iptables -t nat -A REDSOCKS -d 127.0.0.1 -j RETURN
iptables -t nat -A REDSOCKS -d 10.0.0.0/8 -j RETURN
iptables -t nat -A REDSOCKS -d 172.0.0.0/8 -j RETURN
iptables -t nat -A REDSOCKS -d 192.168.0.0/16 -j RETURN
iptables -t nat -A REDSOCKS -d 132.0.0.0/8 -j RETURN
iptables -t nat -A REDSOCKS -d 134.0.0.0/8 -j RETURN

iptables -t nat -A SS -p tcp -j REDIRECT --to-port 3128

iptables -t nat -A PREROUTING -p tcp -j SS
iptables -t nat -A OUTPUT -p tcp -j SS

dnsmasq架设DNS服务器

sudo apt install dnsmasq

shadowsocks

apt-get install python-pip
pip install shadowsocks

nginx配置端口

sudo vi /etc/nginx/sites-available/default
listen 30080;

设置时间

sudo raspi-config
ntpd -q -g
sudo date -s "2016-11-8 14:20:00"

Copyright © 2019- bangwoyixia.com 版权所有 湘ICP备2023022004号-2

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务