Configure ipfw to filter by ip range
Although you seem fine handling the command line, on OS X it is best to use the Server Admin Tools (like @lupincho suggested). But how can you use the Server Admin Tools GUI when you only have terminal acces?

You can run the Server Admin Tools app from another mac, this will allow you to login on a remote server and change it's settings.
If you do not have a spare mac with the Server Admin Tools installed, you can do the following:


SSH into your remote OS X machine with an administrator’s log in and password.
Enable Remote Desktop (a.k.a. Screen Sharing, a.k.a. VNC) with this command:



  sudo
  /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart
  -activate -configure -access -on -clientopts -setvnclegacy -vnclegacy yes -clientopts -setvncpw -vncpw mypasswd -restart -agent -privs -all


3) Login using a VNC client (such as TightVNC). Your password is "mypasswd" (see the -vncpw flag in the above command;  you can — and should — change this).

Now you can open the Server Admin Tools and do your thing.

4) When you are done, turn of screen sharing using your SSH session:


  sudo
  /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart
  -deactivate -configure -access -off