【问题标题】:block a website using iptables (redirecting to an error page)使用 iptables 阻止网站(重定向到错误页面)
【发布时间】:2014-03-15 12:15:23
【问题描述】:

在技术上是否可以使用特定的 iptables 规则阻止网站,同时向用户浏览器返回错误页面?

iptables -t nat -A PREROUTING -s 192.168.1.19 -p tcp --dport 80 -j DNAT --to-destination 192.168.1.20:80

谢谢

【问题讨论】:

    标签: linux apache networking iptables


    【解决方案1】:

    如果您使用 iptables 完全阻止来自 IP 地址的端口 80 流量,您的 Web 服务器将永远不会收到来自该客户端的任何请求,因此无法提供错误页面。所以简而言之,没有。

    要实现您的要求,一种解决方案是将端口转发到仅提供错误页面的另一个端口或主机。执行此操作的 iptables 规则将根据您的具体情况而定。但这样做时,数据包仍会穿过您的网络。

    你最好在ServerFault问这个问题...

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-09-21
      • 2014-01-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-11-22
      • 2017-11-03
      相关资源
      最近更新 更多