linux 双网卡代理上网

需要三个前提:

# 在192.168.26.99代理上网前提:
1) 路由表包含需要上网的网段
route add -host 100.x.x.x gw 100.x.x.1 # eth1 是Wan口网卡
route add -net 192.168.x.0/22 eth0 # eth0 是Lan口网卡

2) 开启ip转发
echo 1 > /proc/sys/net/ipv4/ip_forward

上面增加这2条记录
iptables -t nat -A POSTROUTING -s 192.168.188.0/24 -j MASQUERADE
iptables -t nat -A POSTROUTING -s 192.168.24.0/24 -j MASQUERADE
# 查看结果 iptables -L -t nat

原文地址:https://www.cnblogs.com/Cong0ks/p/13362083.html