Skip to content

Setting static IP address on a Pi

Mike Ounsworth edited this page Mar 8, 2018 · 2 revisions

Setting up Wifi

These are the steps I used to setup the wireless networking on the PI (direct modification of /etc/network/interfaces). This might help you disabke it and set a static IP address.

Ken.

# Enable wireless access to merge-net
# /etc/network/interfaces should look like...

# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

iface eth0 inet manual

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

allow-hotplug wlan1
iface wlan1 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

iface default inet dhcp

# Backup wpa_supplicant.conf
> sudo cp /etc/wpa_supplicant/wpa_supplicant.conf /etc/wpa_supplicant/wpa_supplicant.conf.orig

# Generate encrypted passphrase
> wpa_passphrase merge-net team2706

# Update /etc/wpa_supplicant/wpa_supplicant.conf with output of above plus
# NOTE NOTE NOTE
# pairwise=CCMP, group=CCMP is required for bell router ar home
# pairwise=CCMP, group=TKIP required for dlink router (mergenet)
# wpa_cli very useful for debugginf (scan, scn_results, list_networks, reconfigure, enable_network)
> sudo vi /etc/wpa_supplicant/wpa_supplicant.conf
country=CA
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
  ssid="merge-net"
  scan_ssid=1
  psk=<value>
  mode=0
  proto=WPA2
  key_mgmt=WPA-PSK
  pairwise=CCMP
  group=TKIP
  auth_alg=OPEN
  id_str="grove1"
  priority=1
}

> sudo reboot

Setting up the wired network

# Enable static IP on the robot network
# /etc/network/interfaces should look like...

auto eth0
iface eth0 inet static
    address 10.27.6.240
    netmask 255.0.0.0
    gateway 10.27.6.1

> sudo reboot

Clone this wiki locally