我第一次尝试设置 OpenVPN。我遵循了 OpenVPN 网站上的 HOWTO 指南并成功连接,但是当我尝试路由我的网络流量时,似乎没有任何东西通过我的服务器。
我的服务器是 Amazon EC2 盒子,我的客户端是 MacOS Lion。我在 Mac 上使用 Tunnelblick。我已经运行/尝试了以下内容:
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE我的服务器上这是我的服务器配置文件:http : //pastebin.com/izCBxk99
运行 OpenVPN 时的服务器 ifconfig:http : //pastebin.com/xM9w8kAA
服务器日志,一个客户端连接成功后尝试打开网页:http : //pastebin.com/B1WAJ2XH
客户端配置文件:http : //pastebin.com/GzPeXE7E
运行 OpenVPN 时的客户端 ifconfig:http : //pastebin.com/ZQvvP9Z0
客户端日志:http : //pastebin.com/xmhEx77g
我注意到的唯一错误是在客户端日志中,它说:
2012-05-06 20:43:44 us=732786 /sbin/ifconfig tap0 delete
ifconfig: ioctl (SIOCDIFADDR): Can't assign requested address
2012-05-06 20:43:44 us=738214 NOTE: Tried to delete pre-existing tun/tap instance -- No Problem if failure
Run Code Online (Sandbox Code Playgroud)
这可能是问题吗?我发现一些网页说 Tunnelblick 曾经与 Lion 有问题,但我使用的版本高于作为修复程序提到的版本。
此外,我注意到在运行iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE(with su) 后,如果我这样做,我的服务器仍然只显示以下内容netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
10.248.138.0 0.0.0.0 255.255.254.0 U 0 0 0 eth0
0.0.0.0 10.248.138.1 0.0.0.0 UG 0 0 0 eth0
Run Code Online (Sandbox Code Playgroud)
服务器似乎没有得到新的路由。这是问题吗?
请帮忙。谢谢!
你ip_forward在服务器上启用了吗?
cat /proc/sys/net/ipv4/ip_forward # 0 disabled, 1 enabled
Run Code Online (Sandbox Code Playgroud)
启用它以允许伪装:
echo 1 > /proc/sys/net/ipv4/ip_forward
Run Code Online (Sandbox Code Playgroud)
并让更改永久生效,编辑/etc/sysctl.conf:
# Uncomment the next line to enable packet forwarding for IPv4
net.ipv4.ip_forward=1
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2015 次 |
| 最近记录: |