Hvad har de 5 Raspberry Pi systemer tilfælles ?

 

De har alle den samme MAC addresse 00:e0:4c:53:44:58

Derudover er det den billigste ethernet/usb/hub på Ebay $3.25, og sikkert også den dårligste.

$ lsusb -d 0fe6:9700 -v

Bus 001 Device 004: ID 0fe6:9700 Kontron (Industrial Computer Source / ICS Advent) DM9601 Fast Ethernet Adapter
Couldn't open device, some information will be missing
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x0fe6 Kontron (Industrial Computer Source / ICS Advent)
  idProduct          0x9700 DM9601 Fast Ethernet Adapter
  bcdDevice            1.01
  iManufacturer           0 
  iProduct                2 
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           39
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xa0
      (Bus Powered)
      Remote Wakeup
    MaxPower              120mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           3
      bInterfaceClass         0 (Defined at Interface level)
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0008  1x 8 bytes
        bInterval               1

Der er tale om en USB1.1 enhed, som man brugte i det forrige årtusinde. USB1.1 har en maximal hastighed på 12 MBit/sec, som man ser i klumber af maximalt 64 bytes.  Men til mange ting er det jo nok.  Så vi skal blot have fixet problemet med MAC-addressen.  Det kan klares med en lille udev-rule

$ cat /etc/udev/rules.d/99-dm9601.rules 
# set MAC to hostbased MAC as on Raspberry pi 3
ACTION=="add|move", SUBSYSTEM=="net", SUBSYSTEMS=="usb", ATTR{address}=="00:e0:4c:53:44:58", IMPORT{program}="/usr/local/sbin/fix_mac_00e04c534458.sh", ENV{NM_UNMANAGED}="1"

Der kalder et script

$ cat /usr/local/sbin/fix_mac_00e04c534458.sh 
#!/bin/bash
# raspberry pi 3 has MAC b8:27:eb:..:..:.. the last 3 bytes is the last 3 bytes of serial no.
SERIAL=($(sed -n '/^Serial/{s/.* //;p}' /proc/cpuinfo | fold -w2))
if  [ ${#SERIAL[@]} != 8 ]; then
#	echo this is not a Raspberry Pi, use 8 lower bytes from machine-id
	SERIAL=($(fold -w2 /etc/machine-id | tail -8))
fi
NEW_MAC=b8:27:eb:${SERIAL[5]}:${SERIAL[6]}:${SERIAL[7]}
if [ x$INTERFACE != x ]; then
	/bin/ip link set dev $INTERFACE address $NEW_MAC
fi
echo "ATTR{address}==\"$NEW_MAC\""

Jeg vil dog anbefale at man undgår disse usb/ethernet/hub og i stedet får fat i in 4 ports USB-hub (ebay $1) og en USB-WiFi (ebay $1.75) så har man en meget hurtigere løsning der bruger meget mindre strøm, og så er det billigere.

Men jeg er allerede blevet snydt.

This entry was posted in Linux, Raspberry Pi. Bookmark the permalink.