Преобразуйте ip в long, а затем просто делите модуль на
switch(addrToNum("ip address")%3)
{
case 0:
break;
case 1:
break;
case 2:
break;
}
, и вот преобразование ip в число
public long addrToNum(IPAddress Address)
{
byte[] b = BitConverter.GetBytes(Address.Address);
if (b.Length == 8)
return (long)(((long)16777216 * b[0]) + ((long)(65536 * b[1])) + ((long)(256 * b[2])) + b[3]);
else
return 0;
}