Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Mac OS X > Closing connections to an IP using OS X Firewall

Closing connections to an IP using OS X Firewall
Thread Tools
Professional Poster
Join Date: Jul 2003
Location: Canada
Status: Offline
Reply With Quote
Apr 19, 2004, 10:58 AM
 
How do I use the firewall to block connections to certain IP addresses?
I see I can block ports, but not a particular IP.
thanks
     
Mac Elite
Join Date: Dec 2001
Location: Atlanta, GA, USA
Status: Offline
Reply With Quote
Apr 19, 2004, 12:23 PM
 
Originally posted by brapper:
How do I use the firewall to block connections to certain IP addresses?
I see I can block ports, but not a particular IP.
thanks
Something like:

Code:
ipfw add 98 deny tcp from 167.205.21.60 to any
for incoming and

Code:
ipfw add 99 deny tcp from any to 167.205.21.60
for outgoing. Not tested, but that should work.
Mac Pro 2x 2.66 GHz Dual core, Apple TV 160GB, two Windows XP PCs
     
brapper  (op)
Professional Poster
Join Date: Jul 2003
Location: Canada
Status: Offline
Reply With Quote
Apr 19, 2004, 12:30 PM
 
Originally posted by Arkham_c:
Something like:
Code:
ipfw add 99 deny tcp from any to 167.205.21.60
for outgoing. Not tested, but that should work.
Thanks for the quick reply Arkham,
I am trying block outgoing connections so I tried the second code you listed and inserted the ip address i wanted to block, but im getting "ipfw: socket: operation not permitted.
Any ideas?
     
brapper  (op)
Professional Poster
Join Date: Jul 2003
Location: Canada
Status: Offline
Reply With Quote
Apr 19, 2004, 12:46 PM
 
alright, I typed sudo before the code you gave me this time (i'm clueless in unix.) It prompted me for my password, i gave it my administrator's password and it then said "00099 deny tcp from any to xxx.xx.xxx.xxx"
does that mean mission accomplished?
If so, will the settings remain after a restart or will i have to enter that every time i need it?

thanks again.
     
Clinically Insane
Join Date: Nov 1999
Status: Offline
Reply With Quote
Apr 19, 2004, 01:24 PM
 
Originally posted by brapper:
alright, I typed sudo before the code you gave me this time (i'm clueless in unix.) It prompted me for my password, i gave it my administrator's password and it then said "00099 deny tcp from any to xxx.xx.xxx.xxx"
does that mean mission accomplished?
If so, will the settings remain after a restart or will i have to enter that every time i need it?
Mission accomplished, but it won't persist across restarts.

Apple's built-in firewall is quite powerful, but the interface they provide barely scratches the surface of what it can do. For something more powerful, I'd suggest Brian Hill's excellent BrickHouse.
You are in Soviet Russia. It is dark. Grue is likely to be eaten by YOU!
     
Mac Elite
Join Date: Dec 2001
Location: Atlanta, GA, USA
Status: Offline
Reply With Quote
Apr 19, 2004, 02:51 PM
 
BTW, If you type:

Code:
sudo ipfw list
It will list all the ipfw rules currently in place.

You can make your rules persist by creating a StartupItem and putting them in it. If you want to go down that road, here is a link to some documentation on how to do that:

http://developer.apple.com/documenta...rtupItems.html
Mac Pro 2x 2.66 GHz Dual core, Apple TV 160GB, two Windows XP PCs
     
brapper  (op)
Professional Poster
Join Date: Jul 2003
Location: Canada
Status: Offline
Reply With Quote
Apr 19, 2004, 02:55 PM
 
Thanks guys. SO helpful.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 09:29 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2