embeded/raspberry pi2020. 5. 24. 14:07

raspivid 와 몇가지 유틸리티 이용해서 스트리밍 하고

안드로이드에서 h264 스트림을 디코딩해서 출력해주는 녀석.

이걸 이용하면 내가 원하는걸 빨리 만들수 있을듯?

 

[링크 : http://frozen.ca/streaming-raw-h-264-from-a-raspberry-pi/]

[링크 : http://frozen.ca/rpi-camera-viewer-for-android/]

 

[링크 : https://play.google.com/store/apps/details?id=ca.frozen.rpicameraviewer]

Posted by 구차니
embeded/raspberry pi2020. 5. 16. 10:00

ht_capab 에서 HT40으로 되어있어서 에러가 나던데

일단은 conf 파일 예제에 있던 대로 HT40- 으로 하니 문제없이 작동하긴 한다.

ht_capab=[HT40-][SHORT-GI-20][SHORT-GI-40]

[링크 : https://w1.fi/cgit/hostap/plain/hostapd/hostapd.conf]

 

로그를 분석해보니 HT40이 문제가 아니었군

 5월 16 09:46:44 raspberrypi kernel: WARN::dwc_otg_hcd_urb_dequeue:639: Timed out waiting for FSM NP transfer to complete on 0
 5월 16 09:46:45 raspberrypi kernel: IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
 5월 16 09:46:45 raspberrypi hostapd[1455]: Driver does not support configured HT capability [DSSS_CCK-40]
 5월 16 09:46:45 raspberrypi hostapd[1455]: wlan0: interface state UNINITIALIZED->DISABLED
 5월 16 09:46:45 raspberrypi hostapd[1455]: wlan0: AP-DISABLED
 5월 16 09:46:45 raspberrypi hostapd[1455]: wlan0: Unable to setup interface.
 5월 16 09:46:45 raspberrypi hostapd[1455]: wlan0: interface state DISABLED->DISABLED
 5월 16 09:46:45 raspberrypi hostapd[1455]: wlan0: AP-DISABLED
 5월 16 09:46:45 raspberrypi hostapd[1455]: wlan0: CTRL-EVENT-TERMINATING
 5월 16 09:46:45 raspberrypi hostapd[1455]: hostapd_free_hapd_data: Interface wlan0 wasn't started
 5월 16 09:46:45 raspberrypi hostapd[1455]: nl80211: deinit ifname=wlan0 disabled_11b_rates=0
 5월 16 09:46:45 raspberrypi kernel: WARN::dwc_otg_hcd_urb_dequeue:639: Timed out waiting for FSM NP transfer to complete on 7
 5월 16 09:46:45 raspberrypi systemd[1]: hostapd.service: Control process exited, code=exited, status=1/FAILURE

 

iwlist 명령을 통해서 capability를 볼 수 있는 듯

$ iw list
Wiphy phy0
        max # scan SSIDs: 4
        max scan IEs length: 2257 bytes
        max # sched scan SSIDs: 0
        max # match sets: 0
        max # scan plans: 1
        max scan plan interval: -1
        max scan plan iterations: 0
        Retry short long limit: 2
        Coverage class: 0 (up to 0m)
        Device supports RSN-IBSS.
        Supported Ciphers:
                * WEP40 (00-0f-ac:1)
                * WEP104 (00-0f-ac:5)
                * TKIP (00-0f-ac:2)
                * CCMP-128 (00-0f-ac:4)
                * CCMP-256 (00-0f-ac:10)
                * GCMP-128 (00-0f-ac:8)
                * GCMP-256 (00-0f-ac:9)
        Available Antennas: TX 0 RX 0
        Supported interface modes:
                 * IBSS
                 * managed
                 * AP
                 * AP/VLAN
                 * monitor
                 * mesh point
        Band 1:
                Capabilities: 0x17e
                        HT20/HT40
                        SM Power Save disabled
                        RX Greenfield
                        RX HT20 SGI
                        RX HT40 SGI
                        RX STBC 1-stream
                        Max AMSDU length: 3839 bytes
                        No DSSS/CCK HT40
                Maximum RX AMPDU length 32767 bytes (exponent: 0x002)
                Minimum RX AMPDU time spacing: 2 usec (0x04)
                HT TX/RX MCS rate indexes supported: 0-7, 32
                Bitrates (non-HT):
                        * 1.0 Mbps
                        * 2.0 Mbps (short preamble supported)
                        * 5.5 Mbps (short preamble supported)
                        * 11.0 Mbps (short preamble supported)
                        * 6.0 Mbps
                        * 9.0 Mbps
                        * 12.0 Mbps
                        * 18.0 Mbps
                        * 24.0 Mbps
                        * 36.0 Mbps
                        * 48.0 Mbps
                        * 54.0 Mbps
                Frequencies:
                        * 2412 MHz [1] (20.0 dBm)
                        * 2417 MHz [2] (20.0 dBm)
                        * 2422 MHz [3] (20.0 dBm)
                        * 2427 MHz [4] (20.0 dBm)
                        * 2432 MHz [5] (20.0 dBm)
                        * 2437 MHz [6] (20.0 dBm)
                        * 2442 MHz [7] (20.0 dBm)
                        * 2447 MHz [8] (20.0 dBm)
                        * 2452 MHz [9] (20.0 dBm)
                        * 2457 MHz [10] (20.0 dBm)
                        * 2462 MHz [11] (20.0 dBm)
                        * 2467 MHz [12] (20.0 dBm) (no IR)
                        * 2472 MHz [13] (20.0 dBm) (no IR)
                        * 2484 MHz [14] (20.0 dBm) (no IR)
        Supported commands:
                 * new_interface
                 * set_interface
                 * new_key
                 * start_ap
                 * new_station
                 * new_mpath
                 * set_mesh_config
                 * set_bss
                 * authenticate
                 * associate
                 * deauthenticate
                 * disassociate
                 * join_ibss
                 * join_mesh
                 * set_tx_bitrate_mask
                 * frame
                 * frame_wait_cancel
                 * set_wiphy_netns
                 * set_channel
                 * set_wds_peer
                 * probe_client
                 * set_noack_map
                 * register_beacons
                 * start_p2p_device
                 * set_mcast_rate
                 * connect
                 * disconnect
                 * set_qos_map
                 * set_multicast_to_unicast
        Supported TX frame types:
                 * IBSS: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
                 * managed: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
                 * AP: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
                 * AP/VLAN: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
                 * mesh point: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
                 * P2P-client: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
                 * P2P-GO: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
                 * P2P-device: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
        Supported RX frame types:
                 * IBSS: 0x40 0xb0 0xc0 0xd0
                 * managed: 0x40 0xd0
                 * AP: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
                 * AP/VLAN: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
                 * mesh point: 0xb0 0xc0 0xd0
                 * P2P-client: 0x40 0xd0
                 * P2P-GO: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
                 * P2P-device: 0x40 0xd0
        software interface modes (can always be added):
                 * AP/VLAN
                 * monitor
        valid interface combinations:
                 * #{ AP, mesh point } <= 8,
                   total <= 8, #channels <= 1
        HT Capability overrides:
                 * MCS: ff ff ff ff ff ff ff ff ff ff
                 * maximum A-MSDU length
                 * supported channel width
                 * short GI for 40 MHz
                 * max A-MPDU length exponent
                 * min MPDU start spacing
        Device supports TX status socket option.
        Device supports HT-IBSS.
        Device supports SAE with AUTHENTICATE command
        Device supports low priority scan.
        Device supports scan flush.
        Device supports AP scan.
        Device supports per-vif TX power setting
        Driver supports full state transitions for AP/GO clients
        Driver supports a userspace MPM
        Device supports configuring vdev MAC-addr on create.
        Supported extended features:
                * [ RRM ]: RRM
                * [ FILS_STA ]: STA FILS (Fast Initial Link Setup)
                * [ CQM_RSSI_LIST ]: multiple CQM_RSSI_THOLD records
                * [ CONTROL_PORT_OVER_NL80211 ]: control port over nl80211

[링크 : https://unix.stackexchange.com/questions/405282/finding-capabilities-of-wifi-driver-device]

'embeded > raspberry pi' 카테고리의 다른 글

라즈베리 RC는 일단 구동에는 실패  (0) 2020.06.10
rpi / android h264 streaming  (0) 2020.05.24
hostapd 통신이 안되네? -> 되네!  (0) 2020.05.15
RC카 node.js was 제작 1차 완료  (0) 2020.05.14
node.js raspi-pwm  (0) 2020.05.14
Posted by 구차니
embeded/raspberry pi2020. 5. 15. 16:24

DHCP로 주소도 받아와서 핸드폰에서는 문제없이 되는줄 알았는데

노트북에서 해보니 ssh는 permission denied가 뜨고, nginx로 띄워둔 홈페이지는 접근이 되지 않는다.

 

도대체 핸드폰에서는 어떻게 되었던 거지?

 

+ 2020.05.16

다시 정신 차리고 해보니 자기 자신 아이피를 넣고 있으니 안되지 -_-

문제없이 잘된다.

+

 

그리고 hw_mode=g로 설정을 해놔서 802.11n을 지원하는 녀석임에도 불구하고 54Mbps로만 잡힌다.

둘다 테스트를 추가로 해봐야 할 듯..

# ieee80211n: Whether IEEE 802.11n (HT) is enabled
# 0 = disabled (default)
# 1 = enabled
# Note: You will also need to enable WMM for full HT functionality.
# Note: hw_mode=g (2.4 GHz) and hw_mode=a (5 GHz) is used to specify the band.
#ieee80211n=1

# ht_capab: HT capabilities (list of flags)
# LDPC coding capability: [LDPC] = supported
# Supported channel width set: [HT40-] = both 20 MHz and 40 MHz with secondary
# channel below the primary channel; [HT40+] = both 20 MHz and 40 MHz
# with secondary channel above the primary channel
# (20 MHz only if neither is set)
# Note: There are limits on which channels can be used with HT40- and
# HT40+. Following table shows the channels that may be available for
# HT40- and HT40+ use per IEEE 802.11n Annex J:
# freq HT40- HT40+
# 2.4 GHz 5-13 1-7 (1-9 in Europe/Japan)
# 5 GHz 40,48,56,64 36,44,52,60
# (depending on the location, not all of these channels may be available
# for use)
# Please note that 40 MHz channels may switch their primary and secondary
# channels if needed or creation of 40 MHz channel maybe rejected based
# on overlapping BSSes. These changes are done automatically when hostapd
# is setting up the 40 MHz channel.
# HT-greenfield: [GF] (disabled if not set)
# Short GI for 20 MHz: [SHORT-GI-20] (disabled if not set)
# Short GI for 40 MHz: [SHORT-GI-40] (disabled if not set)
# Tx STBC: [TX-STBC] (disabled if not set)
# Rx STBC: [RX-STBC1] (one spatial stream), [RX-STBC12] (one or two spatial
# streams), or [RX-STBC123] (one, two, or three spatial streams); Rx STBC
# disabled if none of these set
# HT-delayed Block Ack: [DELAYED-BA] (disabled if not set)
# Maximum A-MSDU length: [MAX-AMSDU-7935] for 7935 octets (3839 octets if not
# set)
# DSSS/CCK Mode in 40 MHz: [DSSS_CCK-40] = allowed (not allowed if not set)
# 40 MHz intolerant [40-INTOLERANT] (not advertised if not set)
# L-SIG TXOP protection support: [LSIG-TXOP-PROT] (disabled if not set)
#ht_capab=[HT40-][SHORT-GI-20][SHORT-GI-40]

[링크 : https://w1.fi/cgit/hostap/plain/hostapd/hostapd.conf]

[링크 : https://airpage.org/xe/project_data/24937]

'embeded > raspberry pi' 카테고리의 다른 글

rpi / android h264 streaming  (0) 2020.05.24
hostapd 802.11n 설정하기 시도중  (0) 2020.05.16
RC카 node.js was 제작 1차 완료  (0) 2020.05.14
node.js raspi-pwm  (0) 2020.05.14
node.js onoff  (0) 2020.05.13
Posted by 구차니
embeded/raspberry pi2020. 5. 14. 19:18

일단은 대충 예전 기억 되살려서 대충대충 만들었음

 

 

 

무선랜 카드가 하나뿐인걸 라즈베리에 해놔서 PC에서 테스트할 방법이 현재는 없어서

다이소에서 하나 사던가 해야 할 듯 -_ㅠ

 

ip:3000/api/f

ip:3000/api/r

ip:3000/api/s

 

ip:3000/api/wl

ip:3000/api/ws

ip:3000/api/wr

 

으로 명령을 주도록 했고 PWM은 100%로 설정함

코드 복사하기에는 여러개라 귀찮으니 github를 이용하는 걸로 결정

 

이제.. 안드로이드 앱 만들면 되는건가...

 

[링크 : https://github.com/minimonk82/rpi_nodejs_rc/]

'embeded > raspberry pi' 카테고리의 다른 글

hostapd 802.11n 설정하기 시도중  (0) 2020.05.16
hostapd 통신이 안되네? -> 되네!  (0) 2020.05.15
node.js raspi-pwm  (0) 2020.05.14
node.js onoff  (0) 2020.05.13
라즈베리 파이 무선공유기 만들기(비밀번호 없이)  (0) 2020.05.13
Posted by 구차니
embeded/raspberry pi2020. 5. 14. 10:20

일단 코드가 작동하는건 확인

얘는 핀헤더 번호 - 핀 번호 식으로 붙게 되어있어서 오히려 더 편하다고 해야하려나?

 

const raspi = require('raspi');
const pwm = require('raspi-pwm');
const Gpio = require('onoff').Gpio;

raspi.init(() => {
  const led = new pwm.PWM('P1-33');
  led.write(0.3); // 50% Duty Cycle, aka half brightness
});

var in1 = new Gpio(5, 'out')
var in2 = new Gpio(6, 'out')

in1.writeSync(1)
in2.writeSync(0)

 

[링크 : https://www.npmjs.com/package/raspi-pwm]

'embeded > raspberry pi' 카테고리의 다른 글

hostapd 통신이 안되네? -> 되네!  (0) 2020.05.15
RC카 node.js was 제작 1차 완료  (0) 2020.05.14
node.js onoff  (0) 2020.05.13
라즈베리 파이 무선공유기 만들기(비밀번호 없이)  (0) 2020.05.13
dhcpcd 설정  (0) 2020.05.13
Posted by 구차니
embeded/raspberry pi2020. 5. 13. 21:50

wiringpi와는 다르게 BCM 쪽의 번호를 써야 하는 차이가 있다.

그리고 onoff 모듈은 pwm은 지원하지 않아서 다른걸 써야 할 듯..

 

아래는 gpio 유틸리티로 설정하는 부분 이고 아래의 포트는

// 초기설정
sudo gpio mode 21 out
sudo gpio mode 22 out
sudo gpio mode 23 pwm

 

node.js onoff 에서는 다음과 같이 다른 번호를 사용하게 된다.

const Gpio = require('onoff').Gpio;

var in1 = new Gpio(5, 'out')
var in2 = new Gpio(6, 'out')
var in0 = new Gpio(13, 'out')

in1.writeSync(1)
in2.writeSync(0)
in0.writeSync(1)

 

 

[링크 : https://www.npmjs.com/package/onoff]

 

 

PWM 지원하는 녀석 이라는데 코드를 막상보면

PWM을 하드웨어로 구현하는게 아니라 타이머를 이용해서 소프트웨어 PWM으로 구현한 듯

const Gpio = require('pigpio').Gpio;
 
const led = new Gpio(17, {mode: Gpio.OUTPUT});
 
let dutyCycle = 0;
 
setInterval(() => {
  led.pwmWrite(dutyCycle);
 
  dutyCycle += 5;
  if (dutyCycle > 255) {
    dutyCycle = 0;
  }
}, 20);


[링크 : https://github.com/fivdi/pigpio]

Posted by 구차니
embeded/raspberry pi2020. 5. 13. 20:23

패키지 설치

$ sudo apt-get install hostapd dnsmasq

 

hostapd 설정

wpa_로 시작하는 것을 주석풀면 WPA-PSK로 암호 '1234567890' 을 사용 AP를 구동한다.

$ cat /etc/hostapd/hostapd.conf
interface=wlan0
hw_mode=g
channel=7
wmm_enabled=0
ignore_broadcast_ssid=0
ssid=NETWORK

macaddr_acl=0
auth_algs=1
#wpa=2
#wpa_passphrase=1234567890
#wpa_key_mgmt=WPA-PSK
#wpa_pairwise=TKIP
#rsn_pairwise=CCMP

 

dnsmasq 설정

dhcpcd 필요한줄 알았는데 dhcpcd 없이 바로 구동된다.

$ cat /etc/dnsmasq.conf

interface=wlan0 

  dhcp-range=192.168.0.11,192.168.0.30,255.255.255.0,24h

 

+

테스트용으로 nginx 설치하고, 핸드폰으로 해당 AP에 접속하고

크롬을 통해 192.168.0.10 으로 접속하니 ngnix 페이지가 정상적으로 뜬다.

$ ifconfig wlan0
wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.10  netmask 255.255.255.0  broadcast 192.168.0.255
        inet6 fe80::a73b:b28c:e97:7810  prefixlen 64  scopeid 0x20<link>
        ether 4c:e6:76:90:50:d5  txqueuelen 1000  (Ethernet)
        RX packets 1014  bytes 151616 (148.0 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 931  bytes 152637 (149.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

'embeded > raspberry pi' 카테고리의 다른 글

node.js raspi-pwm  (0) 2020.05.14
node.js onoff  (0) 2020.05.13
dhcpcd 설정  (0) 2020.05.13
라즈베리 파이 iwlist, iwconfig 로 무선접속하기  (0) 2020.05.09
라즈베리 파이 wifi AP로 설정하기  (0) 2020.05.09
Posted by 구차니
embeded/raspberry pi2020. 5. 13. 18:51

결론만 말하자면

dhcpcd 만으로는 무선 공유기 처럼 만드는건 실패.

dnsmasq가 있어야 한다.

 

+

테스트 해보니 dhcpcd 없이 hostapd + dnsmasq 만으로 ap가 만들어진다.

 

--

 

dhcpcd 패키지 설치해주고

아래의 설정내용을 넣어주면 끝.

 

$ sudo apt-cache search dhcpcd
dhcpcd - DHCP client for automatically configuring IPv4 networking
$ sudo vi /etc/dhcpcd.conf
interface wlan0
static ip_address=192.168.0.10/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1 8.8.8.8

[링크 : https://wiki.archlinux.org/index.php/dhcpcd]

 

+

기본 설정시 DHCP 잡는 임의 영역 IP인 169.254.71.x로 잡히는데

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 169.254.71.187  netmask 255.255.0.0  broadcast 169.254.255.255

 

dhcpcd.conf의 static_ip_address를 169.254.71.0/24로 설정하니

아래와 같이 carrier lost 뜨면서 되지 않는다.

아마 DHCP 잡는 reserved ip 영역이라 그런게 아닐까 추측됨.

$ systemctl status dhcpcd
● dhcpcd.service - dhcpcd on all interfaces
   Loaded: loaded (/lib/systemd/system/dhcpcd.service; enabled; vendor preset: enabled)
   Active: failed (Result: signal) since Wed 2020-05-13 18:23:15 KST; 5min ago
  Process: 1694 ExecStart=/usr/lib/dhcpcd5/dhcpcd -q -b (code=exited, status=0/SUCCESS)
 Main PID: 1696 (code=killed, signal=SEGV)

 5월 13 18:23:14 raspberrypi dhcpcd[1696]: wlan0: carrier acquired
 5월 13 18:23:14 raspberrypi dhcpcd[1696]: wlan0: IAID 76:90:50:d5
 5월 13 18:23:14 raspberrypi dhcpcd[1696]: wlan0: adding address fe80::a73b:b28c:e97:7810
 5월 13 18:23:14 raspberrypi dhcpcd[1696]: wlan0: using static address 169.254.71.187/24
 5월 13 18:23:14 raspberrypi dhcpcd[1696]: wlan0: adding route to 169.254.71.0/24
 5월 13 18:23:14 raspberrypi dhcpcd[1696]: wlan0: carrier lost
 5월 13 18:23:14 raspberrypi dhcpcd[1696]: wlan0: deleting address fe80::a73b:b28c:e97:7810
 5월 13 18:23:15 raspberrypi dhcpcd[1696]: wlan0: deleting route to 169.254.71.0/24
 5월 13 18:23:15 raspberrypi systemd[1]: dhcpcd.service: Main process exited, code=killed, status=11/SEGV
 5월 13 18:23:15 raspberrypi systemd[1]: dhcpcd.service: Failed with result 'signal'.

 

$ dmesg
[  542.390642] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
[  542.423897] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
[  542.451050] WARN::dwc_otg_hcd_urb_dequeue:639: Timed out waiting for FSM NP transfer to complete on 0
[  543.220943] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
[  543.922372] WARN::dwc_otg_hcd_urb_dequeue:639: Timed out waiting for FSM NP transfer to complete on 3

 

+

ip 주소를 가져오는 중에서 넘어가질 않네..

인증이 문제인가?

Posted by 구차니
embeded/raspberry pi2020. 5. 9. 22:53

라즈베리 파이 2B / debian 10.3 이미지 사용

buffalo WLI-UC-GNM 802.11n 어댑터 사용

 

 

무선랜 스캔

$ iwlist wlan0 scan

 

무선랜 설정 (무선랜 이름이 iptime 일 경우)

$ sudo iwconfig wlan0 essid "iptime"

 

WPA_PSK 키 설정 (iptime 공유기의 무선랜 암호가 password일 경우)

(단, root 계정으로 하지 않으면 wpa_passphrase 실행 결과를 복사해서 sudo로 conf 파일에 넣어야 함)

wpa_passphrase "iptime" password > /etc/wpa_supplicant/wpa_supplicant.conf

 

무선랜 접속

아래의 명령어가 실행중인 동안에만 유지가 된다.

sudo wpa_supplicant -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf

 

[링크 : https://lhjin.tistory.com/entry/리눅스에서-무선랜WiFi-사용방법]

[링크 : http://webterror.net/?p=783]

 

 

그럼 이제 이걸.. 기본 데몬으로 가능한 방법을 찾으면 되려나?

 

+

wpa_supllicant.conf 파일에 내용이 존재하면 자동으로 그걸 이용해서 접속하도록 되어있다.

reboot 이후 정상적으로 접속되는 것을 확인함

 

[링크 : https://weworkweplay.com/play/automatically-connect-a-raspberry-pi-to-a-wifi-network/]

'embeded > raspberry pi' 카테고리의 다른 글

라즈베리 파이 무선공유기 만들기(비밀번호 없이)  (0) 2020.05.13
dhcpcd 설정  (0) 2020.05.13
라즈베리 파이 wifi AP로 설정하기  (0) 2020.05.09
GND가 문제였군..  (0) 2020.05.05
라즈베리 + L298N 실패..  (0) 2020.04.30
Posted by 구차니
embeded/raspberry pi2020. 5. 9. 21:37

hostapd만 설치하고 open system 으로 설정하니

ip 주소를 받아오지 못해서 핸드폰에서 정상적으로 접속하지 못한다.

dnsmasq를 꼭 깔아야 하려나? dhcpcd만 깔면되려나..

 

----

 

hostapd / dnsmasq 두개가 debian 계열 패키지로 제공되는 녀석인 듯

드론 처럼 wifi AP로만 쓰고 외부로 접속을 공유해주는 '무선공유기'를 만들게 아니라면

dnsmasq는 쓸데 없을 것 같긴한데..

dnsmasq에 dhcpcd 가 포함이 되는거라면 hostapd / dhcpcd 두개를 설치하는 것이 내가 원하는 방향이 될 듯 하다.

 

$ sudo apt install hostapd

[링크 : https://thepi.io/how-to-use-your-raspberry-pi-as-a-wireless-access-point/]

[링크 : https://airpage.org/xe/project_data/24937]

[링크 : https://fishpoint.tistory.com/2159]

 

+

$ systemctl status hostapd
● hostapd.service
   Loaded: masked (Reason: Unit hostapd.service is masked.)
   Active: failed (Result: exit-code) since Sat 2020-05-09 23:02:20 KST; 11min ago

 5월 09 23:02:20 raspberrypi systemd[1]: hostapd.service: Service RestartSec=100ms expired, scheduling restart.
 5월 09 23:02:20 raspberrypi systemd[1]: hostapd.service: Failed to schedule restart job: Unit hostapd.service is masked.
 5월 09 23:02:20 raspberrypi systemd[1]: hostapd.service: Failed with result 'exit-code'.

 

구동이 안되네?

$ sudo service hostapd restart
Failed to restart hostapd.service: Unit hostapd.service is masked.

 

masked는 첨 보는데.. 찾아보니 unmask 라는걸로 풀어주고 하면 문제가 없다.

$ sudo systemctl unmask hostapd
$ sudo systemctl enable hostapd
$ sudo systemctl start hostapd

 

아무튼.. 데몬을 실행하니 아래와 같이 아이피 하나 잡혀주긴 한다.

$ ifconfig wlan0
wlan0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 4c:e6:76:90:50:d5  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

$ ifconfig wlan0
wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 169.254.71.187  netmask 255.255.0.0  broadcast 169.254.255.255
        inet6 fe80::a73b:b28c:e97:7810  prefixlen 64  scopeid 0x20<link>
        ether 4c:e6:76:90:50:d5  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 30  bytes 5854 (5.7 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

 

핸드폰에서 확인하니 NETWORK 라는 무선 AP가 생겨났지만

PASSWORD라고 암호를 설정해준 것이 문제인지 인증 과정에서 넘어가질 못한다.

[링크 : https://www.diymaker.net/143]

 

+

wpa=0

auth_algs=1

위와 같이 하면 open system authentication으로 암호없이 접속은 가능해진다.

auth_algs=0 으로 하면 "no authentication algorithms allowed" 에러가 뜨며 데몬이 정상적으로 구동되지 않는다.

 

##### WPA/IEEE 802.11i configuration ##########################################

# Enable WPA. Setting this variable configures the AP to require WPA (either
# WPA-PSK or WPA-RADIUS/EAP based on other configuration). For WPA-PSK, either
# wpa_psk or wpa_passphrase must be set and wpa_key_mgmt must include WPA-PSK.
# Instead of wpa_psk / wpa_passphrase, wpa_psk_radius might suffice.
# For WPA-RADIUS/EAP, ieee8021x must be set (but without dynamic WEP keys),
# RADIUS authentication server must be configured, and WPA-EAP must be included
# in wpa_key_mgmt.
# This field is a bit field that can be used to enable WPA (IEEE 802.11i/D3.0)
# and/or WPA2 (full IEEE 802.11i/RSN):
# bit0 = WPA
# bit1 = IEEE 802.11i/RSN (WPA2) (dot11RSNAEnabled)
# Note that WPA3 is also configured with bit1 since it uses RSN just like WPA2.
# In other words, for WPA3, wpa=2 is used the configuration (and
# wpa_key_mgmt=SAE for WPA3-Personal instead of wpa_key_mgmt=WPA-PSK).
#wpa=2

# IEEE 802.11 specifies two authentication algorithms. hostapd can be
# configured to allow both of these or only one. Open system authentication
# should be used with IEEE 802.1X.
# Bit fields of allowed authentication algorithms:
# bit 0 = Open System Authentication
# bit 1 = Shared Key Authentication (requires WEP)
auth_algs=3

[링크 : https://w1.fi/cgit/hostap/plain/hostapd/hostapd.conf]

 

+ 2020.05.13

wpa=0 이 아니라 wpa 를 아예 설정하지 않으면 암호 없는 네트워크로 설정된다.

 

[링크 : http://nitlab.inf.uth.gr/mazi-guides/accessPoint.html]

'embeded > raspberry pi' 카테고리의 다른 글

dhcpcd 설정  (0) 2020.05.13
라즈베리 파이 iwlist, iwconfig 로 무선접속하기  (0) 2020.05.09
GND가 문제였군..  (0) 2020.05.05
라즈베리 + L298N 실패..  (0) 2020.04.30
라즈베리 파이 pinout 유틸리티  (0) 2020.04.30
Posted by 구차니