Wifi ad hoc linux

How do I create a wireless ad-hoc network?

Whenever I need to copy some files and couldn’t find a pen drive (I don’t have bluetooth enabled in my laptop), I create a new ad-hoc wireless network in Windows and share the necessary files on the network and share files with the other system. Now, I want to do the same with Ubuntu. I can create a new network, but I am not able to share or send files. I also don’t know how to access the system connected to the network. How can I do this?

What is your wireless topography? Do you have a WiFi router, or is this really a true peer to peer (eg. ad-hoc) connection?

3 Answers 3

Do you have Samba installed? Run the following:

sudo apt-get install samba 

Samba installation & configuration is automatic if it’s not installed yet when you try to share a directory in Nautilus.

I visited the link posted. I went through it. I installed samba. But, i am not able to add new users. [I guess]. I did change a new password setup but, when i try to restart samba using the command given there, >> «No such file or directory». And the sambe services didnt get start. How can i do this?

The user must be a user on the Linux box as well. So if my username is adam and I wanted to set up a password for that user I’d run this command: smbpasswd -a adam

I also just realised that if you rather use a GUI you should be able to go to System->Administration->samba. User control is under the preferences tab and you can add shares from under the file tab.

You just need to click the network icon, and choose «Create new wireless network» from the menu.

A popup will come up asking you for a name and optionally a password. Once you are done, you can connect to this network using other systems as you would with Windows.

So, just to check, when you do this in Windows, you create a new ad-hoc network, set a folder shareable, and then move to another computer, connect to the Windows machine you just set up, and use Windows’ «Network Places» to find the share and copy the files?

If I have that right, then you should be able to do exactly the same in Ubuntu:

  1. Click the Network icon at the top, select Create New Wireless Network , give it a name and a password, and click Create . (I think you already did this anyway.)
  2. Open the file browser (it’s called Nautilus, but you don’t actually see that anywhere on screen . ). Basically it’s what comes up when you click the Home Folder icon on the launcher.
  3. Navigate to the folder you want, and (this is the annoying bit) go up one level to that folder’s parent. Then find the folder you want in the list, right click on it, and select Sharing Options from the menu.
  4. Set the folder to shared (and you probably want to allow guest access). When you check the box a window might pop up prompting you to install the sharing service. If you don’t see anything, then you’ve already go it.
  5. Once everything is installed, and the folder is shared, it should show up on the network just like any windows share. It thing you have to restart for it to work properly though.
Читайте также:  Elm 327 interface obd2 wifi

Alternatively, if you want to see shares on other machines from Ubuntu, the Nautilus file browser can do that too, in theory. Just click Browse Network , and then Windows Network . I’m not sure, but I think you need samba installed to do this smoothly also, but maybe I’ve just been having other trouble. If you don’t see anything on the network, then go to the file manager, open the File menu at the top, and select Connect to server (type is Windows share ) — that pretty much always works for me.

Источник

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

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=

Читайте также:  Wifi mac для iphone

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) по WiFi между Ubuntu Linux и Windows XP

Рассмотрим случай, когда на одной машине (desktop) стоит все та же Ubuntu, а на другой машине (notebook) стоит Windows XP.

И в заключение, протестируем созданную нами сеть.

Шаг Первый — настройка ad-hoc wifi в Ubuntu Karmic

Открываем NetworkManager правым щелчком мыши на значке в Панели Gnome и выбираем “Edit connections”. Появляется окно “Network Connections”.

Переходим на вкладку “Wireless” (Беспроводные):

Start Network Connections

Нажимаем Add (Добавить). Появляется окно из четырех вкладок (tabs) для создания нового соединения. В первой вкладке вводим общую информацию о создаваемой нами сети:

Ubuntu Editing Windows XP

Переходим на вкладку “Wireless Security”. Оставляем поле “Security” пустым (None):

Security Editing Windows_XP

Далее, переходим на вкладку “IPv4 Settings”. Здесь мы выбираем метод получения IP-адреса компьютером в сети. В нашем случае мы задаем его вручную.

IPv4 Settings-Editing Windows_XP

Вкладку “IPv6 Settings” оставляем как есть, ничего не конфигурируя (Method — Ignore):

IPv6 Settings-Editing Windows_XP

Нажимаем кнопочку Apply (Применить) и видим конечный результат работы — список сетей в “NetworkManager” и нашу Windows_XP среди них:

Finish Network Connections

Закрываем окно. Вновь нажимаем, теперь уже левой кнопкой мыши, на значке “NetworkManager” в Панели Gnome. Выбираем в выпавшем списке “Connect to hidden wireless network” (Подключиться к скрытой беспроводной сети).

В списке “Connection” выбираем нашу Windows XP и нажимаем Connect (Соединить):

Connect to hidden wireless network

В эмуляторе терминала набираем команду:

и видим, что сетевой интерфейс поднят и сеть запущена:

Ubuntu Desktop

Шаг Второй — Настройка

