I have a FreeAgent DockStarTM Network Adapter running on a debian Stretch OS with its rootfs partition on an external USB memory stick. Using this Ethernet Gadget tutorial and this USB Mini 5Pin Female to Micro 5Pin Male 90 Degree Angle Adapter to connect a Raspberry Pi Zero (Rpi0) to one of USB ports on the Seagate Dockstar as seen below, I managed to configure my Seagate Dockstar to bring up the usb0 interface (not be confused with a USB connection) as shown below.
Linux debian 4.12.1-kirkwood-tld-1 #1 PREEMPT Sat Jul 15 21:40:50 PDT 2017 armv5tel
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
[Snippet ...]
[root@debian:/root 1%] #
[root@debian:/root 1%] #
[root@debian:/root 1%] #
[root@debian:/root 1%] # ifconfig
br0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.12 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 aaaa:bbbb:cccc:dddd:eee:ffff:gggg:hhhh prefixlen 64 scopeid 0x0<global>
inet6 fe80::eee:ffff:gggg:hhhh prefixlen 64 scopeid 0x20<link>
ether 00:ee:ff:gg:hh:hh txqueuelen 1000 (Ethernet)
RX packets 4534720 bytes 303890824 (289.8 MiB)
RX errors 0 dropped 513490 overruns 0 frame 0
TX packets 78953 bytes 5729504 (5.4 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
ether 00:ee:ff:gg:hh:hh txqueuelen 1000 (Ethernet)
RX packets 5408351 bytes 1311890988 (1.2 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 184778 bytes 40172402 (38.3 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 34
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 1481 bytes 135830 (132.6 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1481 bytes 135830 (132.6 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
usb0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
ether aa:bb:cc:dd:ee:ff txqueuelen 1000 (Ethernet)
RX packets 108087 bytes 33227432 (31.6 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 4949563 bytes 941839751 (898.2 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[root@debian:/root 2%] #
As can be seen above, I have br0 (bridge), eth0 (ethernet), lo (locanet), and usb0 (USB) interfaces. On the usb0 interface, its MAC Address is set by Rpi0 as seen in the configuration below.
On my Seagate Dockstar running on a debian Stretch, I edited the /etc/network/interfaces and newly created /etc/network/interfaces.d/br0 files. Their respective contents are shown below.
Linux debian 4.12.1-kirkwood-tld-1 #1 PREEMPT Sat Jul 15 21:40:50 PDT 2017 armv5tel The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. [Snippet ...] [root@debian:/root 1%] # [root@debian:/root 1%] # [root@debian:/root 1%] # [root@debian:/root 1%] # cat /etc/network/interfaces source /etc/network/interfaces.d/* [root@debian:/root 2%] # [root@debian:/root 2%] # [root@debian:/root 2%] # [root@debian:/root 2%] # cat /etc/network/interfaces.d/br0 ## DHCP ip config file for br0 ## auto br0 # Bridge setup iface br0 inet dhcp bridge_ports eth0 usb0 [root@debian:/root 3%] # [root@debian:/root 3%] # [root@debian:/root 3%] #
On my Rpi0 running on a Kali Linux, I edited the /etc/network/interfaces, (newly created) /etc/network/interfaces.d/usb0, /boot/config.txt, and /boot/cmdline.txt files. Also, their respective contents are shown below.
Kali GNU/Linux Rolling Linux kali 4.4.50+ #1 Fri Apr 20 17:13:36 CDT 2018 armv6l The programs included with the Kali GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Kali GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. [snippet ...] [root@kali:/root 1%] # [root@kali:/root 1%] # [root@kali:/root 1%] # [root@kali:/root 1%] # cat /etc/network/interfaces # interfaces(5) file used by ifup(8) and ifdown(8) # Please note that this file is written to be used with dhcpcd # For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf' # Include files from /etc/network/interfaces.d: source-directory /etc/network/interfaces.d [root@kali:/root 2%] # [root@kali:/root 2%] # [root@kali:/root 2%] # [root@kali:/root 2%] # cat /etc/network/interfaces.d/usb0 # used for reverse USB tethering auto usb0 iface usb0 inet dhcp [root@kali:/root 3%] # [root@kali:/root 3%] # [root@kali:/root 3%] # [root@kali:/root 3%] # cat /boot/config.txt [snippet ...] dtoverlay=dwc2 [root@kali:/root 4%] # [root@kali:/root 4%] # [root@kali:/root 4%] # [root@kali:/root 4%] # cat /boot/cmdline.txt dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait modules-load=dwc2,g_ether g_ether.host_addr=aa:bb:cc:dd:ee:ff g_ether.dev_addr=zz:yy:xx:ww:vv:uu [root@kali:/root 5%] # [root@kali:/root 5%] # [root@kali:/root 5%] # [root@kali:/root 5%] # ifconfig lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 1 (Local Loopback) RX packets 159 bytes 25424 (24.8 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 159 bytes 25424 (24.8 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 usb0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.1.13 netmask 255.255.255.0 broadcast 192.168.1.255 inet6 fe80::1870:60ff:febf:22b4 prefixlen 64 scopeid 0x20<link> inet6 aaaa:bbbb:cccc:dddd:1870:60ff:febf:22b4 prefixlen 64 scopeid 0x0<global> ether zz:yy:xx:ww:vv:uu txqueuelen 1000 (Ethernet) RX packets 4971724 bytes 873762261 (833.2 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 108380 bytes 34766768 (33.1 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 [root@kali:/root 7%] #
So far, my Rpi0 managed to secure a dual-stack of IPv4 (private) and IPv6 (public) Addresses from my router (see above with all IP Addresses disguised). I have no problem to SSH into my Rpi0 from a computer within the same private LAN behind the same router and/or from a computer outside my private LAN with an IPv6. However, if I reboot my Rpi0, it will break the USB connection. In the process of booting up from the reboot, the Rpi0 will try to establish a USB connection with the Seagate Dockstar and this causes the whole rootfs vanishes. So, until I power cycle the Rpi0, I can no longer execute df, ifconfig, ls, etc., except echo and exit. Right before this happens, I managed to dump out messages from dmesg (see below). I don't know if this problem is caused by the g_ether kernel driver. If you know the solution to this issue, I sure would appreciate your help.
[ 34.230399] br0: port 1(eth0) entered forwarding state
[ 2878.445740] br0: port 2(usb0) entered disabled state
[ 2879.853508] usb 1-1.1: USB disconnect, device number 3
[ 2879.861054] cdc_ether 1-1.1:1.0 usb0: unregister 'cdc_ether' usb-f1050000.ehci-1.1, CDC Ethernet Device
[ 2879.873591] br0: port 2(usb0) entered disabled state
[ 2879.879683] device usb0 left promiscuous mode
[ 2879.884095] br0: port 2(usb0) entered disabled state
[ 2889.003579] usb 1-1.1: new high-speed USB device number 5 using orion-ehci
[ 2889.026633] usb 1-1-port1: cannot reset (err = -71)
[ 2889.035512] usb 1-1-port1: cannot reset (err = -71)
[ 2889.044385] usb 1-1-port1: cannot reset (err = -71)
[ 2889.053257] usb 1-1-port1: cannot reset (err = -71)
[ 2889.062882] usb 1-1-port1: cannot reset (err = -71)
[ 2889.068181] usb 1-1-port1: Cannot enable. Maybe the USB cable is bad?
[ 2889.079131] usb 1-1-port1: cannot disable (err = -71)
[ 2889.088759] usb 1-1-port1: cannot reset (err = -71)
[ 2889.098134] usb 1-1-port1: cannot reset (err = -71)
[ 2889.107009] usb 1-1-port1: cannot reset (err = -71)
[ 2889.115884] usb 1-1-port1: cannot reset (err = -71)
[ 2889.124758] usb 1-1-port1: cannot reset (err = -71)
[ 2889.129662] usb 1-1-port1: Cannot enable. Maybe the USB cable is bad?
[ 2889.140881] usb 1-1-port1: cannot disable (err = -71)
[ 2889.157797] usb 1-1-port1: cannot reset (err = -71)
[ 2889.169275] usb 1-1-port1: cannot reset (err = -71)
[ 2889.191397] usb 1-1-port1: cannot reset (err = -71)
[ 2889.208286] usb 1-1-port1: cannot reset (err = -71)
[ 2889.220832] usb 1-1-port1: cannot reset (err = -71)
[ 2889.236713] usb 1-1-port1: Cannot enable. Maybe the USB cable is bad?
[ 2889.258509] usb 1-1-port1: cannot disable (err = -71)
[ 2889.278397] usb 1-1-port1: cannot reset (err = -71)
[ 2889.287394] usb 1-1-port1: cannot reset (err = -71)
[ 2889.296387] usb 1-1-port1: cannot reset (err = -71)
[ 2889.305260] usb 1-1-port1: cannot reset (err = -71)
[ 2889.314141] usb 1-1-port1: cannot reset (err = -71)
[ 2889.319043] usb 1-1-port1: Cannot enable. Maybe the USB cable is bad?
[ 2889.330382] usb 1-1-port1: cannot disable (err = -71)
[ 2889.335893] usb 1-1-port1: unable to enumerate USB device
[ 2889.345383] usb 1-1-port1: cannot disable (err = -71)
[root@debian:/root 38%] # dmesg
dmesg: Command not found.
[root@debian:/root 39%] #