1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

RaspberryPiにWifiAPとEthernetを設定 nmcli無し

Last updated at Posted at 2024-03-22

参考
https://www.mikan-tech.net/entry/raspi-wifi-ap
https://raspida.com/rpi-wifi-ap

wlan0用DHCPServerを追加

sudo apt -y install dnsmasq

wlan0のDHCP割り振りアドレス範囲を設定

$ sudo vi /etc/dnsmasq.conf
長いので省略
以下を末尾に追加
interface=wlan0
dhcp-range=192.168.249.50,192.168.249.150,255.255.255.0,12h
$ sudo systemctl restart dnsmasq

wlan0用アクセスポイントを追加

sudo apt -y install hostapd

dhcpcdが稼働しないのでdhcpcd.confを使わない

$ sudo vi /etc/dhcpcd.conf
新規作成
# denyinterfaces wlan0
# interface wlan0
# static ip_address=192.168.249.1/24
# nohook wpa_supplicant

アクセスポイントの条件を設定

$ sudo vi /etc/hostapd/hostapd.conf
新規作成
interface=wlan0
driver=nl80211
hw_mode=g
country_code=JP
# channel=3
wpa=2
wpa_key_mgmt=WPA-PSK
rsn_pairwise=CCMP
ssid=RPiAP
wpa_passphrase=1234567890123456

参考 https://qiita.com/JhonnyBravo/items/5df2d9b2fcb142b6a67c
アクセスポイント設定を有効に

$ sudo vi /etc/default/hostapd
以下を有効に
#DAEMON_CONF=""
DAEMON_CONF="/etc/hostapd/hostapd.conf"

これは無変更みたい wpa_supplicant.conf

$ sudo vi /etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
以下を末尾に追加
# country=JP

wlan0のIPアドレスを設定

$ sudo vi /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
# Include files from /etc/network/interfaces.d:
source /etc/network/interfaces.d/*
以下を末尾に追加
allow-hotplug wlan0
iface wlan0 inet static
address 192.168.249.1
netmask 255.255.255.0
sudo systemctl unmask hostapd
sudo systemctl enable hostapd
sudo systemctl start hostapd

Ethernetの静的アドレスを設定

ぐぐると/etc/dhcpcd.confで設定とあるが駄目で、 /etc/network/interfacesを使用
「DHCPCD is not installed on bookworm」https://www.reddit.com/r/raspberry_pi/comments/17l10wr/how_to_set_static_ip_on_raspberry_pi_4b_64bit_lite/

$ sudo vi /etc/network/interfaces
以下を末尾に追加
auto eth0
iface eth0 inet static
address 192.168.213.80
netmask 255.255.255.0
auto eth1
iface eth1 inet static
address 192.168.13.80
netmask 255.255.255.0

dhcpcdが稼働しないのでdhcpcd.confを使わない

$ sudo vi /etc/dhcpcd.conf
以下を末尾に追加
# interface eth0
# static ip_address=192.168.213.80/24
# interface eth1
# static ip_address=192.168.13.80/24

備忘録

ブリッジ化
https://kassyjp.ninja-web.net/ras/jessie/bridge.htm
hostapd_cliコマンド
https://www.macnica.co.jp/business/semiconductor/articles/qualcomm/142745/

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?