Disable Your Network Connections 1

Terminal

Share
Disable Your Network Connections

Hey

A while ago I mentioned Freedom, the application to stop your network connections so you can get on with more work done. Well, I have been doing a lot of digging and found the Terminal command that does the entire step for you. Its obviously more manual but it gives you an insight into how ifconfig, the tool used, works.

As mentioned, the tool uses ifconfig. This is the Terminal command to configure and setup the settings for you network cards. If you pop open Terminal and type ifconfig, it will list loads of information about your network cards such a MAC addresses, duplexing and a whole range of other things I have no idea about.

To disable you network connection you can use the “down” command that takes down the network card. It is initiated with the following command.

sudo ifconfig en0 down

Sudo and the admin password is needed since its a high level system command. Ifconfig is the command we are using, en0 is the network interface command that we are talking to. After a couple of seconds it will kill the interface card and kill not be used. There is no output message it will just kill the network card.


Most computers now have more than one network card, eg ethernet and wireless. So if you really want to kill any network connections you need to know what there names are. Again, if you type ifconfig it will display the information regarding your network. If I draw your attention to the left hand side of the list it should display something like: en0: flags=…. This is the name of the network card (en0) that it is addressed at. For example I have lo0, en0, en1, fw0 plus others. Most of the time you only need to display the en versions, I think these stand for ethernet. If you want to find out exactly which ones are being used I suggest using one of the iSlayer programs, these clearly show the network you are running off.

You only need to disable en0 and upwards, if you are on standard network connections and not anything funky like firewire. If you disable ln0, your loopback address, you could really screw your system, since quite a few programs use the loop back address to communicate with itself and other programs. If you disable this programs will probably crash.

If you want to re-enable your network cards and communicate with the world once again, its simple. Just type:

sudo ifconfig en0 up

This brings it back to life. Repeat for the addresses you want to bring back up again.

This tool is actually designed to stop network cards communicating for testing and network analysis. But it is always useful if you want a bit of piece, but still use you computer. Optionally a far easier method would be to plug the cable out of the wall, but that is far to boring and has no chance of screwing with root system settings that can effect your whole computer. Have fun.

If you want to take your skills with Terminal a bit further I recommend you check out the Terminal Category on this site. If you fancy reading a book there is a couple on Amazon that I regularly see mentioned and recommend, O’reilly Unix Geeks and Unix Under the Hood both are designed for Mac OS X and take Terminal further.


If you want to keep up with the latests post from Mac Tricks And Tips I recommend you subscribe to the RSS Feed.

Where To Next?

  • Subscribe To Mac Tricks And Tips