我第一次尝试设置OpenVPN。 我跟着从OpenVPN的网站的HOWTO指南,并成功连接,但是当我试图路由我的networkingstream量,似乎什么都不能通过我的服务器。
我的服务器是Amazon EC2盒子,我的客户端是MacOS Lion。 我在Mac上使用Tunnelblick。 我已经运行/尝试以下内容:
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE在我的服务器上 这是我的服务器configuration文件: http : //pastebin.com/izCBxk99
运行OpenVPN的服务器ifconfig: http : //pastebin.com/xM9w8kAA
服务器日志,一个客户端连接并尝试打开成功连接后的网页: http : //pastebin.com/B1WAJ2XH
客户端configuration文件: 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
这可能是问题吗? 我发现Tunnelblick曾经有一个Lion页面出现问题的网页,但是我使用的版本比上面提到的版本更高。
另外,我注意到在运行iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE (用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
服务器似乎没有得到新的路线。 这是问题吗?
请帮忙。 谢谢!
你在服务器上启用了ip_forward吗?
cat /proc/sys/net/ipv4/ip_forward # 0 disabled, 1 enabled
使其能够伪装:
echo 1 > /proc/sys/net/ipv4/ip_forward
并修改永久性,编辑/etc/sysctl.conf :
# Uncomment the next line to enable packet forwarding for IPv4 net.ipv4.ip_forward=1