阻止 VPN 客户端的网站

阻止 VPN 客户端的网站

我在 Ubuntu 12 x86 vps 机器上安装了 IPSEC L2TP VPN 服务器。我想屏蔽连接到 VPN 服务器的客户端的一些网站。因此,更改了 Ubuntu 中的 hosts 文件以阻止访问不需要的网站,例如:0.0.0.0 www.unwanteddomain.com 等。

当我尝试在 Ubuntu 终端中使用以下命令连接不需要的网站时wget www.unwanteddomain.com它说:

解析 www.unwanteddomain.com (www.unwanteddomain.com)... 0.0.0.0 连接到 www.unwanteddomain.com (www.unwanteddomain.com)|0.0.0.0|:80... 失败:连接被拒绝。

所以我认为 hosts 文件功能很好用。但是当我想从连接的 VPN 客户端打开这些网站时,它不起作用。我仍然可以从客户端访问所有网站。

为什么 VPN 服务器无法访问某个站点,而 VPN 客户端却可以?我该怎么做才能阻止 VPN 客户端访问这些站点?

IPTables.规则

    filter
    :INPUT ACCEPT [0:0]
    :FORWARD ACCEPT [0:0]
    :OUTPUT ACCEPT [0:0]
    :ICMPALL - [0:0]
    -A INPUT -m conntrack --ctstate INVALID -j DROP
    -A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
    -A INPUT -i lo -j ACCEPT
    -A INPUT -p icmp --icmp-type 255 -j ICMPALL
    -A INPUT -p udp --dport 67:68 --sport 67:68 -j ACCEPT
    -A INPUT -p tcp --dport 22 -j ACCEPT
    -A INPUT -p udp -m multiport --dports 500,4500 -j ACCEPT
    -A INPUT -p udp --dport 1701 -m policy --dir in --pol ipsec -j ACCEPT
    -A INPUT -p udp --dport 1701 -j DROP
    -A INPUT -j DROP
    -A FORWARD -m conntrack --ctstate INVALID -j DROP
    -A FORWARD -i eth+ -o ppp+ -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
    -A FORWARD -i ppp+ -o eth+ -j ACCEPT
    -A FORWARD -j DROP
    -A ICMPALL -p icmp -f -j DROP        
    -A ICMPALL -p icmp --icmp-type 0 -j ACCEPT
    -A ICMPALL -p icmp --icmp-type 3 -j ACCEPT
    -A ICMPALL -p icmp --icmp-type 4 -j ACCEPT
    -A ICMPALL -p icmp --icmp-type 8 -j ACCEPT
    - A ICMPALL -p icmp --icmp-type 11 -j ACCEPT
    -A ICMPALL -p icmp -j DROP
    COMMIT
    *nat
    :PREROUTING ACCEPT [0:0]
    :INPUT ACCEPT [0:0]
    :OUTPUT ACCEPT [0:0]
    :POSTROUTING ACCEPT [0:0]
    -A POSTROUTING -s 192.168.42.0/24 -o eth+ -j SNAT --to-source 23.x.x.203
    COMMIT

相关内容