I am trying to make adhoc network connect mobile phone and other pc devices to Raspiberry pi zero w
Device :: Raspiberry pi Zero W
Release :: 10
Codename :: buster
I followed below steps to try to make adhoc nw on my Raspiberry pi zero w
cd /etc/network
sudo cp interfaces interfaces.backup
sudo nano adhoc-interface
added below in my adhoc-interface file
auto lo
iface lo inet loopback
iface eth0 inet dhcp
auto wlan0
iface wlan0 inet static
address 192.168.2.1
netmask 255.255.255.0
wireless-channel 4
wireless-essid RPitest
wireless-mode ad-hoc
Installed dhcp
sudo apt-get install isc-dhcp-server
sudo nano /etc/dhcp/dhcpd.conf
Added below to my dhcpd.conf
ddns-update-style interim;
default-lease-time 600;
max-lease-time 7200;
authoritative;
log-facility local7;
subnet 192.168.2.0 netmask 255.255.255.0 {
range 192.168.2.5 192.168.2.150;
}
Added my wlan0 interface to
sudo /etc/default/isc-dhcp-server
as below
INTERFACESv4="wlan0"
After all above on reboot, my device is able to get 192.168.2.1 ip , but its not visible on other mobile and computer devices.
Anybody can help,what am i missing more ?
Finally i was able to do that , i followed as below
sudo apt update
sudo apt install network-manager network-manager-gnome openvpn openvpn-systemd-resolved network-manager-openvpn network-manager-openvpn-gnome -y
sudo apt purge openresolv dhcpcd5 -y
sudo ln -sf /lib/systemd/resolv.conf /etc/resolv.conf
After above i got an icon in taskbar to create a hotspot to which I was able to connect other devices.
Related
I have set up a QEMU virtual machine (VM) trying to emulate an ARM Cortex-A9 cpu on my lubuntu VM (on VirtualBox). Using the kernel, initrd and image of this article, I start QEMU like this:
qemu-system-arm -M vexpress-a9 -cpu cortex-a9
-m 512
-kernel vmlinuz-3.2.0-4-vexpress
-initrd initrd.img-3.2.0-4-vexpress
-drive if=sd,file=debian_wheezy_armhf_standard.qcow2
-append "root=/dev/mmcblk0p2"
-nic user,hostfwd=tcp::5555-:22
After it boots up, I have configurated an static IP on the guest. Modifying the path /etc/network/interfaces.
auto eth0
iface eth0 inet static
address 192.168.0.102
netmask 255.255.255.0
gateway 192.168.0.11
The VM lubuntu, is on the same IP range (192.168.0.1) and my goal is to be able to stablish a connection from QEMU VM to three server sockets which are on port 12000, 13000 and 14000 on the lubuntu VM.
Which parameters do i have to modify/add? I've been reading the network documentation but any test i do, is not working.
UPDATE 1
Following #Peter Maydell advice i changed the network configuration to run a dhcp client instead of an static IP.
# /etc/network/interfaces
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
So when running # ip a i get the IP 10.0.2.15/24. Anyways, now I'm being able to reach every net from QEMU but, to be honest, i would prefer to set up a static IP.
You can't just pick an IP address at random for your guest. It has to match the fake network that user-mode networking creates, which is (as the wiki page you link to mentions) on 10.0.2.x by default. It will not (and should not be) on the same IP range as the host or this other VM. The simplest thing is to have the guest run a DHCP client, which will then be able to automatically pick up the right network config from the fake DHCP server that the user-mode networking sets up.
Cross-VM communication as you want should be doable. First check that you can connect from the host to those ports on the lubuntu VM. If you can't do that then you need to fix that VM's config first. Once that is working, then it should also work to connect from the in-QEMU guest to the lubuntu VM on the same IP address/port. This is because outbound connections from the QEMU user-mode-networked guest to either the host or to the outside world require no special configuration. It's only inbound connections to the QEMU guest that need hostfwd setup.
I am trying to set up a bridge between my BATMAN-adv mesh network running on Raspi4's and my pc.
Ive tried a couple of different tutorials but all of them result in the same end result, no working bridge.
I cant find the problem with how i set it up.
This is the script i use to configure the mesh network:
bash service wpa_supplicant stop sudo systemctl mask wpa_supplicant.service sudo update-rc.d dhcpcd disable
ip link set wlan0 down #e.g. <if> = wlan0
iw wlan0 set type ibss
ifconfig wlan0 mtu 1500 # This is necessary for batman-adv
iwconfig wlan0 channel 3
ip link set wlan0 up
iw wlan0 ibss join swarmbots 2432 # e.g. <ssid> = my-mesh-network
#Frequency is 2.432. 0.0x should match with channel.
modprobe batman-adv
batctl if add wlan0 # e.g. <if> = wlan0
ip link set up dev wlan0
ip link set up dev bat0
sudo batctl gw_mode client
I found a couple of different ways to set up a bridge, listed here:
These would be executed after i configured the device on the mesh network
sudo batctl gw_mode server
ip link add name mesh-bridge type bridge
ip link set dev eth0 master mesh-bridge
ip link set dev bat0 master mesh-bridge
ip link set up dev eth0
ip link set up dev bat0
ip link set up dev mesh-bridge
sysctl -w net.ipv4.ip_forward=1
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A FORWARD -i eth0 -o bat0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i bat0 -o eth0 -j ACCEPT
sudo batctl gw_mode server
And the 3th try:
sudo batctl gw_mode server
sudo brctl addbr br0
sudo brctl addif eth0
sudo brctl addif bat0
Anybody able to help me out?
Thanks
I plugged an additional wifi connector in my Raspberry Pi 3B+. I can‘t see the interface of the additional connector after plugging my Raspberry Pi out of power or use sudo poweroff for save shutdown. But after sudo reboot the wifi connector is visible after typing sudo iwconfig in the terminal.
My /etc/network/interfaces contains:
source-directory /etc/network/interfaces.d
auto lo
iface lo inet loopback
iface eth0 inet dhcp
auto wlan0
allow-hotplug wlan0
iface wlan0 inet manual
post-up iw dev $IFACE set power_save off
auto wlan1
allow-hotplug wlan1
iface wlan1 inet manual
post-up iw dev $IFACE set power_save off
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
My /etc/modules contains:
i2c-dev
bcm2835_wdt
# r8712u # this driver makes problems
r92su
The internal WiFi adapter in my Raspberry Pi 3 b+ is a broadcom and my external WiFi adapter is a Realtek RTL8191SU.
I tried already to shut down the power save mode of the wlan adapter:
post-up iw dev wlan1 set power_save off
EDIT:
Networking.service:
systemctl status networking.service
Returns:
Failed to initialize control interface 'DIR=/var/run/wpa_supplicant GROUP=netdev'. You may have another wpa_supplicant process already running or the file was left by an unclean termination of wpa_supplicant in which case you will need to manually remove this file before.
EDIT 2:
My WLAN connected after
sudo killall wpa_supplicant
sudo poweroff
Shutdown the stream and start Raspberry Pi and it works nice, but if I do this and remove a usb mouse and keyboard it won‘t connect with the wifi. It looks like there is a start problem with usb connectors of the Pi.
EDIT 3:
There seems to be a bug in the system with the USB connection and the current distribution.
Every time I remove the usb mouse and keyboard, the wlan usb adapter is no longer activated.
EDIT 4:
It could also be a driver problem for rtl8191su and therefor r8712u.
My post on the raspberry pi forum:
https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=230193&p=1410456&hilit=wlan1#p1410456
EDIT 5:
I tried already
https://www.raspberrypi.org/forums/viewtopic.php?t=191844
, but after i did this my system won‘t boot correctly and the broadcom internal wlan adapter won‘t work correctly. After this i got wlan0 and wlan1 but both were the same network adapters connected to the same wlan (strange).
So the problem is not fixed until now!
How to get Raspberry Pi‘s wlan1 interface work after shut down the stream and start the Raspberry Pi?
I looked into this issue and here is a fix that I found:
1.In the terminal type sudo nano /etc/network/interfaces
2.Edit your interfaces config file by making sure the text looks like the following...
auto lo
auto wlan0
iface lo inet loopback
iface eth0 inet dhcp
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
4.Save your work by pressing Ctrl X and confirming save. Turn the pi off and on
5.When your Pi has restarted bring up the GUI again. Now double click the WiFi Config icon to bring up the wpa_gui properties box. If all was successful you should now see wlan0 show up in the Adapter section. From here you should scan for you SSID and set up the connection.
Hope this helps.
First suppress the loading of the modules by blacklisting and load them in a specific order later on:
Type this to the terminal:
$ sudo vi /etc/modprobe.d/wlan-blacklist.conf
This creates a new file. Make sure to end it with ".conf". Insert your modules here:
blacklist r8712u
blacklist 8192cu
Save and close the file. Now run this:
$ sudo depmod -ae
$ sudo update-initramfs -u
$ sudo vi /etc/modules
At the end of the file you add your modules in the order that they are supposed to show up (i.e. wlan0 before wlan1, etc.):
# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.
# Parameters can be specified after the module name.
snd-bcm2835
8192cu
r8712u
Then try turning it off and on
I got the solution for this problem:
First load the module (driver) for your usb wlan adapter after the internal chip adapter. In this example case, I got the RTL8191SU with the sudo apt-get install firmware-realtek and therefor r8712u driver.
sudo nano /etc/modprobe.d/wlan-blacklist.conf
Edit wlan-blacklist.conf like this:
blacklist r8712u
After this run:
sudo depmod -ae
sudo update-initramfs -u
sudo nano /etc/modules
Edit modules like this:
i2c-dev
brcmfmac
r8712u
Now load the r8712u module a little bit later after the internal wlan chip of the Raspberry Pi 3b+:
sudo nano /etc/crontab
Add line to crontab:
#reboot root (sleep 20; modprobe r8712u) &
Now have a right interfaces file:
sudo nano /etc/network/interfaces
wlan1 is the realtek wlan adapter and wlan0 the internal broadcom wlan chip:
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
auto wlan0
allow-hotplug wlan0
iface wlan0 inet manual
post-up iw dev wlan0 set power_save off
auto wlan1
allow-hotplug wlan1
iface wlan1 inet dhcp
post-up iw dev wlan1 set power_save off
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet manual
It is really important, that the default interface is manual!
sudo reboot
or
sudo poweroff
Both of these commands will let the wifi configured correctly. Even if I turn off the raspberry pi and then boot again.
Enjoy your second wlan adapter!
I have flashed my Raspberry Pi 3 with the Android Things image, I have not been able to connect it to my wifi network. I have run adb devices but I get no response.
Take a look at this question: connect to Raspberry Pi 3 using adb
The Raspberry Pi isn't a USB device, the USB connection is just for power, so it won't show up in adb devices. You have to connect it to a network first then use adb connect.
In short, you have to connect it to network using Ethernet and then follow the instructions using adb command to connect it to Wifi. Yeah, I know it is dumb but it is just the way it works at the moment.
And adb devices won't show anything until it is connected with TCP. RPi3 won't work as a USB slave device.
Check the details here and other stuffs.
http://pierrchen.blogspot.com.au/2017/01/a-hands-on-of-android-things-on-rpi3.html
If you are trying to connect to wifi, you can connect your pi with a laptop through USB to TTL module, after that you can use putty to run the following
am startservice \
-n com.google.wifisetup/.WifiSetupService \
-a WifiSetupService.Connect \
-e ssid YOURWIFINAME \
-e passphrase YOURWIFIPASSWORD
if you do it successfully you should be able to see your pi's ip address after running:
ifconfig wlan0
like this:
inet addr: 192.168.1.104 Bcast: 192.168.1.255 Mask 255.255.255.0
I have a PC with two network interfaces: eth0 and eth1.
eth0 - Has an ip of 192.168.11.X/24.
eth1 - Has an ip of 192.168.130.X/24. eth1 has internet connectivity.
How does my OS know which interface to use when I try connecting to the internet? Does it iterate over all default gateways? Does it have any cache of what each interface provides? Is there any difference in the behaivior between Windows and Linux?
I'm going to answer for the Linux side of the house (at least for Debian-based systems, such as Ubuntu, since it's more common for users at this point):
Type the following into a command line:
route -n
You should see your "routing table" appear, with something like the following:
Destination Gateway Genmask ... Iface
0.0.0.0 192.168.11.254 0.0.0.0 ... eth0
169.254.0.0 0.0.0.0 255.255.0.0 ... eth0
192.168.11.0 0.0.0.0 255.255.255.0 ... eth0
192.168.130.0 0.0.0.0 255.255.255.0 ... eth1
I omitted a couple columns, but basically, the line that says "0.0.0.0" under "Destination" is the line that determines where your default route is. In other words, where all of the traffic goes that isn't destined for any of the other subnets in the other lines (google.com, facebook.com, whatever).
If it's not right (such as in the above table, where "eth1" is the card you want with Internet access), you should change the default route:
sudo route del default
sudo route add default gw 192.168.130.254 netmask 255.255.255.0
That will fix it for now. To make it permanent, edit your interfaces file:
sudo gedit /etc/network/interfaces
Edit it to look something like the following (change as necessary to your specific situation):
auto eth0
iface eth0 inet dhcp
up route del default
auto eth1
iface eth1 inet dhcp
up route add default gw 192.168.130.254 netmask 255.255.255.0
Then restart networking to see if that did the trick:
sudo /etc/init.d/networking restart
The feature you're asking about is a routing table, a list of destinations known to the host.
When the OS needs to forward a packet it checks this list and chooses the most appropriate one (from specific destinations to general ones). For example:
192.0.2.0/28 - 192.0.2.1 via eth1
198.51.100.0/27 - 198.51.100.1 via eth0
0.0.0.0/0 - 203.0.113.1 via eth0
Note the last destination: it will match any IPv4 address.