set ip address mac command line
The quickest way to set your IP address from the command line is to issue the following command in the Terminal:
sudo ipconfig set en1 DHCP
This will renew your DHCP lease and you will be issued a new IP address from the DHCP server. FYI: en1 is generally wireless/airport, en0 is generally ethernet.

You can check that the IP is set by getting your current IP address from the command line with:
ipconfig getifaddr en1
Doing this before and after will insure you have a new IP.

You can specify an IP address to set via the command line with the following:
sudo ipconfig set en1 INFORM 192.168.0.150

You can also get a new IP address from a DHCP server by bringing down the interface and starting it back up again:
sudo ifconfig en1 down ; sudo ifconfig en1 up

Note: for whatever reason, when you are setting the IP address manually via the command line the Mac OS X Network Preferences doesn’t necessarily catch up to the changes. Do not be surprised if the Network preference pane is telling you that you “Airport does not have an IP address and cannot connect to the Internet.” when in fact, you do have one and you are online. You can verify that you are connected to the LAN or internet by using the ping command.

Related Posts with Thumbnails
Tagged with:  

Comments are closed.

WordPress Blog