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

Need guidence on configuring default route via local-tun #1644

Open
qwelias opened this issue Sep 6, 2024 · 2 comments
Open

Need guidence on configuring default route via local-tun #1644

qwelias opened this issue Sep 6, 2024 · 2 comments

Comments

@qwelias
Copy link

qwelias commented Sep 6, 2024

I was able to route specific ip via local-tun, so it seems to be working, but I'm really struggling with settuing up default route.

sslocal -s server -k pass -m method --protocol tun --tun-interface-address 10.255.0.1/24
ip r add 34.160.111.145 dev tun0 # ifconfig.me
curl ifconfig.me # works

ip r del 34.160.111.145
ip r del default
ip r add default dev tun0 # naive
curl ifconfig.me # conn timeout

I've also tried to replicate what openvpn is doing with routes, but it's over my head rn.
Would appreciate help. Feel free to close if that's outside of project's scope.

@zonyitoo
Copy link
Collaborator

zonyitoo commented Sep 7, 2024

I am also appreciate for people who could contribute a proper script or configuration for tun.

@ilardm
Copy link

ilardm commented Sep 13, 2024

I've just faced the same issue. Here is what worked for me:

sslocal -U --config tun-config.json --protocol tun --tun-interface-address 10.255.0.1/24

Launch in tcp_and_udp mode (I've noticed that udp packets are being dropped when launced with no mode flag, -vvv helps), tun-config.json just contains server/port/password/method data.

Adjust routing (source https://www.wireguard.com/netns/#overriding-the-default-route)

ip route add 0.0.0.0/1 dev tun0
ip route add 128.0.0.0/1 dev tun0
# avoid routing loop
ip route add ${server_ip}/32 via 172.17.0.1 dev eth0

And now either adjust your DNS address in (/etc/resolv.conf) to be outside your local network (like nameserver 1.1.1.1), or add one more routing adjustment:

ip route add ${local_dns}/32 via 172.17.0.1 dev eth0

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

3 participants