Raspberry Pi Wifi dongle - raspberry-pi2

I'm not quit sure if I'm on the right site for this, but I'll give it a try. I have a couple of usb devices plugged in my Raspberry Pi model B. But when I plug in a WiFi dongle, it just shuts down all the other usb devices, and the dongle itself doesn't even work. Has anyone any idea what moght solve my problem? Thanks a lot!

I guess the problem is the amount of current that your Raspberry Pi is able to source. If you are not using a Hub it makes sense that when you connect your WiFi dongle the USB ports are disable to avoid getting to much current from your Raspberry Pi.

WiFi dongle consumes lot of USB power. You need external powered USB hub, or you can maximize the input current for your pi
Based on its documentation, Pi 2 can be powered up to 2A current

I had this problem too. It was easy to fix for me, but this may not help. This turned out to be a settings / driver error for me. If this does not work, you should try a different power source with a 2A current.
I have an answer for this. If you can run the command 'lsusb' okay, and it shows your wifi dongle is attached, you will need to edit your /etc/network/interfaces file.
First, find your ip and gateway settings
ifconfig
That should display your ip address. Write down the default gateway and this IP address.
Now, enter this into the command line:
Sudo nano /etc/network/interfaces
So, that has opened the interfaces file. Completely rewrite the file to the following (YOU SHOULD TAKE A PICTURE OF THE CURRENT FILE IN CASE THIS GOES WRONG):
auto lo
iface lo inet loopback
#auto eth0
#allow-hotplug eth0
#iface eth0 inet dhcp
allow hotplug wlan0
iface wlan0 inet static
address you_got_this_in_step_1
network 192.168.0.225 #Change this to your setting.
gateway default_gateway_from_step_1
dns-nameservers 8.8.8.8
wpa-ssid YOUR_NETWORK_SSID
wpa-psk YOUT_NETWORK_PASSKEY
allow-hotpug wlan1
iface wlan1 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
ctrl+x and save the file, yes on overwrite
sudo service networking restart
The pi should do some things and restart okay. If not, please set the file back to the original (should have screenshotted the file).
I also recommend that you do this locally and not through SSH.
Thanks for reading my answer and I hope it helps.

Related

Proper way to connect to IOT devices (UDP or ICMP)

