Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bind to secondary gateway #158

Open
Azureit opened this issue Mar 8, 2016 · 1 comment
Open

Bind to secondary gateway #158

Azureit opened this issue Mar 8, 2016 · 1 comment

Comments

@Azureit
Copy link

Azureit commented Mar 8, 2016

I have two network cards serving my computer with two gateways.
ip route show
default via 10.0.0.1 dev eth0 proto static metric 100
default via 192.168.0.1 dev eth1 proto static metric 600
10.0.0.0/24 dev eth0 proto kernel scope link src 10.0.0.2 metric 100
192.168.0.0/24 dev eth1 proto kernel scope link src 192.168.0.2 metric 600

I want to use the secondary gateway, eth1, to connect to ShadowVPN server.
I modify the ShadowVPN code to bind the socket to eth1 like this:
setsockopt(sock, SOL_SOCKET, SO_BINDTODEVICE, "eth1", 4);
This is not working, but the UDP packets are send correctly via eth1 and the ShadowVPN server responds correctly, because I monitor the incoming packets with wireshark at eth1, but the ShadowVPN client will not capture those packets from server.

Thanks for any help.

@hieixu
Copy link

hieixu commented Mar 17, 2016

You can do this via route command.
route add -host vpn_server_ip gw 192.168.0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants