美文网首页
树霉派搭建笔记

树霉派搭建笔记

作者: bluexiii | 来源:发表于2016-11-22 14:20 被阅读55次

    系统设置工具

    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

    代理设置

    sudo vi /etc/environment
    export http_proxy="http://134.32.87.142:1080"
    export http_proxy="http://134.32.32.13:31315"

    sudo vi /etc/apt/apt.conf.d/10proxy
    Acquire::http::Proxy "http://134.32.87.142:8080/";
    Acquire::http::Proxy "http://134.32.32.13:31315/";

    apt-get使用阿里云镜像

    sudo vi /etc/apt/sources.list
    deb http://mirrors.aliyun.com/raspbian/raspbian/ wheezy main non-free contrib
    deb-src http://mirrors.aliyun.com/raspbian/raspbian/ wheezy main non-free contrib

    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"

    相关文章

      网友评论

          本文标题:树霉派搭建笔记

          本文链接:https://www.haomeiwen.com/subject/bbwppttx.html