【问题标题】:Block outgoing traffic for PPTP clients阻止 PPTP 客户端的传出流量
【发布时间】:2018-12-10 09:09:32
【问题描述】:

我在 Ubuntu VM 中安装了 PPTP 服务器。 Ubuntu 主机配置为将 VPN 流量从外部客户端传递到此 VM 到内部服务器资源。现在我需要阻止这些 VPN 客户端访问特定的外部 IP 地址或端口。我怎么能这样做?

我尝试使用以下规则删除主机上的所有输出流量:

iptables -I OUTPUT -p udp --dport 9999 -j DROP

但它不适用于 VPN 客户端。使用 PPTP 将此规则添加到 VM 也不起作用。我怎么能阻止这样的连接?

主机上的当前iptables:

Chain INPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     udp  --  anywhere             anywhere             udp dpt:domain
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:domain
ACCEPT     udp  --  anywhere             anywhere             udp dpt:bootps
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:bootps
ACCEPT     tcp  --  anywhere             anywhere             ctstate RELATED,ESTABLISHED tcp dpt:1723
ACCEPT     gre  --  anywhere             anywhere             ctstate RELATED,ESTABLISHED

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination
REJECT     udp  --  anywhere             anywhere             udp 9999 reject-with icmp-port-unreachable
ACCEPT     tcp  --  anywhere             vpn                  state NEW tcp dpt:1723
ACCEPT     all  --  anywhere             192.168.122.0/24     ctstate RELATED,ESTABLISHED
ACCEPT     all  --  192.168.122.0/24     anywhere
ACCEPT     all  --  anywhere             anywhere
REJECT     all  --  anywhere             anywhere             reject-with icmp-port-unreachable
REJECT     all  --  anywhere             anywhere             reject-with icmp-port-unreachable

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     udp  --  anywhere             anywhere             udp dpt:bootpc
ACCEPT     tcp  --  anywhere             anywhere             ctstate NEW,RELATED,ESTABLISHED tcp dpt:1723
ACCEPT     gre  --  anywhere             anywhere             ctstate NEW,RELATED,ESTABLISHED
REJECT     udp  --  anywhere             anywhere             udp 9999 reject-with icmp-port-unreachable

【问题讨论】:

    标签: networking iptables pptp


    【解决方案1】:

    你的iptables -L 输出是什么?您的规则是否全部接受?你保存你的iptables吗?

    【讨论】:

    • 我在问题中添加了iptables -L 输出
    • 你的规则低于全部接受,所以它永远不会匹配。试试iptables -I OUTPUT 1 -p udp --dport 9999 -j DROP 注意1
    • 我的理解是 OUTPUT 链没有接受所有规则。对于 FORWARD 链,我的规则排在第一位。还是我理解有误?
    猜你喜欢
    • 2014-09-05
    • 2015-09-10
    • 2013-10-06
    • 2018-04-29
    • 1970-01-01
    • 2013-10-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多