1

My Lego Mindstorms EV3 software cannot find the EV3 brick via WiFi. The strange thing is, it works in a fresh install of (X)Ubuntu in Virtualbox on this computer, same version. Things I have tried:

  • Recreating the Wineprefix

  • Reinstalling Wine

  • Using both a wired and wireless connection to the router.

5
  • I don't know what "brick" is, but does ping to it works? – Hi-Angel Apr 26 '16 at 4:10
  • Yes, it does. PING 192.168.0.6 (192.168.0.6) 56(84) bytes of data. 64 bytes from 192.168.0.6: icmp_seq=1 ttl=64 time=229 ms 64 bytes from 192.168.0.6: icmp_seq=2 ttl=64 time=53.6 ms 64 bytes from 192.168.0.6: icmp_seq=3 ttl=64 time=273 ms 64 bytes from 192.168.0.6: icmp_seq=4 ttl=64 time=91.4 ms 64 bytes from 192.168.0.6: icmp_seq=5 ttl=64 time=421 ms 64 bytes from 192.168.0.6: icmp_seq=6 ttl=64 time=245 ms 64 bytes from 192.168.0.6: icmp_seq=7 ttl=64 time=62.8 ms ^C --- 192.168.0.6 ping statistics --- 7 packets transmitted, 7 received, 0% packet loss, time 6009ms rtt min/avg/max/mdev = 53.67 – QwertyChouskie May 5 '16 at 0:34
  • Okay, try some things: first execute sudo service ufw stop and see if it fixes the problem. If it isn't, tell: do you use in the Lego Mindstorm the exact IP address or some kind of discovery? Also, run the Mindstorm, try again the connection from it, next switch to a terminal (you may use the one in Alt+Ctrl+F1), find the pid of the app, like ps -A | grep indstorm, and check what ports it uses with sudo netstat --all --program | grep InsertPIDHere. Then run sudo tcpdump -i any src port InsertPort and dst port InsertPort, and tell if you see or not both outgoing and incoming packets. – Hi-Angel May 5 '16 at 3:52
  • Ah, I forgot: after you ran the tcpdump, switch back with Ctrl+Alt+F7 (i.e. if you did use the Ctrl+Alt+F1 terminal), try to connect again, and then look at the output of the tcpdump. – Hi-Angel May 5 '16 at 4:02
  • 1
    sudo service ufw stop works! Any way to keep the firewall on though? – QwertyChouskie May 5 '16 at 19:26
1
+150

It is a firewall that blocks connections from the brick. The easiest way to fix the problem is to disable firewall by sudo service ufw stop, but it's a bad idea in general. Instead, you could setup rules to allow.

I guess, Lego Mindstorm sends a broadcast request, and waits for incoming connections from anyone (from the brick in our case). That means, you need to allow incoming connections either:

  • from an interface
  • using a subnet
  • from a specific IP
  • to a specific port
  • using a specific protocol (i.e. http, https, ssh)
  • any combination of above.

So, one rule you could use is sudo ufw allow from 192.168.0.6, since it's the address of your brick. But I don't know how the address is assigned to the brick, whether it is dynamic, and would you want to use it with another one (with different IP), so probably better way would be to find the port in use, and setup a rule for that. First, temporary disable firewall (sudo service ufw stop), execute in terminal sudo tcpdump -nni any src 192.168.0.6 and dst 192.168.0.6, and connect the app to the brick. You would see an info about packets going between your host and brick, the port is written right after IP of your PC, like …192.168.0.6.52382 > 192.168.0.1.80 Then you can use:

sudo ufw allow PortNumberYouGot # e.g. sudo ufw allow 21

or better yet is to allow only a specific subnet:

sudo ufw allow from 192.168.0.0/16 to any port PortNumberYouGot
15
  • sudo netstat --all --program | grep 17866 unix 3 [ ] STREAM CONNECTED 220927 17866/C:\Program Fi unix 3 [ ] STREAM CONNECTED 219015 17866/C:\Program Fi unix 3 [ ] STREAM CONNECTED 220790 17866/C:\Program Fi unix 3 [ ] STREAM CONNECTED 219017 17866/C:\Program Fi unix 3 [ ] STREAM CONNECTED 221871 17866/C:\Program Fi – QwertyChouskie May 5 '16 at 21:37
  • It seems to use many ports, and may even pick them randomly. – QwertyChouskie May 5 '16 at 21:38
  • @user4901968 hm… Well, the lines starting with unix are not the droids we're looking for; are there any lines that starts with tcp or udp? – Hi-Angel May 5 '16 at 21:45
  • No, just what was pasted. – QwertyChouskie May 5 '16 at 21:48
  • 1
    @Hi-Angel Context is key - ufw will restore its rule sets and save them - advanced sysadmin and security is iptables directly which you use the command iptables-save > /etc/iptables/rules.v4 with the iptables-persistent package to save/restore rule sets. – Thomas Ward May 10 '16 at 13:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.