Reputation: 118
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.
Upvotes: 0
Views: 214
Reputation: 6513
There are several options:
Upvotes: 0
Reputation: 4164
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.
Upvotes: 1
Reputation: 1630
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
Upvotes: 0
Reputation: 182093
If you can't/won't unplug the server, add a firewall rule that drops all incoming traffic from that server.
Upvotes: 1
Reputation: 88092
If I understand correctly, you want one of the servers to not respond? The simple way is to just turn it (the server) off.
Upvotes: 0