๐Ÿ“๋ผ์ฆˆ๋ฒ ๋ฆฌํŒŒ์ด - OTG ํด๋Ÿฌ์Šคํ„ฐ

4019 ๋‹จ์–ด appwr

์ „์ œ



์ด ๊ฐ€์ด๋“œ์—์„œ๋Š” Raspberrypi์„ ์‹คํ–‰ํ•˜๋Š” Raspberrypi OS ์žฅ์น˜๋งŒ ์‚ฌ์šฉํ•˜์—ฌ ๊ฐ€์žฅ ๊ฐ„๋‹จํ•œ ์Šฌ๋ ˆ์ด๋ธŒ/๋งˆ์Šคํ„ฐ ์„œ๋ฒ„ ๊ตฌ์„ฑ์„ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.

๊ณ ํ’ˆ์งˆ ์ผ€์ด๋ธ”์„ ์‚ฌ์šฉํ•˜์—ฌ ๊ฐ ์žฅ์น˜๋ฅผ ์—ฐ๊ฒฐํ•˜๋Š” ๊ฒƒ์ด ์ค‘์š”ํ•ฉ๋‹ˆ๋‹ค.
์ด ์„ค์ •์€ ์ •ํ’ˆ์ด ์•„๋‹Œ USB-A Male to Micro B ์ผ€์ด๋ธ”์—์„œ๋Š” ์ž‘๋™ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

๋งˆ์Šคํ„ฐ์— ์ ํ•ฉํ•œ ์žฅ์น˜๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. Pi4-B์„ ์‚ฌ์šฉํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.
์Šฌ๋ ˆ์ด๋ธŒ๋กœ ๋‘ ๊ฐœPi Zero W๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.

