giuliomoro
No worries Giulio I managed to update the Kernel which has made things better but I’m still having issues getting the network to function. So the good news is that the ‘DroneNetwork1’ is coming up as an available connection (on my MacBook) when Bela boots up from the SD card. It stays there in the list consistently, whereas before it would disappear. Using ifdown wlan0
and ifup wlan0
seem to work better as well.
Much like before when the Bela is plugged into the MacBook with usb I’m able to connect to the specified IP address for wlan0
. As soon as I temporarily disable the Bela interface, and I’m connected to ‘DroneNetwork1’ I can’t connect to the IDE with the designated wifi ip address which is shown below:
root@bela:~# ip addr show dev wlan0
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 1c:bf:ce:bf:47:7c brd ff:ff:ff:ff:ff:ff
inet 169.254.128.10/24 brd 169.254.128.255 scope global wlan0
valid_lft forever preferred_lft forever
inet6 fe80::1ebf:ceff:febf:477c/64 scope link
valid_lft forever preferred_lft forever
The issue I had before when the script kept running with the same output and I had to stop it seems to happen when I call ifdown wlan0
before calling the script.
But if I call ifup wlan0
, and then the script I have no issue as shown below:
root@bela:~# ifup wlan0
root@bela:~# /bin/bash -c 'IF=wlan0; while /sbin/ip address show dev $IF | /usr/bin/paste -sd_ | /bin/grep -v "\<inet6\>" 2>/dev/null; do /sbin/ifdown $IF; /sbin/ifup $IF; /bin/sleep 1; done; echo "$IF seems to have an IP: `/sbin/ip address show dev $IF | grep \"\<inet\>\" | sed \"s/ \{1,\}/ /g\"`"'
3: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc mq state DOWN group default qlen 1000_ link/ether 1c:bf:ce:bf:47:7c brd ff:ff:ff:ff:ff:ff
ifdown: interface wlan0 not configured
wlan0 seems to have an IP: inet 169.254.128.10/24 brd 169.254.128.255 scope global wlan0
I assumed that was normal due to how the script works.
I was wondering could it be how I’ve written the wifi setup in /etc/network/interfaces
? Is there a better way of implementing an ad-hoc network in this file? I’m currently using the Ralink RT5370 wifi dongle. However I found when I tried a different wifi dongle (to check if it might be hardware related), such as the Netgear AC600 (with the required linux drivers) it doesn’t like the wireless-mode
or wireless-channel
implementations. Relevant content of the file is shown below:
# WiFi Example
# ad-hoc network config
allow-hotplug wlan0
iface wlan0 inet static
address 169.254.128.10
netmask 255.255.255.0
wireless-channel 1
wireless-essid DroneNetwork1
wireless-mode ad-hoc
I also added in /lib/systemd/system/netfix.service using the following command nano /lib/systemd/system/netfix.service
with the following content :
DefaultDependencies=no
After=network-online.target
Conflicts=shutdown.target
[Service]
Type=simple
# EnvironmentFile=-/path/to/file # optionally, declare IF=wlan123 in /path/to/file instead of hard-coding it below
ExecStart=/bin/bash -c 'IF=wlan0; while /sbin/ip address show dev $IF | /usr/bin/paste -sd_ | /bin/grep -v "\<inet6\>" 2>/dev/null; do /sbin/ifdown $IF; /sbin/ifup $IF; /bin/sleep 1; done; echo "$IF seems to have an IP: `/sbin/ip address show dev $IF | grep \"\<inet\>\" | sed \"s/ \{1,\}/ /g\"`"'
[Install]
WantedBy=default.target
And then I ran systemctl enable netfix. Followed by a reboot. However this caused issues as the network would no longer show up on my list of available networks on the MacBook when Bela dotted up. So I deleted the content of that file, saved and then called systemctl disable netfix
.
I thought it might be an issue with the rt2800usb driver on the Ralink RT5370? Maybe a compatibility issue.