Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Enable and disable Airport from the command line Network
If for some reason you want to turn off your Airport Extreme Card from the command line, simply type:

sudo ifconfig en1 down
Where en1 is the interface for your Airport Extreme Card. en0 is usually Ethernet, and en1 is usually the Airport Extrewme card. To bring it back up, just type:

sudo ifconfig en1 up
Enjoy!
    •    
  • Currently 2.75 / 5
  You rated: 1 / 5 (8 votes cast)
 
[39,737 views]  

Enable and disable Airport from the command line | 7 comments | Create New Account
Click here to return to the 'Enable and disable Airport from the command line' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Enable and disable Airport from the command line
Authored by: mrandre on Dec 12, '03 01:03:42PM

Is there a way to do this with the modem? I have an iMac which I use as an airport software base station, and it connects via dial up. From time to time, the connection dies. When it does, I'd love to be able to tunnel in via ssh, and reactivate the connection.



[ Reply to This | # ]
Enable and disable Airport from the command line
Authored by: Whosawhatsis on Dec 14, '03 02:10:23AM

The same commands should work with modem. The problem is, once the modem is re-enabled (you may or may not need to disable and enable it), you need to make it dial again. Since I use my dialup modem an average of once a year, I haven't bothered to find out how to do this from the command line, but I'd be shocked if there wasn't a way to do it. It's unix! there has to be a way...



[ Reply to This | # ]
Enable and disable Airport from the command line
Authored by: Anonymous on Dec 14, '03 05:25:04PM
Two notes.

First, this command works fine for an Airport card, as well. It is not just limited to Airport Extreme cards, as the hint somewhat implies.

Second, this command does not work correctly on the modem. System Profiler shows the interface for the modem as being named 'modem.' However, try that, and you get:

ifconfig: interface modem does not exist

On my system, at least, sudo ifconfig -l shows:

lo0 gif0 stf0 en0 en1 fw0

Perhaps the modem corresponds to one of these interfaces?

[ Reply to This | # ]

Enable and disable Airport from the command line
Authored by: parakleta on Jan 09, '04 03:58:38AM

This seems to work fine if the Airport connection was initially active, but it doesn't seem to do the full initialisation necessary.

I was also wondering if anyone knew how to bring up ppp links via the command line. OS X doesn't seem to have the ppp command I'm familiar with in other BSD systems.

Essentially what I want to do is setup my system to bring up the PPPoE DSL link on boot and share it to the airport connection. I have the ipfw and ipnat stuff all sorted out, just not how to get the interfaces up.



[ Reply to This | # ]
Enable and disable Airport from the command line
Authored by: technbio on Oct 31, '04 04:34:16PM

About the terminal line code ..could i use that line to use an external card..the problem i've got i've got a powerbook G4 with internal airport card..in one hotel i'm going occasionnaly they give you a "code" wireless card..(I think because i'm unabl to get it and the guy told me i need "their' wireless card)...it is a PC OS (They give you a software with it) i waswondering if i could use that code line witt success to get wireless connection at that place..Thanks



[ Reply to This | # ]
Enable and disable Airport from the command line
Authored by: kckal on Jun 25, '09 08:35:22AM

...this is out of date
--------------------------------->
this works on leopard:
networksetup -setairportpower off
networksetup -setairportpower on



[ Reply to This | # ]
Enable and disable Airport from the command line
Authored by: dagnew on May 19, '11 10:50:38AM

Disabling Airport from Terminal is exactly what I need as I have a bunch of G4 iBooks that kernel panic upon login unless booted in safe mode. But in safe mode Airport IS off (part of why I suspect it's causing the KPs) - so I can't use System Preferences to 'turn it off'. And when I use this command line hint, I get "interface en1 does not exist".

In System Preferences, I CAN delete the Airport configuration - but that's an 'undoable' action & I'm not sure it's wise. Any suggestions?



[ Reply to This | # ]