What is the proper way to connect an app to a device? At the moment, I have a raspberry pi 3 that controls something about electricity and an iPhone app I created. Every time the app goes to foreground, it sends a UDP broadcast message, when the app receives a response from the raspberry pi, it uses that IP address (in the IP header) to consume the web services I created in the hub. This UDP process is done all the time you run the app. Is this what IOT devices usually do? I assume the raspberry pi IP will change sooner or later.
A colleague of mine told me another way: After the first time I get the IP address, instead of using UDP broadcast messages every time the app runs, use ICMP to ping the previously saved IP address to see if it is responding. In that case, I use the web services with that IP address, otherwise, use the UPD broadcast message again.
I don't see the point of that. Basically because the system is not faster using ICMP. (a UDP request is more or less as fast as an ICMP request). Moreover, maybe, another device started using that IP address now (like a smart TV or a smart plug) and for that reason, it is not going to reply to the network requests sent by the app. In that case, the app cannot recover, because it thinks it is already connected to the proper device. As far as I understand, ICMP is a protocol use for diagnosis, not for devices discovery.
What do you think? What's the process used by devices like Alexa, Philips Hue, Smart plugs... to solve the problem of discovering the devices by their apps?
It seems Philips HUE is using SSDP, which under the hood uses a UDP broadcast message. Is it used every time you run the app to discover the IP address? (I am going to check this later with wireshark)
Thanks for suggestions.
You can enable the hostname of your Raspberry Pi to be accessible on your local network through:
http://raspberrypi.local
To enable it, you need to install Bonjour support on your Raspberry Pi by installing the Avahi mDNS daemon (implements Apple's Zeroconf architecture):
$ sudo apt-get install avahi-daemon
Update boot startup:
$ sudo insserv avahi-daemon
Restart to apply the new configuration:
$ sudo /etc/init.d/avahi-daemon restart

Why would IP masquerading fix problematic WebRTC connection?

I'm working with a WebRTC stack that consists of a (firewall-enabled) embedded Linux device, an iOS mobile app, and self-maintained signaling, STUN, and TURN servers.
In 99% of network configurations, the setup works just fine. However, when the embedded Linux device is connected to a Verizon Jetpack (4G LTE), the device cannot establish a WebRTC connection with the mobile app (regardless of whether the mobile phone is connected to the Jetpack or some other network).
In an effort to debug, I took down the entire firewall on both IPv4 and IPv6, but it made no difference.
Then, I kind of randomly discovered that if I add a masquerading post-routing IPv4 rule to the device's NAT table, it starts working! Specifically, this is the iptables command that I used:
$ sudo iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
Why would this rule get the WebRTC connection working? And is there a more proper way to achieve the same result? The rule above seems too liberal.
I found this question because I was also experiencing a WebRTC ICE timeout when trying to connect to a device on the Jetpack's network. I don't know anything about iptables or firewall/DNS/NAT configurations, but your discovery gave me a clue that it must be some settings in the MiFi itself.
Looking at http://my.jetpack (the Jetpacks web config page/app/thing) I discovered a setting that was labelled something like "Enable passthrough VPN" and it was defaulted to true/on. Toggling that to false/off appears to have fixed the connection issue for me.
I'm not 100% sure this is the "real" issue since it seems like two devices on the same VPN should be able to connect. Hopefully it gives you a little bit of a clue in your own search.

Raspberry pi on remote network (all done works are mentioned in details)

Firstly,here, I will mention all what I did to make raspberry pi as a web server or as a data cloud. But all the issues which were applied did not work. There are some problems in somewhere , but I dont know where, what , how.. ?
So let me start.
Firstly,I booted my raspberry pi with Raspian OS. It works in a best manner for sure.Then, I installed ntfs-3g to make it possible to read my hard drives by raspberry pi.
When I connected my hard drive (500 GB), raspberry pi went crazy,it freezed and so on.
I have two hypotheses. One of them , maybe hard drive could be so huge for raspberry pi to read and it could take lots of time to read.
But someone could do with 1TB hard drive. So this one is dead!
Another hypothesis is that hard drive is formatted with NTFS. Maybe it could be problem.
At first, I booted raspberry pi from a usb storage and when I connected that hard drive, raspberry tried to boot itself from hard drive, not from usb.That's why this is one another hypothesis. I havent disproved this yet. But i will and let you know.
Although I could not connect my hard drive to raspberry pi, I gave a break to that issue and I tried to create a connection from remote network to my raspberry pi.
I made raspberry's IP as a static. I could connect it from ssh and file zilla(ftp) LOCALLY. I disabled firewall of my router and observed my router's external IP. It has not changed for many days although I dont have a static external IP. Then, I arranged my port forwarding like these
"router_external_IP":8080 destination(raspberry's internal IP) is 22 (for SSH)
"router_external_IP":9000 destination(raspberry's internal IP) is 80 (for HTML)
"router_external_IP":8500 destination(raspberry's internal IP) is 3306(for mySql)
When SSH server and Mysql server ran on the raspberry pi, I tried to connect to raspberry pi
by SSH with "router_external_IP":8080 (from putty)
by browser with "router_external_IP":9000
by browser with "router_external_IP":8500
NO ONE WORKED :( ! [By the way, I installed web servers on it, but i did not mention]
Someone can say that "Are you sure about ports are open ?".
Yes I am sure I checked it out. But I am not sure on my router are forwarding these ports to raspberry pi or not . Also, I can not debug it.
Actually, I have 2 hypotheses on that also.
First one is that maybe router does not forward these ports to raspberry pi.
Second one is that maybe I am doing something wrong and that is why although router forwards all given ports to raspberry, raspberry can not respond.
I can not disprove these since I dont know how to debug.
I do not know what to do. I just got lost. Please help me on these issue.
An easy way to check if your router is forwarding your ports is to check them at: http://canyouseeme.org . If, as you say, all your ports are open on your internal network, if "canyouseeme" can't see your services then you know you need to tweak your router settings.

Centos VirtManager Clone image - Device eth0 does not exist in libvirt

I up the Centos image using VirtualBox ,clone image and convert it into Qcow2 format and tried up using Virt-manager. But i found interface not available in VM.
It displays
"Bringing up interface eth0: Device eth0 does not seems to be present,"
I also tried removing the presistance rules , chkconfig network on and rebooting VM.
But could not able to achieving the interface in VM.
Please advice me with any ideas.
This issue was due to NIC Device model ,
Base machine NIC driver was e1000 and VM it was set as rtl8139. Beacuse of which eth ports are not displayed.
Once i changed to correct e1000 driver. it works.
New learning. Things that can be added into checklist. :)

How to scan network for devices, using C Obj C or Swift

I have a server running on a Raspberry Pi and a client running on my Mac and iPhone (soon Apple Watch). I would like to connect to my server automatically without finding the Raspberry pi's Ip-address.
Is there a way to lookup all the devices on the network, and select by Mac-address, name or something else? I know that the first 3 bytes of the mac-address is the same for all Pies. (B8:27:EB) Maby i can use that information.
I have been looking for a solution for this issue a while but i can't seem to find one.
Zeroconf (aka Bonjour)
IMO, the best way to do this is to have your Raspberry Pi advertise itself on the network using Zeroconf (aka. Bonjour).
On the Raspberry Pi, install avahi-daemon and configure it to advertise whichever service you'd like to connect to connect to, for example, if you're connecting via SSH, you'll need to do something like this.
In Cocoa, you can use NSNetServiceBrowser to find the advertised service.
Possible MAC Address solution
Alternatively, if Avahi-daemon is not an option, you may be able to use the MAC address. I will not go into the specifics in Objective-C, just a high-level overview using the command-line.
In terminal, type ping 255.255.255.255. You will get back ping packets from every device on the local network. For each IP address, send an individual ping e.g. ping -c 1 192.168.x.x. Then, type arp -a. You will see the MAC address for each IP on the local network. From here, you can perhaps use your MAC address filter to find Raspberry Pis.
Why does this work? Well, the first command ping 255.255.255.255 sends a ping in an IP packet to the 'broadcast' address, which means all machines on the local network respond. When you ping the individual IP addresses, the low-level networking stack uses ARP to find the MAC address of the IP to directly send a ping to it. In doing so, the ARP tables on the local machine are updated with the cached values.
Maybe you can use this method in your app to discover local Raspberry Pis.