unbit / vpn-ws

A VPN system over websockets
MIT License
605 stars 100 forks source link

Documentation on assigning IP address to a network interface #3

Open skyred opened 9 years ago

skyred commented 9 years ago

I followed the documentation and created a simple server without auth. Then, I compiled a client and connected to the server, as the server printed

[Sat Jul  4 21:13:14 2015] registered new peer 5 MAC=1E:8A:66:ED:70:82 REMOTE_ADDR=XXX.XXX.XXX.XXX REMOTE_USER= DN=

and the client printed

[Sun Jul  5 09:13:14 2015] connecting to XXX.XXX.XXX.XXX port 80 (transport: ws)
[Sun Jul  5 09:13:15 2015] connected to XXX.XXX.XXX.XXX port 80 (transport: ws)

Now, I simply visited a web page to show my client IP, but it still displayed my real client IP. I realized that I have not done this step specified in the documentation:

Once your client is connected you can assign it an ip address (or make a dhcp request if one of the connected nodes has a running dhcp server)

I Googled around, and found a simple step on my Ubuntu 14.10:

/sbin/ip link # To show my current network interfaces, and I see vpn-ws0
sudo /sbin/ip addr add 192.168.0.10/24 dev vpn-ws0

No error returned. Then, I re-checked my ip address on a website, it still showed the real client IP.

So, I am wondering what I did wrong.

unbit commented 9 years ago

The --exec trick is safer (and faster) than manually calling network setup:

https://github.com/unbit/vpn-ws#the---exec-trick

For your specific setup (network anonimizer) you need the following steps:

So, if your local vpn peer is 192.168.0.10 and the server is 192.168.0.1 and you home router is 1.2.3.4 and your http server is 5.6.7.8:

ifconfig vpn-ws0 192.168.0.10
route add -host 5.6.7.8 gw 1.2.3.4
route del default
route add default gw 192.168.0.1
skyred commented 9 years ago

Thank you very much! But, I am a little afraid to carry on the rest of experiment on my laptop, as I don't know enough, and I would need to research how to undo things first.

I will try to post back my process.

luckypoem commented 8 years ago

@skyred , 你好,你成功的用此程序翻墙了吗?我还是失败,看看这里 https://github.com/unbit/vpn-ws/issues/6 ,如果你成功了,可指点一下我该怎么做吗