您的位置:首页 > 其它

[Non-original]OS X How do I unset an IP address set with ifconfig?

2013-12-05 15:15 357 查看
I recently used
ifconfig en1 1.2.3.4
to set the IP address of a network interface (specifically, the wireless card) on a Mac… How can I remove/unset it?

Using the graphical network configuration tool doesn't seem to change (or even be aware of) this address - when I use it to manually set an address, a second address is added to the device.

For example, right now
ifconfig
shows:

en1: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
ether 00:23:xx:xx:xx:xx
inet 192.168.141.99 netmask 0xffffff00 broadcast 192.168.141.255
inet 192.168.1.112 netmask 0xffffff00 broadcast 192.168.1.255
media: autoselect
status: active

The first address -
141.99
- is the address I manually set. The second address —
1.112
— is the address assigned by my network's DHCP server.

Use
delete
:

ifconfig en1 delete 192.168.141.99

Sounds like you are looking to change the device en1 from 'static' to 'dhcp'. To do this perform the following:

sudo ifconfig en1 BOOTP
sudo ifconfig en1 DHCP

After making the config changes you will need to bring that interface down and back up:

sudo ifconfig en1 down
sudo ifconfig en1 up

origina:
http://apple.stackexchange.com/questions/25895/how-do-i-unset-an-ip-address-set-with-ifconfig

[/code]
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: