ShadowVPN icon indicating copy to clipboard operation
ShadowVPN copied to clipboard

Bind to secondary gateway

Open Azureit opened this issue 8 years ago • 1 comments

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.

Azureit avatar Mar 08 '16 19:03 Azureit

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

hieixu avatar Mar 17 '16 07:03 hieixu