- Выпустите и обновите dhcp из командной строки с помощью ipconfig на Mac 2021
- ifconfig mac
- Как продлить аренду DHCP из командной строки Mac
- Release & Renew DHCP from the Command Line with ipconfig on Mac
- How to Renew DHCP Lease from Command Line of Mac
- Как обновить IP-адрес на компьютере (Windows XP, Vista, 7, 8, 10, Mac)?
- How to Renew a DHCP Lease in Mac OS X
- Renew DHCP Lease from OS X System Preferences
- Renewing a DHCP Lease from the Command Line
Выпустите и обновите dhcp из командной строки с помощью ipconfig на Mac 2021
ifconfig mac
Если вам нужно освободить и обновить DHCP из командной строки на Mac, полезная утилита ipconfig сможет сделать это быстро. Имейте в виду, что для большинства пользователей Mac OS X обновление аренды DHCP из системных настроек Mac является наилучшим подходом, поскольку он удобен для пользователя и столь же эффективен, но подход «Терминал» имеет преимущества для опытных пользователей и может быть запущен через SSH и однопользовательский режим, что делает это полезным опытом.
Как продлить аренду DHCP из командной строки Mac
Основной синтаксис для обновления аренды DHCP из командной строки с помощью ipconfig выглядит следующим образом:
sudo ipconfig set (DEVICEINTERFACE) DHCP
Если вам известен интерфейс устройства (en0, en1, en2 и т. Д.), Просто запустите эту команду, чтобы освободить, а затем обновите DHCP для определенного устройства. Допустим, это стандарт en0, стандартный для современных компьютеров Mac только с Wi-Fi.
sudo ipconfig set en0 DHCP
После запуска команды вы можете проверить правильность установки DHCP, определив информацию DHCP с помощью той же команды ipconfig с ‘getpacket’, например, так:
ipconfig getpacket en0
Предполагая, что предыдущая команда set была успешной, getpacket вернет назначенный DHCP IP, DNS-сервер, маску подсети, маршрутизатор / шлюз и время аренды. Если информация DHCP возвращается пустой, значит, запрашиваемый интерфейс был неправильным, или аренда DHCP не обновлялась или не распространялась должным образом.
Другим грубым вариантом будет запуск ipconfig для всех доступных интерфейсов устройств на Mac путем объединения синтаксиса следующим образом:
sudo ipconfig set en0 DHCP && sudo ipconfig set en1 DHCP
Однако лучше установить DHCP для конкретного интерфейса.
Если вы не знаете интерфейс, то первым шагом является определение интерфейса аппаратного устройства компьютера, используемого для конкретного сетевого порта, который вы используете. Для большинства современных компьютеров Mac мы ищем Wi-Fi, который обычно работает на en0, но многие пользователи Mac используют Ethernet, персональную точку доступа iPhone, привязанный телефон Android или внешнюю карту NIC, каждая из которых может иметь различный интерфейс устройства в зависимости от оборудования. Вы можете легко определить интерфейс устройства, запустив networksetup -listallhardwareports следующим образом:
Прокрутите выходные данные, чтобы найти интерфейс, для которого вы хотите установить и обновить DHCP, предположим, что вы ищете «Wi-Fi», который может выглядеть так:
Hardware Port: Wi-Fi
Device: en0
Ethernet Address: b1:3f:22:dd:ab:19
Рядом с «Device» вы найдете интерфейс, в данном случае это «en0», который подключается к вышеупомянутой команде ipconfig.
Источник
Release & Renew DHCP from the Command Line with ipconfig on Mac
If you need to release and renew DHCP from the command line on a Mac, the helpful ipconfig utility is able to do so quickly. Do keep in mind that for most Mac OS X users, renewing a DHCP lease from the Mac System Preferences is the best approach because it’s user friendly and just as effective, but the Terminal approach has benefits to advanced users and is able to be run through ssh and single user mode, making this a worthwhile bit of knowledge to share.
How to Renew DHCP Lease from Command Line of Mac
The basic syntax to renew DHCP lease from the command line with ipconfig is as follows:
sudo ipconfig set (DEVICEINTERFACE) DHCP
If you know the device interface (en0, en1, en2, etc), just run that command to release and then renew DHCP for the determined device. Let’s say it’s en0, standard for modern Macs with wi-fi only.
sudo ipconfig set en0 DHCP
Once the command is run you can check if DHCP has set properly by determining DHCP info with the same ipconfig command with ‘getpacket’ like so:
ipconfig getpacket en0
Assuming the prior ‘set’ command was successful, getpacket will return the DHCP assigned IP, DNS server, subnet mask, router / gateway, and the lease time. If the DHCP info returns blank, then either the interface queried was wrong, or the DHCP lease did not renew or distribute properly.
Another crude option would be to run ipconfig for all available device interfaces on the Mac by stringing the syntax together like so:
sudo ipconfig set en0 DHCP && sudo ipconfig set en1 DHCP
It’s best to set DHCP for the specific interface, however.
If you don’t know the interface, then the first step is to determine the computers hardware device interface used for the particular networking port you’re using. For most modern Macs, we’re looking for wi-fi which is typically on en0, but many Mac users use ethernet, an iPhone personal hotspot, a tethered Android phone, or an external NIC card as well, each of which may have a different device interface depending on the hardware. You can easily determine what the device interface is by running networksetup -listallhardwareports like so:
Scroll through the output to find the interface you want to set and renew DHCP for, let’s assume you’re looking for “Wi-Fi” which may look like this:
Hardware Port: Wi-Fi
Device: en0
Ethernet Address: b1:3f:22:dd:ab:19
Alongside ‘Device’ you’ll find the interface, in this case it’s “en0”, which is what gets plugged into the aforementioned ipconfig command.
Источник
Как обновить IP-адрес на компьютере (Windows XP, Vista, 7, 8, 10, Mac)?
Если на компьютере настроено автоматическое получение IP‑адреса, иногда (например, после смены IP‑адреса шлюза сети (роутера), для доступа к роутеру может потребоваться обновить IP‑адрес компьютера.
Выберите операционную систему компьютера.
Нажмите Пуск > Выполнить, введите cmd и нажмите Enter.
Введите ipconfig /release в открывшемся окне и нажмите Enter. Эта команда освободит IP‑адрес на вашем компьютере.
Введите ipconfig /renew в том же окне, нажмите Enter и немного подождите. DHCP‑сервер присвоит компьютеру новый IP‑адрес.
Нажмите Пуск на панели задач, введите в окне поиска cmd и нажмите Enter.
Введите ipconfig /release в открывшемся окне и нажмите Enter. Эта команда освободит IP‑адрес на вашем компьютере.
Введите ipconfig /renew в том же окне, нажмите Enter и немного подождите. DHCP-сервер присвоит компьютеру новый IP‑адрес.
Для Windows 8, Windows 8.1 и Windows 10
Нажмите клавишу Windows и клавишу X на клавиатуре одновременно. Затем нажмите Командная строка.
Введите ipconfig /release в открывшемся окне и нажмите Enter. Эта команда освободит IP‑адрес на вашем компьютере.
Введите ipconfig /renew в том же окне, нажмите Enter и немного подождите. DHCP-сервер присвоит компьютеру новый IP‑адрес.
Нажмите кнопку с иконкой APPLE (яблоко) и зайдите в Системные настройки.
Нажмите Wi—Fi или Ethernet (в зависимости от того, каким образом компьютер подключён к роутеру) в левой части окна, затем нажмите Дополнительно в правом нижнем углу.
Выберите вкладку TCP/IP сверху. По умолчанию, если в строке Конфигурировать IPv4 установлено Используя DHCP, вы увидите кнопку Запросить адрес DHCP. Нажмите на неё, чтобы обновить IP‑адрес.
Чтобы получить подробную информацию о каждой функции и настройке оборудования, перейдите на страницу Загрузки для загрузки руководства пользователя к своей модели устройства.
Источник
How to Renew a DHCP Lease in Mac OS X
DHCP stands for Dynamic Host Configuration Protocol, and is commonly used to configure network devices so they can communicate with one another. Typically you’ll have a DHCP server (like a wireless router), and client machines on the local network (like a Mac, iPhone, PC, etc) that pull a dynamically assigned local IP address from that server.
This is all well and good and usually functions just fine, but sometimes you need to renew a DHCP lease, which basically means you’ll be retrieving a new IP address and routing data from the DHCP server. This is a common trick for troubleshooting network issues, and can be helpful when resolving problems with internet connectivity when a wi-fi connection has been determined to be stable, or when a machine on the network can’t access the outside world after power-cycling a broadband modem or router.
Renew DHCP Lease from OS X System Preferences
This is the easiest way to renew a DHCP lease from Mac OS X:
- Pull down the Apple menu and choose “System Preferences”
Often renewing a DHCP lease means the Mac will end up with a different local IP address than it had before, though sometimes you will end up with the same one. If the reason you are renewing DHCP is to try and get a new IP address but the router continues to stubbornly assign the same LAN IP over and over again, consider setting a static IP instead by configuring DHCP with manual addresses.
Another approach, though more advanced, is to renew DHCP by way of the command line. This is typically best used by advanced users, but it can also be helpful for remote troubleshooting if you can only SSH into a remote Mac and something like Screen Sharing is not available to you. The other obvious advantage with a command line approach is possibility of using the lease renewal in a script or as part of an automated task within cron.
Renewing a DHCP Lease from the Command Line
There are two different ways to renew the DHCP lease from the OS X command line. The first approach uses the ever useful ipconfig tool:
sudo ipconfig set en0 DHCP
When using ipconfig, be sure to use the proper interface address otherwise you may run into other problems, or find nothing changes at all. You can retrieve interface data by using ipconfig to pull current DHCP information like so:
ipconfig getpacket en1
Ran successfully, you will find DHCP server information, client IP, lease time, the subnet mask, router IP, and DNS servers, the tail of the command should look something like this:
If running that command returns nothing, then you are looking at the wrong interface. Typically en0 is the default wi-fi interface on MacBook Air and newer MacBook Pro models, but it is often en1 on Macs with physical ethernet ports.
The ipconfig method will interrupt the current network connection, whereas resetting through Network Preferences does not. You can refresh DHCP without interruption from the command line by using the following scutil command provided by a MacWorld user:
echo «add State:/Network/Interface/en0/RefreshConfiguration temporary» | sudo scutil
You can verify the changes took place by using the aforementioned ipconfig command again:
ipconfig getpacket en0
Again, be sure to use the appropriate network interface for your hardware: en1 or en0.
Each method outlined here will work in virtually every version of Mac OS X, from the old versions to the new.
Finally, if you’re troubleshooting network wide issues on all devices on a LAN, you can also renew a DHCP lease from iOS and get new local IP addresses on iPhones, iPods, and iPads.
Источник