测试损坏的 IP

发布于 2024-08-25 08:11:11 字数 331 浏览 6 评论 0原文

我正在尝试测试一个应用程序,我需要使一个有效的 IP 不会从我的测试服务器之一响应,但不会从其他服务器响应。我可以使用 /etc/hosts 为 FQDN 执行此操作,但我想为 IP 执行此操作。

为了澄清,我实际上希望两台服务器都能响应,但我需要服务器管理的设备之一只能从其中一台服务器访问。我正在测试主/工作应用程序,我想确保主设备无法直接与设备通信。

防火墙规则是完美的,是否必须在路由器上实施?或者,有什么办法可以在服务器上做到这一点。我希望能够直接在开发盒上做一些事情,因为我“拥有”它们,但我需要 IT 支持来更改路由器。如果您有实施防火墙规则的建议,我可以访问 Linux 和 Solaris 开发盒。

I'm trying to test an application and I need to make an valid IP not respond from a one of my test servers but not the others. I could do this for an fqdn using /etc/hosts but I'd like to do it for an IP.

To clarify I actually I want both servers to respond but I need one of the devices the servers manage to only be reachable from one of the servers. I'm testing a master / worker application and I want to make sure the master cannot talk to the device directly.

The firewall rule would be perfect, would that have to be implemented on the router? Or, is there a way I could do it on server. I was hoping for something I could do on the dev boxes directly, since I "own" those, but I'd need IT support to change a router. I have access to Linux and Solaris dev boxes if you have suggestions for implementing a firewall rule.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

寄居者 2024-09-01 08:11:11

这是我如何解释你的问题。

您有两台服务器和一台由两台服务器之一管理的设备。两台服务器都会尝试管理该设备,但您希望阻止第二台服务器与其通信。

在第二台服务器(假设是 Linux)上,我将运行

iptables -A OUTPUT --dst <dst of your device> -j DROP

此命令,这将丢弃该服务器上发往该设备的所有出站流量。

Here is how I interpreted your question.

You have two servers, and a device which is managed by ONE of the two servers. Both servers will TRY to manage the device, but you want to prevent the second one from being able to communicate to it.

On the second server (assuming linux) I would run

iptables -A OUTPUT --dst <dst of your device> -j DROP

this will drop any outbound traffic on that server destined for the device.

水波映月 2024-09-01 08:11:11

如果您不能/不会拔掉服务器的插头,请添加一条防火墙规则来丢弃来自该服务器的所有传入流量。

If you can't/won't unplug the server, add a firewall rule that drops all incoming traffic from that server.

自演自醉 2024-09-01 08:11:11

如果我理解正确的话,您希望其中一台服务器不响应?简单的方法就是关闭它(服务器)。

If I understand correctly, you want one of the servers to not respond? The simple way is to just turn it (the server) off.

清秋悲枫 2024-09-01 08:11:11

听起来您想模拟应用程序没有响应。如果是这样,什么样的应用程序?如果它是类似 PHP 的东西,那么 sleep 语句就是你的朋友。如果它休眠 600 秒,那么看起来很像服务器过载。任意服务的另一个选项是 netcat。要让您的服务器侦听端口 12345 但从不响应,请使用类似以下内容:

    nc -l -p 12345

或者您可以 cat 一个文件作为初始响应来模拟仅响应一次然后变得愚蠢的服务:

    echo -e "220 somehost.com ESMTP Postfix\n\r" | nc -q 1 -l -p 25

it sounds like you want to simulate the application not responding. If so, what kind of app? If it is something like PHP then a sleep statement is your friend. If it sleeps for 600 seconds then that looks a lot like an overloaded server. Another option for arbitrary services is netcat. To have your server listen on port 12345 but never respond, use something like this:

    nc -l -p 12345

or you can cat a file as the initial response to simulate a service that only responds once and then goes stupid:

    echo -e "220 somehost.com ESMTP Postfix\n\r" | nc -q 1 -l -p 25
夕色琉璃 2024-09-01 08:11:11

有多种选择:

  • 拔掉服务器插头。
  • 重新启动服务器。这会将其从网络上删除一分钟左右。
  • 完全关闭服务器。
  • 用硬物击打它

There are several options:

  • Unplug the server.
  • Reboot the server. That'll take it off the net for a minute or so.
  • Shut the server down completely.
  • Hit it with something hard
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文