views:

77

answers:

5

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.

Any suggestions?

Edit:

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.

Thanks

A: 

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 (see http://www.youtube.com/watch?v=8Yr-Pp4PFVA for inspiration)
hanno
A: 

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

Chris Lively
+1  A: 

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

Thomas
... or alternatively a firewall rule on the test server that drops the traffic to the destination, if you don't have access to the target server.
Chris Lercher
Can you point me to some advice on how to set up a firewall rules on a Solaris / Linux server?
Wes Reing
On Solaris, no. On Linux, this goes through iptables. There are several programs (frontends) to make this less painful. I have used Shorewall in the past, but ufw also looks very nice.
Thomas
Thanks! That's just what I needed. I'll check those out.
Wes Reing
A: 

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
Mark Porter
+1  A: 

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.

jdizzle
This is exactly what I need. I'll give it a shot. Thanks,
Wes Reing