Open eubnara opened 1 year ago
❯ iw reg set
Usage: iw [options] reg set <ISO/IEC 3166-1 alpha2>
Notify the kernel about the current regulatory domain.
Options:
--debug enable netlink debugging
https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
❯ sudo iw reg set KR
❯ iw reg get
global
country 98: DFS-UNSET
(2400 - 2472 @ 40), (N/A, 23), (N/A)
(5150 - 5230 @ 80), (N/A, 23), (N/A), AUTO-BW
(5230 - 5250 @ 20), (N/A, 17), (N/A), AUTO-BW
(5250 - 5350 @ 100), (N/A, 20), (0 ms), DFS, AUTO-BW
(5470 - 5725 @ 160), (N/A, 20), (0 ms), DFS
(5725 - 5730 @ 5), (N/A, 23), (0 ms), DFS
(5730 - 5850 @ 80), (N/A, 23), (N/A)
(5925 - 7125 @ 160), (N/A, 12), (N/A), NO-OUTDOOR, PASSIVE-SCAN
(57240 - 66000 @ 2160), (N/A, 40), (N/A)
phy#0
country 99: DFS-UNSET
(2402 - 2472 @ 40), (N/A, 20), (N/A)
(2457 - 2482 @ 40), (N/A, 20), (N/A), PASSIVE-SCAN
(5140 - 5360 @ 80), (N/A, 30), (N/A), PASSIVE-SCAN
(5460 - 5860 @ 80), (N/A, 30), (N/A), PASSIVE-SCAN
재부팅하면 원상복구가 되어버린다. permanent 세팅 어떻게 할까.
https://wireless.wiki.kernel.org/en/users/documentation/wpa_supplicant#setting_the_regulatory_domain https://unix.stackexchange.com/questions/453329/where-is-my-etc-wpa-supplicant-conf-on-systemd
/etc/wpa_supplicant/wpa_supplicant.conf
파일 만들기 country=KR
내용 추가/lib/systemd/system/wpa_supplicant.service
내용을 /etc/systemd/system/wpa_supplicant.service
에 복사한 후 wap_supplicant
인자로 config 경로 추가하기 -c /etc/wpa_supplicant/wpa_supplicant.conf
[Unit]
Description=WPA supplicant
Before=network.target
After=dbus.service
Wants=network.target
IgnoreOnIsolate=true
[Service]
Type=dbus
BusName=fi.w1.wpa_supplicant1
ExecStart=/sbin/wpa_supplicant -c /etc/wpa_supplicant/wpa_supplicant.conf -u -s -O /run/wpa_supplicant
ExecReload=/bin/kill -HUP $MAINPID
[Install]
WantedBy=multi-user.target
Alias=dbus-fi.w1.wpa_supplicant1.service
위와 같이 하고 재부팅을 해봤지만, 동작하지 않았다. 로그에 다음 라인이 보인다. KR 로 세팅이 되지 않았다.
9월 21 08:57:37 eub-inspiron5505 wpa_supplicant[942]: wlp2s0: CTRL-EVENT-REGDOM-CHANGE init=COUNTRY_IE type=COUNTRY alpha2=US
● wpa_supplicant.service - WPA supplicant
Loaded: loaded (/etc/systemd/system/wpa_supplicant.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2022-10-28 09:17:28 KST; 32s ago
Main PID: 760 (wpa_supplicant)
Tasks: 1 (limit: 18294)
Memory: 6.5M
CPU: 38ms
CGroup: /system.slice/wpa_supplicant.service
└─760 /sbin/wpa_supplicant -c /etc/wpa_supplicant/wpa_supplicant.conf -u -s -O /run/wpa_supplicant
crda 패키지를 사용하면 됐었겠는데, 22.04 부터는 설치할 수가 없다.
https://bugs.launchpad.net/netplan/+bug/1951586
From jammy onwards, the regulatory database is now baked into the kernel, and the crda package is gone
❯ sudo dmesg | grep EEPROM
[ 5.913268] ath: EEPROM regdomain: 0x6c
[ 5.913270] ath: EEPROM indicates we should expect a direct regpair map
[ 21.105000] ath: EEPROM regdomain: 0x8348
[ 21.105001] ath: EEPROM indicates we should expect a country code
[ 21.105002] ath: doing EEPROM country->regdmn map search
❯ sudo cat /etc/sudoers.d/eub
eub ALL= NOPASSWD: /usr/sbin/iw
❯ cat ~/bin/change-regdom.sh
#!/bin/bash
sleep 3
sudo iw reg set KR > /tmp/change-regdom.out 2>&1
타이밍 이슈로 인해 3초 정도 딜레이를 주었다. 이미 실행되고 wifi 가 enabled 되면 의미가 없어진다.
나중에 crda 를 다시 쓸 수 있게 되거나 다른 대안이 나오면 그 방법을 써야할 것 같다.
그 전까지는 wifi enabled 후 iw reg set KR
을 직접 해주는 수밖에 없는 듯하다.
netplan 에서 설정할 수 있도록 패치가 되었지만, networkd 를 쓸 경우에만 사용이 가능하다. https://bugs.launchpad.net/netplan/+bug/1951586
gui 의 경우 NetworkManager 를 사용하는데
❯ cat /etc/netplan/01-network-manager-all.yaml
# Let NetworkManager manage all devices on this system
network:
version: 2
renderer: NetworkManager
NetworkManager
에 대해선 어떻게 설정을 해야할지 진행 중인 것으로 보인다.
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/960
https://superuser.com/questions/809282/wifi-5ghz-ap-mode-what-does-no-ir-means-and-can-i-bypass-it https://wireless.wiki.kernel.org/en/developers/Regulatory/CRDA#changing_regulatory_domains https://wireless.wiki.kernel.org/en/developers/Regulatory/CRDA#Using_iw_to_change_regulatory_domains
regulatory domain 미국으로 세팅되어 있어서?