测试损坏的 IP
我正在尝试测试一个应用程序,我需要使一个有效的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
这是我如何解释你的问题。
您有两台服务器和一台由两台服务器之一管理的设备。两台服务器都会尝试管理该设备,但您希望阻止第二台服务器与其通信。
在第二台服务器(假设是 Linux)上,我将运行
此命令,这将丢弃该服务器上发往该设备的所有出站流量。
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
this will drop any outbound traffic on that server destined for the device.
如果您不能/不会拔掉服务器的插头,请添加一条防火墙规则来丢弃来自该服务器的所有传入流量。
If you can't/won't unplug the server, add a firewall rule that drops all incoming traffic from that server.
如果我理解正确的话,您希望其中一台服务器不响应?简单的方法就是关闭它(服务器)。
If I understand correctly, you want one of the servers to not respond? The simple way is to just turn it (the server) off.
听起来您想模拟应用程序没有响应。如果是这样,什么样的应用程序?如果它是类似 PHP 的东西,那么 sleep 语句就是你的朋友。如果它休眠 600 秒,那么看起来很像服务器过载。任意服务的另一个选项是 netcat。要让您的服务器侦听端口 12345 但从不响应,请使用类似以下内容:
或者您可以 cat 一个文件作为初始响应来模拟仅响应一次然后变得愚蠢的服务:
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:
or you can cat a file as the initial response to simulate a service that only responds once and then goes stupid:
有多种选择:
There are several options: