@kirschwasser This doesn't work, should it?
iptables -t mangle -A PREROUTING -p tcp -d youtube.com -j MARK --set-mark 2
So I guess I have to use that ipset-dns methode. I installed ipset and ipset-dns, but I can't get it to work, here's my script I use right now, that I found on another page:
sets() {
iptables -t mangle -D PREROUTING -m set --match-set "$1" dst,src -j MARK --set-mark "$2" 2>/dev/null
ipset -X "$1" 2>/dev/null
ipset -N "$1" iphash
iptables -t mangle -A PREROUTING -m set --match-set "$1" dst,src -j MARK --set-mark "$2"
} # I edited it from "-m set --set" (was so in the original script, but gave me an error) to "-m set --match-set"
sets youtube 2
sets netflix 3
killall ipset-dns 2>/dev/null
ipset-dns youtube youtube 39128 8.8.8.8
ipset-dns netflix netflix 39129 8.8.8.8
# I edited this, because the script just said ipset-dns youtube 39128 8.8.8.8, gave me the error "Usage: ipset-dns ipv4-ipset ipv6-ipset port upstream"
killall -SIGHUP dnsmasq
----
Whats wrong with this? ip rules are the following, already set before I got into this whole youtube/netflix routing idea, vpn's are working of course:
ip rule add fwmark 2 table vpn1
ip rule add fwmark 3 table vpn2
and
ip route add default via $GW dev tun0 table vpn1
iptables -t nat -A POSTROUTING -o tun0 -j SNAT --to $IP
ip route add default via $GW dev tun1 table vpn2
iptables -t nat -A POSTROUTING -o tun1 -j SNAT --to $IP
iptables -t mangle -A PREROUTING -s 10.0.0.0/24 -j MARK --set-mark 2
And in /etc/dnsmasq.conf:
server=/c.youtube.com/127.0.0.1#39128
server=/netflix.com/127.0.0.1#39129
(Last edited by knuddel on 19 Jul 2013, 04:45)