我的电脑有两块物理网卡,eth0
一个用来上网,eth1
一个用作dhcp服务器,让多个无线路由器可以上网。
我启用了内核 ip 转发并使用 iptable 添加了一些规则:
net.ipv4.ip_forward = 1
iptables -A FORWARD -i eth1 -j ACCEPT
iptables -A FORWARD -o eth1 -j ACCEPT
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
一切正常。
现在,我想通过隧道传输所有流量eth1
(使用SSH_VPNtun0
创建的第三个虚拟网络接口)
这是我的 ifconfig 输出:
eth0 Link encap:Ethernet HWaddr b8:27:eb:dd:56:bb
inet addr:10.1.0.212 Bcast:10.1.0.255 Mask:255.255.255.0
inet6 addr: fe80::ba27:ebff:fedd:56bb/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:25131918 errors:0 dropped:0 overruns:0 frame:0
TX packets:2234134 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1527934819 (1.5 GB) TX bytes:342049206 (342.0 MB)
eth1 Link encap:Ethernet HWaddr 00:0e:c6:b2:60:90
inet addr:192.168.50.1 Bcast:192.168.50.255 Mask:255.255.255.0
inet6 addr: fe80::20e:c6ff:feb2:6090/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1919359 errors:0 dropped:1 overruns:0 frame:0
TX packets:321412 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:135557477 (135.5 MB) TX bytes:338750947 (338.7 MB)
tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:10.11.0.212 P-t-P:10.11.0.226 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:8 errors:0 dropped:3 overruns:0 frame:0
TX packets:3 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:492 (492.0 B) TX bytes:252 (252.0 B)
我该如何转发?我尝试了几种方法但没有运气:(
提前致谢。