From f25bb7891ea56fa8604edeef0659cacfb1374948 Mon Sep 17 00:00:00 2001 From: ghpille Date: Fri, 9 Dec 2016 23:26:09 +0100 Subject: [PATCH 1/3] Update connecting-to-the-internet-via-usb.md --- .../connecting-to-the-internet-via-usb.md | 71 ++++++++++++++++++- 1 file changed, 70 insertions(+), 1 deletion(-) diff --git a/docs/tutorials/connecting-to-the-internet-via-usb.md b/docs/tutorials/connecting-to-the-internet-via-usb.md index 4ef38ff5a..30dc55c33 100644 --- a/docs/tutorials/connecting-to-the-internet-via-usb.md +++ b/docs/tutorials/connecting-to-the-internet-via-usb.md @@ -135,6 +135,75 @@ If you are using an older version, please upgrade. {% include /util/screenshot.html source="/images/brickman/wired-status-online-connect-automatically-selected.png" %} + +* {: tab="Debian_commandline"}{% include /style/icon.html type="info" %} + These instructions were written using Debian look-alikes for those wanting to know what happens under the hood. + The commands need to be executed by or as root. + {:class="alert alert-info"} + + 1. Connect the USB cable to your computer and its mini-B plug to the EV3 (slot marked "PC"). + + 2. Verify that USB tethering is disabled: "Wireless and Networks" > "Tethering. + + 3. Set default Linux network settings: "Wireless and Networks" > "All Network Connections" > "Wired" > + "IPv4" > "Change" > "Load Linux Defaults". The EV3 should get address 10.42.0.3, gateway 10.42.0.1. + + 4. Verify if the EV3 is recognized by your Linux PC: "lsusb" should show + + `Bus 001 Device 002: ID 0525:a4aa Netchip Technology, Inc. Linux-USB CDC Composite Gadge (Ethernet and ACM)` + + (Bus and Device may differ). + + 5. Your system should load cdc_ether to manage the EV3: check with "lsmod | grep cdc". + ``` + Module Size Used by + cdc_ether 16384 0 + ``` + + 6. Check dmesg to find which device has been assigned to the EV3 network: "dmesg | grep cdc" + ``` + cdc_ether 1-5:1.0 usb0: register 'cdc_ether' at usb-0000:00:02.1-5, CDC Ethernet Device, d6:6a:37:7e:16:07 + usbcore: registered new interface driver cdc_ether + cdc_ether 1-5:1.0 enp0s2f1u5: renamed from usb0 + cdc_ether 1-5:1.0 enp0s2f1u5: kevent 12 may have been dropped + The device is enp0s2f1u5 in this case. + ``` + + 7. Assign the gateway address to the EV3 network device: + + `# ifconfig enp0s2f1u5 10.42.0.1 netmask 255.255.255.0 up` + + 8. Verify if you can ping the EV3: + ``` + # ping 10.42.0.3 + PING 10.42.0.3 (10.42.0.3) 56(84) bytes of data. + 64 bytes from 10.42.0.3: icmp_seq=1 ttl=64 time=0.812 ms + 64 bytes from 10.42.0.3: icmp_seq=2 ttl=64 time=0.685 ms + 64 bytes from 10.42.0.3: icmp_seq=3 ttl=64 time=0.670 ms + ^C + ``` + + 9. You have now established a network connection and you can ssh to the EV3. If you have an internet + connection which you want to make available to your EV3, there is more that needs to be done. + + 10. Allow your system to forward IP traffic (given eth0 carries your internet connection): + ``` + # echo 1 > /proc/sys/net/ipv4/ip_forward + ``` + (to make this permanent, add "net.ipv4.ip_forward=1" to /etc/sysctl.conf) + ``` + # iptables --append FORWARD --in-interface enp0s2f1u5 -j ACCEPT + # iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE + ``` + + 11. Assign a name-server (eg. google-public-dns-a) to your EV3 (you need to be logged in on your EV3 as root): + + `# echo "nameserver 8.8.8.8" > /etc/resolv.conf` + + 12. Verify if you can ping that nameserver: + + `# ping 8.8.8.8` + * {: tab="Windows"}{% include /style/icon.html type="info" %} These instructions were written using Windows 10, but should work on Windows 7 and 8 as well. @@ -247,4 +316,4 @@ If you are using an older version, please upgrade. Now that you have a network connection, you should [connect to your EV3 with SSH](/docs/tutorials/connecting-to-ev3dev-with-ssh) -if you haven't done so already. \ No newline at end of file +if you haven't done so already. From af441687a8653d9ab0225eab8b2e333690c0c920 Mon Sep 17 00:00:00 2001 From: ghpille Date: Sun, 11 Dec 2016 14:45:49 +0100 Subject: [PATCH 2/3] Update connecting-to-the-internet-via-usb.md Forgot an elementary part of this exercise: loading the g_cdc module. --- .../connecting-to-the-internet-via-usb.md | 49 +++++++++++++------ 1 file changed, 33 insertions(+), 16 deletions(-) diff --git a/docs/tutorials/connecting-to-the-internet-via-usb.md b/docs/tutorials/connecting-to-the-internet-via-usb.md index 30dc55c33..40bdbc485 100644 --- a/docs/tutorials/connecting-to-the-internet-via-usb.md +++ b/docs/tutorials/connecting-to-the-internet-via-usb.md @@ -136,31 +136,48 @@ If you are using an older version, please upgrade. {% include /util/screenshot.html source="/images/brickman/wired-status-online-connect-automatically-selected.png" %} -* {: tab="Debian_commandline"}{% include /style/icon.html type="info" %} +* {: tab="linux_command_line"}{% include /style/icon.html type="info" %} These instructions were written using Debian look-alikes for those wanting to know what happens under the hood. - The commands need to be executed by or as root. + The commands need to be executed by root. {:class="alert alert-info"} - 1. Connect the USB cable to your computer and its mini-B plug to the EV3 (slot marked "PC"). + 1. Booting with a standard ev3dev image, lsusb will show - 2. Verify that USB tethering is disabled: "Wireless and Networks" > "Tethering. + `Bus 002 Device 008: ID 0694:0005 Lego Group` + + I'll be using the EV3 as a USB Gadget, as follows. + + 2. When you've copied the ev3dev's image to the SD-card, mount the second partition (EV3DEV_ROOTFS). + If your card is /dev/sdc, then mount /dev/sdc2 on a free directory: + + `mount /dev/sdc2 /mnt/sdc2` + + 3. Add the "g_cdc" module to /etc/modules (which currently contains only comments): + + `echo "g_cdc" >> /mnt/sdc2/etc/modules` + + Unmount /dev/sdc2, put the SD-card in the EV3 and start it up. + + 4. Connect the USB cable to your computer and its mini-B plug to the EV3 (slot marked "PC"). + + 5. Verify that USB tethering is disabled: *"Wireless and Networks" > "Tethering*. - 3. Set default Linux network settings: "Wireless and Networks" > "All Network Connections" > "Wired" > - "IPv4" > "Change" > "Load Linux Defaults". The EV3 should get address 10.42.0.3, gateway 10.42.0.1. + 6. Set default Linux network settings: *"Wireless and Networks" > "All Network Connections" > "Wired" > + "IPv4" > "Change" > "Load Linux Defaults"*. The EV3 should get address 10.42.0.3, gateway 10.42.0.1. - 4. Verify if the EV3 is recognized by your Linux PC: "lsusb" should show + 7. Verify if the EV3 is recognized by your Linux PC: `lsusb` should show `Bus 001 Device 002: ID 0525:a4aa Netchip Technology, Inc. Linux-USB CDC Composite Gadge (Ethernet and ACM)` (Bus and Device may differ). - 5. Your system should load cdc_ether to manage the EV3: check with "lsmod | grep cdc". + 8. Your system should load cdc_ether to manage the EV3: check with `lsmod | grep cdc`. ``` Module Size Used by cdc_ether 16384 0 ``` - 6. Check dmesg to find which device has been assigned to the EV3 network: "dmesg | grep cdc" + 9. Check dmesg to find which device has been assigned to the EV3 network: `dmesg | grep cdc` ``` cdc_ether 1-5:1.0 usb0: register 'cdc_ether' at usb-0000:00:02.1-5, CDC Ethernet Device, d6:6a:37:7e:16:07 usbcore: registered new interface driver cdc_ether @@ -169,11 +186,11 @@ If you are using an older version, please upgrade. The device is enp0s2f1u5 in this case. ``` - 7. Assign the gateway address to the EV3 network device: + 10. Assign the gateway address to the EV3 network device: `# ifconfig enp0s2f1u5 10.42.0.1 netmask 255.255.255.0 up` - 8. Verify if you can ping the EV3: + 11. Verify if you can ping the EV3: ``` # ping 10.42.0.3 PING 10.42.0.3 (10.42.0.3) 56(84) bytes of data. @@ -183,10 +200,10 @@ If you are using an older version, please upgrade. ^C ``` - 9. You have now established a network connection and you can ssh to the EV3. If you have an internet + 12. You have now established a network connection and you can ssh to the EV3. If you have an internet connection which you want to make available to your EV3, there is more that needs to be done. - 10. Allow your system to forward IP traffic (given eth0 carries your internet connection): + 13. Allow your system to forward IP traffic (given eth0 carries your internet connection): ``` # echo 1 > /proc/sys/net/ipv4/ip_forward ``` @@ -196,13 +213,13 @@ If you are using an older version, please upgrade. # iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE ``` - 11. Assign a name-server (eg. google-public-dns-a) to your EV3 (you need to be logged in on your EV3 as root): + 14. Assign a name-server (eg. google-public-dns-a) to your EV3 (you need to be logged in on your EV3 as root): `# echo "nameserver 8.8.8.8" > /etc/resolv.conf` - 12. Verify if you can ping that nameserver: + 15. Verify if you can ping that nameserver: - `# ping 8.8.8.8` + `# ping 8.8.8.8` * {: tab="Windows"}{% include /style/icon.html type="info" %} These instructions were written using Windows 10, but should work on Windows From 4f563e2f70de8fec8395ebf8d9a7d684d24729e7 Mon Sep 17 00:00:00 2001 From: ghpille Date: Mon, 12 Dec 2016 15:56:49 +0100 Subject: [PATCH 3/3] beautification --- .../connecting-to-the-internet-via-usb.md | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/docs/tutorials/connecting-to-the-internet-via-usb.md b/docs/tutorials/connecting-to-the-internet-via-usb.md index 40bdbc485..1a53868d3 100644 --- a/docs/tutorials/connecting-to-the-internet-via-usb.md +++ b/docs/tutorials/connecting-to-the-internet-via-usb.md @@ -178,6 +178,7 @@ If you are using an older version, please upgrade. ``` 9. Check dmesg to find which device has been assigned to the EV3 network: `dmesg | grep cdc` + ``` cdc_ether 1-5:1.0 usb0: register 'cdc_ether' at usb-0000:00:02.1-5, CDC Ethernet Device, d6:6a:37:7e:16:07 usbcore: registered new interface driver cdc_ether @@ -186,11 +187,13 @@ If you are using an older version, please upgrade. The device is enp0s2f1u5 in this case. ``` - 10. Assign the gateway address to the EV3 network device: + 10. Assign the gateway address to the EV3 network device: `# ifconfig enp0s2f1u5 10.42.0.1 netmask 255.255.255.0 up` - 11. Verify if you can ping the EV3: + 11. Verify if you can ping the EV3: + + ``` # ping 10.42.0.3 PING 10.42.0.3 (10.42.0.3) 56(84) bytes of data. @@ -200,24 +203,28 @@ If you are using an older version, please upgrade. ^C ``` - 12. You have now established a network connection and you can ssh to the EV3. If you have an internet - connection which you want to make available to your EV3, there is more that needs to be done. + 12. You have now established a network connection and you can ssh to the + EV3. If you have an internet connection which you want to make + available to your EV3, there is more that needs to be done. + + 13. Allow your system to forward IP traffic (given eth0 carries your + internet connection): + + `# echo 1 > /proc/sys/net/ipv4/ip_forward` - 13. Allow your system to forward IP traffic (given eth0 carries your internet connection): - ``` - # echo 1 > /proc/sys/net/ipv4/ip_forward - ``` (to make this permanent, add "net.ipv4.ip_forward=1" to /etc/sysctl.conf) + ``` # iptables --append FORWARD --in-interface enp0s2f1u5 -j ACCEPT # iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE ``` - 14. Assign a name-server (eg. google-public-dns-a) to your EV3 (you need to be logged in on your EV3 as root): + 14. Assign a name-server (eg. google-public-dns-a) to your EV3 (you need + to be logged in on your EV3 as root): `# echo "nameserver 8.8.8.8" > /etc/resolv.conf` - 15. Verify if you can ping that nameserver: + 15. Verify if you can ping that nameserver: `# ping 8.8.8.8`