centos7双网卡连通性学习

3 参考网页 https://github.com/yobabyshark/wireguard/blob/master/wireguard_install.sh

  1. 安装,配置 iptables

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    yum install -y iptables-services 
    systemctl enable iptables
    systemctl start iptables
    iptables -P INPUT ACCEPT
    iptables -P OUTPUT ACCEPT
    iptables -P FORWARD ACCEPT
    iptables -F
    service iptables save
    service iptables restart
    #echo 1 > /proc/sys/net/ipv4/ip_forward
    #echo "net.ipv4.ip_forward = 1" > /etc/sysctl.conf
    #sysctl -p
    #iptables -A FORWARD -i wg0 -j ACCEPT
    #iptables -A FORWARD -o wg0 -j ACCEPT
    iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE #最重要的一步

firewall

1