28
Help us understand the problem. What are the problem?

More than 5 years have passed since last update.

posted at

updated at

Raspberry PiをPocket Wifiで固定IPにする

Raspberry Piを固定IPにする設定

イーモバイルのWifiルーターは暗号化方式をWEPとWPAをきりかえられるようになっているようですが、wpa_supplicant.confの設定方法が異なるようです。

/etc/network/interfacesの設定

$ sudo nano /etc/network/interfaces

DHCP

/etc/network/interfaces
auto lo
iface lo inet loopback
allow-hotplug eth0
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

固定IP

/etc/network/interfaces
auto lo

allow-hotplug wlan0
iface lo inet loopback

iface wlan0 inet static
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
address 192.168.1.50
network 192.168.1.0
netmask 255.255.255.0
broadcast 192.168.1.255
gateway 192.168.1.1
dns-nameservers 8.8.8.8

iface eth0 inet static
address 192.168.1.51
network 192.168.1.0
netmask 255.255.255.0
broadcast 192.168.1.255

Pocket Wifiと接続する設定

/etc/wpa_supplicant/wpa_supplicant.confの設定

$ sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

DHCP

/etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=DIR/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
  ssid="xxxxxxxx"
  scan_ssid=1
  psk="xxxxxxxx"
  proto=RSN
  key_mgmt=WPA-PSK
  pairwise=CCMP
  auto_alg=OPEN
}

固定IP

WEPモード

/etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
  scan_ssid=1
  key_mgmt=NONE
  ssid="xxxxxxxx"
  wep_key0="xxxxxxxx"
  wep_tx_keyidx=0
}

WPA2モード

/etc/wpa_supplicant/wpa_supplicant.conf

DNSの設定

/etc/resolv.confの設定

$ sudo nano /etc/resolv.conf
/etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4

設定を反映させる

$ sudo /etc/init.d/networking reload

本体を再起動しないと反映しないかもしれないです。

$ sudo shutdown -r now

Register as a new user and use Qiita more conveniently

  1. You can follow users and tags
  2. you can stock useful information
  3. You can make editorial suggestions for articles
What you can do with signing up
28
Help us understand the problem. What are the problem?