Открываем в “Панели управления” — “Сетевые подключения”:

Читайте также:  Akenori vr02 пароль от wifi

Network Connections Windows XP

Кликаем правой кнопкой мыши на значке “Беспроводное сетевое соединение” и в контекстном меню — “Properties” (Свойства). В окне “Свойств” находим в самом низу строку “Протокол Интернета (TCP/IP)”:

TCP IP Windows XP

Properties TCP IP Windows XP

Нажимаем OK . Далее кликаем левой кнопкой мыши на значке “Беспроводное сетевое соединение” в “Сетевые подключения” “Панели управления”. Открывается окно со списком беспроводных сетей, находящихся в зоне доступа компьютера:

Start Wireless Networks Windows XP

Step1 Windows XP

Step2 Windows XP

Step3 Windows XP

Step4 Windows XP

Step5 Windows XP

Нажимаем “Готово”. Вновь открывается окно со списков доступных беспроводных сетей. В этом списке появилась и наша windows:

Step6 Windows XP

Выбираем сеть windows и нажимаем “Подключить”:

Step7 Windows XP

Step8 Windows XP

В итоге получаем подключение к сети windows:

Step9 Windows XP

Шаг Третий — тестирование сети из Ubuntu

Ping Self - Network Tools

Ping Windows - Network Tools

Traceroute Windows - Network Tools

Сканирование портов Windows XP:

Port Scan Windows - Network Tools

Красивая функция trackBy

Пример красивой функции trackBy для Angular. Функция понравилась своей лаконичностью:public trackByNumber = (_. … Continue reading

Источник

Настройка Wifi в Linux при помощи Adhoc на примере Ubuntu

Эта тема уже не раз поднималась, но хорошей и легкой инструкции я так и не нашел.
Данная статья расчитана на новичков в мире Linux поэтому тут используются наиболее легкие методы настройки.
Для начала ставим пакеты:
sudo apt-get install wireless-tools dhcp3-server
Далее создаем сеть через апплет например название «My Wifi»
И настроим интерфейс(для определения интерфейса воспользуйтесь командой iwconfig)
Пишем в консоли из под root
ifconfig wlan0 down
iwconfig wlan0 mode ad-hoc
iwconfig wlan0 channel 1
iwconfig wlan0 Bit 54Mb/s
iwconfig wlan0 essid ‘My Wifi’
ifconfig wlan0 10.42.43.1 netmask 255.255.255.0 up
iwconfig wlan0
ifconfig wlan0 up
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

  • ifconfig wlan0 down — отключаем интерфейс.
  • iwconfig wlan0 mode ad-hoc — устанавливаем режим Ad-hoc
  • iwconfig wlan0 channel 1 — ставим ad-hoc канал
  • iwconfig wlan0 Bit 54Mb/s — скорость(по стандарту 11Mb/s)
  • iwconfig wlan0 essid ‘My Wifi’ — название нашей созданной сети
  • ifconfig wlan0 10.42.43.1 netmask 255.255.255.0 up — IP адрес компьютера и маска подсети
  • iwconfig wlan0 — проверяем настройки
    Вот мои:
    wlan0 IEEE 802.11bg ESSID:»Bupyc»
    Mode:Ad-Hoc Frequency:2.412 GHz Cell: 8A:BF:88:4B:4E:60
    Tx-Power=11 dBm
    Retry long limit:7 RTS thr:off Fragment thr:off
    Power Management:off
    Link Quality:0 Signal level:0 Noise level:0
    Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
    Tx excessive retries:0 Invalid misc:0 Missed beacon:0
  • ifconfig wlan0 up — запускаем интерфейс
  • echo 1 > /proc/sys/net/ipv4/ip_forward
    iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
    Настраиваем раздачу интернета через NAT

ddns-update-style ad-hoc;
default-lease-time 3600;
max-lease-time 9000;
authoritative;
log-facility local7;
subnet 10.42.43.0 netmask 255.255.255.0 interface wlan0;
range 10.42.43.2 10.42.43.255;
option domain-name-servers 195.34.32.116; # пишем либо свой dns сервер, либо dns провайдера
option routers 10.42.43.1;
option broadcast-address 10.42.43.0;
>

sudo gedit /etc/default/dhcp3-server
Там пишем интерфейс откуда идет интернет.
INTERFACES=»eth0″
Перезапускаем dhcp
sudo /etc/init.d/dhcp3-server restart
Также для автоматической настройки можно прописать в файле /etc/network/interfaces все параметры. sudo gedit /etc/network/interfaces

auto wlan0
iface wlan0 inet static
address 10.42.43.1
netmask 255.255.255.0
broadcast 10.42.43.255
network 10.42.43.0
wireless-essid Bupyc
wireless-mode ad-hoc
wireless-channel 11
wireless-rate 54Mb/s
Теперь достаточно соединиться с любого устройства к данной сети и интернет будет работать.
Это первая моя статья на хабре, так что строго не судите.

Источник

Оцените статью
Adblock
detector