- How to Create an Ad Hoc Network
- What to Know
- Set Up an Ad Hoc Network on Windows 10 and 8.1
- Windows 7, and Vista
- Ad-hoc networking
- Requirements
- Wifi link layer
- Manual method
- wpa_supplicant
- Network configuration
- Tips and tricks
- Using NetworkManager
- Custom systemd service (with wpa_supplicant and static IP)
- See also
- Что такое Ad Hoc в Wi-Fi сети, для чего нужен и как настроить на Windows 10, 7 и XP?
- Принцип работы Ad hoc
- Windows 10
- Windows 7
- Windows XP
- Ad-Hoc Wireless Network Setup
- What to Know
- What is Ad-Hoc Mode in Wi-Fi?
- How to Set Up an Ad-Hoc Network on Windows
- Windows 10 and Windows 8
- Windows 7
How to Create an Ad Hoc Network
Former Lifewire writer Melanie Uy has 5+ years’ experience writing about consumer-oriented technology and is an expert telecommuter.
- The Wireless Connection
- Routers & Firewalls
- Network Hubs
- ISP
- Broadband
- Ethernet
- Installing & Upgrading
- Wi-Fi & Wireless
What to Know
- In Command Prompt, select Run as Administrator. Enter the commands below. In Network and Sharing Center, choose an adapter.
- Go to Properties >Sharing. Enable other users to connect. Choose an interface from the ad hoc network. Verify through the other interface.
- Windows 7/Vista: In Network and Sharing Center, select Set up a connection or network >Set up a new network. Follow instructions.
Ad hoc wireless networks, or computer-to-computer wireless networks, are useful for internet connection sharing and other direct wireless networking without a router. Learn how to set up a Wi-Fi network to connect two or more computers using Windows 10, Windows 8.1, Windows 7, and Windows Vista.
Set Up an Ad Hoc Network on Windows 10 and 8.1
Windows 10 doesn’t have a proper ad hoc network feature. You can, however, create something that looks and behaves like the ad hoc network feature on previous versions of Windows.
Before setting up an ad hoc network on Windows 10 and 8.1, you’ll need Windows and client computers with wireless network adapters.
- Go to the Windows desktop search and enter Command Prompt.
Right-click the Command Prompt result, then select Run as Administrator.
netsh wlan set hostednetwork mode=allow ssid=AdHocNetwork key=yourpassword
netsh wlan start hostednetwork
In the Control Panel, select Network and Internet.
Select Network and Sharing Center.
Select Change adapter settings.
Select the Allow other network users to connect through this computer’s Internet connection check box. Then, select the Home networking connection drop-down arrow and choose the interface from the ad hoc network.
Return to the Network and Sharing Center to verify that the ad hoc network is connected to the internet through the other interface.
Windows 7, and Vista
To create an ad hoc network in older versions of Windows:
- Select Start >Control Panel >Network and Internet to go to the Network and Sharing Center.
Ad-hoc networking
An IBSS (Independent Basic Service Set) network, often called an ad-hoc network, is a way to have a group of devices talk to each other wirelessly, without a central controller. It is an example of a peer-to-peer network, in which all devices talk directly to each other, with no inherent relaying.
For example, ad-hoc networking may be used to share an internet connection.
Requirements
Wifi link layer
Since IBSS network is a peer-to-peer network, the steps necessary to set up the wifi link layer should be the same on all devices.
Tip: It is possible to create complex network topologies, see Linux Wireless documentation for advanced examples.
Manual method
Warning: This method creates unencrypted ad-hoc network. See #wpa_supplicant for method using WPA encryption.
See Wireless network configuration#iw for a better explanation of the following commands. Make sure that iw is installed.
Set the operation mode to ibss:
# iw interface set type ibss
Bring the interface up (an additional step like rfkill unblock wifi might be needed):
# ip link set interface up
Now you can create an ad-hoc network. Replace your_ssid with the name of the network and frequency with the frequency in MHz, depending on which channel you want to use. See the Wikipedia page List of WLAN channels for a table showing frequencies of individual channels.
# iw interface ibss join your_ssid frequency
wpa_supplicant
Ensure that wpa_supplicant is installed, and create a configuration file for it (see wpa_supplicant for details).
/etc/wpa_supplicant-adhoc.conf
ctrl_interface=DIR=/run/wpa_supplicant GROUP=wheel # use ‘ap_scan=2’ on all devices connected to the network # this is unnecessary if you only want the network to be created when no other networks are available ap_scan=2 network=
Run wpa_supplicant on all devices connected to the network with the following command:
# wpa_supplicant -B -i interface -c /etc/wpa_supplicant-adhoc.conf -D nl80211,wext
Network configuration
The final step is to assign an IP address to all devices in the network. There are multiple ways to do this:
- Assign static IP addresses. See Network configuration#Static IP address for details.
- Running DHCP server on one device. See dhcpd or dnsmasq for details.
- Running avahi-autoipd. See Avahi#Obtaining IPv4LL IP address for details.
If you want to share an internet connection to the ad-hoc network, see Internet sharing.
Tips and tricks
Using NetworkManager
If you use NetworkManager, you can use nm-applet for ad-hoc network configuration instead of the manual method described above. See NetworkManager#Sharing internet connection over Wi-Fi for details.
Custom systemd service (with wpa_supplicant and static IP)
You can use the following templates to enable wireless ad-hoc networking:
/etc/conf.d/network-wireless-adhoc@interface
/etc/systemd/system/network-wireless-adhoc@.service
[Unit] Description=Ad-hoc wireless network connectivity (%i) Wants=network.target Before=network.target BindsTo=sys-subsystem-net-devices-%i.device After=sys-subsystem-net-devices-%i.device [Service] Type=oneshot RemainAfterExit=yes EnvironmentFile=/etc/conf.d/network-wireless-adhoc@%i # perhaps rfkill is not needed for you ExecStart=/usr/bin/rfkill unblock wifi ExecStart=/usr/bin/ip link set %i up ExecStart=/usr/bin/wpa_supplicant -B -i %i -D nl80211,wext -c /etc/wpa_supplicant-adhoc.conf ExecStart=/usr/bin/ip addr add $/$ dev %i ExecStop=/usr/bin/ip addr flush dev %i ExecStop=/usr/bin/ip link set %i down [Install] WantedBy=multi-user.target
See also
Что такое Ad Hoc в Wi-Fi сети, для чего нужен и как настроить на Windows 10, 7 и XP?
Всем привет! Ad hoc – это режим беспроводной сети, которая не имеет постоянной структуры и строится «на лету», благодаря сопряжению пары устройств. Такой режим еще называют IBSS (Independent Basic Service Set) или P2P «точка-точка». Чтобы его реализовать, достаточно, чтобы оба устройства были снабжены Wi-Fi адаптерами, а в операционной системе, через которую с ними можно взаимодействовать, были установлены драйвера.
Принцип работы Ad hoc
Для режима Ad Hoc необходимо минимум оборудования. Главное, чтобы каждая станция была наделена WiFi–адаптером. Создавать какую-либо сеть при этом не нужно.
Данный режим подразумевает участие каждого узла в маршрутизации с помощью транзита данных для прочих узлов. Узнать, какие узлы пересылают информацию, можно основываясь на используемый алгоритм маршрутизации. Ad Hoc обычно реализуют для создания временных сетей. Например, когда нужно связать ПК с внешним Wi-Fi адаптером, и ноутбук (с внутренним беспроводным модулем).
Как подключить? Все зависит от того, какая версия Windows установлена на вашем компьютере. Отчет начнем с самой современной – Windows 10.
Windows 10
Чтобы создать сопряжение между двумя устройствами, на одном из них нужно создать Wi-Fi, а на втором к ней присоединиться.
- В правом нижнем углу экрана нажмите на «Панель уведомлений».
- Нажмите на иконку «Мобильный Хот-спот».
На другом устройстве запустите Wi-Fi поиск и подключитесь к только что созданной точке. Готово, P2P настроен.
Windows 7
В семерке настройка займет немного больше времени:
control.exe /name Microsoft.NetworkandSharingCenter
Затем с другого устройства включите поиск Wi-Fi сети и присоединитесь к этой точке.
Windows XP
Такой способ можно реализовать и на Виндовс XP:
- Нажмите + R и введите: ncpa.cpl.
- Кликните ПКМ по иконке беспроводной сети и зайдите в «Свойства».
- Присвойте сети IP-адрес и кликните на строку ниже, для автоматического подтягивания макси подсети.
Теперь на втором компьютере:
- Зайдите в окно через команду «WIN+R=cpl», и кликнув ПКМ по беспроводному подключению выберите «Просмотр доступных Wi-Fi сетей».
- Вручную введите IP-адрес для беспроводного сетевого соединения, прописав его так, чтобы оба компьютера были в одной локальной сети (отличались только последние цифры из пула).
Готово, коннект Peer-to-Peer завершен и настроен.
Ad-Hoc Wireless Network Setup
An MIT graduate who brings years of technical experience to articles on SEO, computers, and wireless networking.
Jerrick Leger is a CompTIA-certified IT Specialist with more than 10 years’ experience in technical support and IT fields. He is also a systems administrator for an IT firm in Texas serving small businesses.
- Wi-Fi & Wireless
- The Wireless Connection
- Routers & Firewalls
- Network Hubs
- ISP
- Broadband
- Ethernet
- Installing & Upgrading
What to Know
- In Windows 10 or 8, enter netsh wlan set hostednetwork mode=allow ssid=networkname key=password in Command Prompt.
- Replace networkname with your network name and password with the password for the wireless network and press Enter.
- Enter netsh wlan start hostednetwork to start the hosted network.
This article explains what a Wi-Fi network in ad-hoc mode does and how to set up an ad-hoc network on Windows 10, 8, and 7.
What is Ad-Hoc Mode in Wi-Fi?
A Wi-Fi network in ad-hoc mode (also called computer-to-computer or peer mode) lets two or more devices communicate directly instead of through a central wireless router or access point (which is what infrastructure mode does).
Setting up an ad-hoc network is useful if there isn’t a wireless structure built, like if there aren’t any access points or routers within range. The devices don’t need a central server for file shares or printers. Instead, devices can access each other’s resources directly through a simple point-to-point wireless connection.
How to Set Up an Ad-Hoc Network on Windows
The devices that take part in the ad-hoc network require a wireless network adapter. In addition, the devices have to support a hosted network.
To see if your wireless adapter has hosted network support, look for it in Command Prompt after running the command. You might need to open Command Prompt as an administrator for that command to work.
Windows 10 and Windows 8
These versions of Windows make it a little tougher to make an ad-hoc network when you compare the procedure to earlier Windows operating systems. If you want to set up the ad-hoc network manually without using any other software but what Windows has available, open Command Prompt and enter this command, replacing networkname with your network name and password with the password for the wireless network:
netsh wlan set hostednetwork mode=allow ssid=networkname key=password
netsh wlan start hostednetwork
Windows 7
- Access the Network and Sharing Center section of Control Panel by opening Control Panel and then selecting that option. Or, in Category view, first, choose Network and Internet.