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

[Feature] add support for control device using vpn or not #101

Open
wzhy90 opened this issue May 11, 2019 · 3 comments
Open

[Feature] add support for control device using vpn or not #101

wzhy90 opened this issue May 11, 2019 · 3 comments

Comments

@wzhy90
Copy link

wzhy90 commented May 11, 2019

ATM all clients working through vpn, but some of the client that I dont want it using vpn. Can you add a control switch for which client can use vpn?

@Mygod Mygod added contributions welcome I don't need this in my life enhancement labels May 12, 2019
@qweedleguy
Copy link

Maybe something like AFWall would be useful for this?

@worstperson
Copy link

It's possible to do it like this, in this case I'm usb tethering wlan0 and routing one client through a VPN:

# Allow traffic between rndis0 and tun0, but drop invalid packets
iptables -I tetherctrl_FORWARD -i rndis0 -o tun0 -g tetherctrl_counters
iptables -I tetherctrl_FORWARD -i rndis0 -o tun0 -m state --state INVALID -j DROP
iptables -I tetherctrl_FORWARD -i tun0 -o rndis0 -m state --state RELATED,ESTABLISHED -g tetherctrl_counters
iptables -A tetherctrl_counters -i rndis0 -o tun0 -j RETURN
iptables -A tetherctrl_counters -i tun0 -o rndis0 -j RETURN

# Enable masquerading for tun0
iptables -t nat -A tetherctrl_nat_POSTROUTING -o tun0 -j MASQUERADE

# Route traffic from a specific client ip through a specific gateway
ip rule add from $IPADDR table 100
ip route add default via $GATEWAY table 100

$IPADDR is the address of the user who's traffic you want to route and $GATEWAY is the address assigned to the interface you want to route through.

@Mygod
Copy link
Owner

Mygod commented Mar 19, 2022

@worstperson Yes, this is definitely possible. I am too lazy to implement (and maintain) this, however. PRs are welcome. 😄

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

No branches or pull requests

5 participants
@wzhy90 @worstperson @Mygod @qweedleguy and others