์š”๊ตฌ ์‚ฌํ•ญ



  • Rasperrypi OS๊ฐ€ ์‚ฌ์ „ ์„ค์น˜๋œ Pi4-B 1๊ฐœ

  • Raspberrypi OS๊ฐ€ ์‚ฌ์ „ ์„ค์น˜๋œ 2 Pi Zero(W)

  • Pi Zero(W)์šฉ ์ „์› ๊ณต๊ธ‰ ์žฅ์น˜ 2๊ฐœ, ๊ฐ Pi Zero์—๋Š” ์ž์ฒด ์ „์› ๊ณต๊ธ‰ ์žฅ์น˜๊ฐ€ ํ•„์š”ํ•จ
  • ๋งˆ์ดํฌ๋กœ B์— USB-A 2.0 ์ˆ˜ 2๊ฐœ

  • ๊ฐ ์žฅ์น˜์— ์„ค์น˜๋œ DHCPCD ํด๋ผ์ด์–ธํŠธ

  • ์„ค์น˜


    ๋…ธ์˜ˆ



    ๊ฐ ์Šฌ๋ ˆ์ด๋ธŒ ์„œ๋ฒ„์— ๋Œ€ํ•ด ํŽธ์ง‘/boot/cmdline.txtํ•˜๊ณ  dwc2 ๋ฐ g_ether ๋ชจ๋“ˆ์ด ํ™œ์„ฑํ™”๋˜์—ˆ๋Š”์ง€ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.

    ๋˜ํ•œ g_ether.host ๋ฐ g_ether.dev_addr์— ๋Œ€ํ•œ MAC ์ฃผ์†Œ๋ฅผ ํ• ๋‹นํ•ฉ๋‹ˆ๋‹ค.
    ์•„๋ž˜ ์˜ˆ์—์„œ ์ œ๊ณต๋œ MAC์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
    $ cat /boot/cmdline.txt
    ์•„๋ž˜ ๋ผ์ธ๊ณผ ๋น„์Šทํ•œ ๊ฒƒ์„ ์ถœ๋ ฅํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. g_ether.host์™€ g_ether.dev_addr MAC์˜ ์ฐจ์ด์ ์— ์œ ์˜ํ•˜์‹ญ์‹œ์˜ค.
    console=serial0,115200 console=tty1 root=PARTUUID=33a0f260-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait modules-load=dwc2,g_ether g_ether.host_addr=00:22:82:ff:ff:03 g_ether.dev_addr=00:22:82:ff:ff:13
    ๊ฐ ์Šฌ๋ ˆ์ด๋ธŒ์— ๋Œ€ํ•ด ํ”„๋กœ์„ธ์Šค๋ฅผ ๋ฐ˜๋ณตํ•˜๊ณ  g_ether.host์™€ g_ether.dev_addr์˜ ์ฐจ์ด์ ์— ์œ ์˜ํ•˜์‹ญ์‹œ์˜ค.
    console=serial0,115200 console=tty1 root=PARTUUID=7a235f18-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait modules-load=dwc2,g_ether g_ether.host_addr=00:22:82:ff:ff:04 g_ether.dev_addr=00:22:82:ff:ff:14
    ์œ„์— ๋‚˜์—ด๋œ ๊ฐ MAC ์ฃผ์†Œ์˜ ๋งˆ์ง€๋ง‰ ๋‘ ์ž๋ฆฌ๋ฅผ ๊ธฐ๋กํ•ด ๋‘์‹ญ์‹œ์˜ค.

    ์Šฌ๋ ˆ์ด๋ธŒ ํ˜ธ์ŠคํŠธ ์ด๋ฆ„



    ๊ฐ๊ฐ/etc/hostname์„ ํŽธ์ง‘ํ•˜๊ณ  ๊ฐ ์Šฌ๋ ˆ์ด๋ธŒ์— ๊ณ ์œ ํ•œ ํ˜ธ์ŠคํŠธ ์ด๋ฆ„์„ ์ง€์ •ํ•ฉ๋‹ˆ๋‹ค. ๊ฐ๊ฐ pisrv03 ๋ฐ pisrv04๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. ํ˜ธ์ŠคํŠธ ์ด๋ฆ„ ํŒŒ์ผ ๋‚ด์šฉ์€ ๋‹ค์Œ ์ค„๊ณผ ๊ฐ™์•„์•ผ ํ•ฉ๋‹ˆ๋‹ค.pisrv03

    ์Šฌ๋ ˆ์ด๋ธŒ ํ˜ธ์ŠคํŠธ



    ๊ฐ๊ฐ/etc/hosts์„ ํŽธ์ง‘ํ•˜๊ณ  ํ˜ธ์ŠคํŠธ ์ด๋ฆ„์ด pisrv03์ธ ์Šฌ๋ ˆ์ด๋ธŒ์— ๋Œ€ํ•ด localhost๋กœ ํ˜ธ์ŠคํŠธ ์ด๋ฆ„์„ ๋งคํ•‘ํ•ฉ๋‹ˆ๋‹ค.
    127.0.0.1 localhost pisrv03
    ํ˜ธ์ŠคํŠธ ์ด๋ฆ„์ด pisrv04์ธ ์Šฌ๋ ˆ์ด๋ธŒ์˜ ๊ฒฝ์šฐ:
    127.0.0.1 localhost pisrv04
    ๋“ฑ๋“ฑ.

    ์Šฌ๋ ˆ์ด๋ธŒ DHCP



    ์‚ฌ์šฉํ•  ์ˆ˜ ์—†๋Š” ๊ฒฝ์šฐ DHCPCD๋ฅผ ์„ค์น˜ํ•ฉ๋‹ˆ๋‹ค.$ apt install dhcpcd/etc/dhcpcd.conf๋ฅผ ํŽธ์ง‘ํ•˜๊ณ  USB ์ธํ„ฐํŽ˜์ด์Šค usb0์— ์ •์  IP๋ฅผ ์ œ๊ณตํ•˜๋ฉด ๋‹ค์Œ ํ–‰์„ ์ฐธ์กฐํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
    (pisrv03)interface usb0static ip_address=10.0.13.2
    (pisrv04)interface usb0static ip_address=10.0.13.2
    ๋“ฑ๋“ฑ.

    ์ฃผ์ธ



    ๋งˆ์Šคํ„ฐ ์„œ๋ฒ„์—์„œ /boot/cmdline.txt์— ์•ก์„ธ์Šคํ•˜๊ณ  dwc2 ๋ฐ g_ether ๋ชจ๋“ˆ์ด ํ™œ์„ฑํ™”๋˜์–ด ์žˆ๋Š”์ง€ ํ™•์ธํ•˜์‹ญ์‹œ์˜ค.
    ๊ฐ ๋ชจ๋“ˆ์€ ์‰ผํ‘œ๋กœ ๊ตฌ๋ถ„๋˜์–ด์•ผ ํ•˜๋ฉฐ ๊ณต๋ฐฑ์ด ์—†์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.
    $ cat /boot/cmdline.txt
    ์ถœ๋ ฅ์€ ๋‹ค์Œ ์ค„๊ณผ ์œ ์‚ฌํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. *modules-load *:
    console=serial0,115200 console=tty1 root=PARTUUID=fb57ee21-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait modules-load=dwc2,g_ether

    ์‚ฌ์šฉ์ž ๊ณต๊ฐ„ /dev



    udev์— ์ƒˆ ๊ทœ์น™ ์„ธํŠธ๋ฅผ ์ถ”๊ฐ€ํ•˜์‹ญ์‹œ์˜ค. ์ƒˆ ํŒŒ์ผ์„ ๋งŒ๋“ค๋ฉด 90-picluster.rules๋ผ๊ณ  ํ•ฉ๋‹ˆ๋‹ค.$ touch /etc/udev/rules.d/90-picluster.rules
    ์ธํ„ฐํŽ˜์ด์Šค๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๊ฐ ์žฅ์น˜ MAC์„ ๋งคํ•‘ํ•ฉ๋‹ˆ๋‹ค.

    ๋…ธ์˜ˆ pisrv03์˜ ๊ฒฝ์šฐSUBSYSTEM=="net", ATTR{address}=="00:22:82:ff:ff:03", NAME="eth3pi"
    ๋…ธ์˜ˆ pisrv04์˜ ๊ฒฝ์šฐ
    SUBSYSTEM=="net", ATTR{address}=="00:22:82:ff:ff:04", NAME="eth4pi"
    ๋“ฑ๋“ฑ.

    90-picluster.rules๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์•„์•ผ ํ•ฉ๋‹ˆ๋‹ค.

    SUBSYSTEM=="net", ATTR{address}=="00:22:82:ff:ff:03", NAME="eth3pi"
    SUBSYSTEM=="net", ATTR{address}=="00:22:82:ff:ff:04", NAME="eth4pi"
    


    DHCP



    ๋งˆ์ง€๋ง‰์œผ๋กœ DHCPCD ๊ตฌ์„ฑ ํŒŒ์ผ(์ผ๋ฐ˜์ ์œผ๋กœ /etc/dhcpcd.conf)์„ ํŽธ์ง‘ํ•˜๊ณ  ๊ฐ ์Šฌ๋ ˆ์ด๋ธŒ์— ๋กœ์ปฌ IP ๋ฒ”์œ„๋ฅผ ์ง€์ •ํ•ฉ๋‹ˆ๋‹ค.

    interface eth3pi
    static ip_address=10.0.13.1/24
    
    interface eth4pi
    static ip_address=10.0.14.1/24
    

    ์ข‹์€ ์›นํŽ˜์ด์ง€ ์ฆ๊ฒจ์ฐพ๊ธฐ