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 device for some platform using SO_BINDTODEVICE, root required. #222

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

sskaje
Copy link

@sskaje sskaje commented Nov 15, 2016

I set up sniproxy on my router (linux based, listening on secondary ip), with Internet and a VPN connection, dnsmasq is configured to hijack domains to sniproxy's IP and sniproxy forward those requests via VPN interface.

I tried to use source, but traffics still follow system route table.

So I tried to make changes on sniproxy, sskaje@8912987

SO_BINDTODEVICE is used to bind client interface, but root is required.

I guess this is not recommended, but someone like me may need this.

@sskaje
Copy link
Author

sskaje commented Nov 15, 2016

Example configuration

root@ubnt:/home/ubnt# more /etc/sniproxy.conf
#user daemon
user root

pidfile /run/sniproxy.pid
resolver {
    nameserver 8.8.8.8
    mode ipv4_first
}

error_log {
    filename /tmp/sniproxy.log
    priority error
}
access_log {
    filename /tmp/sniproxy-access.log
}

listen 192.168.32.2:3580 {
    proto http
    table http_hosts
    #source 10.200.1.2
    device vtun0
}

listen 192.168.32.2:3543 {
    proto tls
    table https_hosts
    #source 10.200.1.2
    device vtun0
}

table http_hosts {
    .* *:80
}

table https_hosts {
    .* *:443
}

table {
    .*  *
}

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

Successfully merging this pull request may close these issues.

1 participant