Tag Archives: Raspberry

Configure static IP on Raspberry

Initial checkup

List the network interface we currently have available:

The line
iface eth0 inet dhcp
means that we’re currently getting out IP address via DHCP, meaning it’s being dynamically registered by the router. This is what we want to change!

Get info about raspberry:

keep note the following information:
inet addr – 192.168.1.2 (Pi’s Current IP Address)
Bcast – 192.168.1.255 (The Broadcast IP Range)
Mask – 255.255.255.0 (Subnet Mask Address)

Get info about router:

(N.B. even route -n return the same info)

keep note the following information:
Gateway Address – 192.168.1.1
Destination Address – 192.168.1.0

Edit Network Configuration

edit /etc/network/interfaces

change the line:
iface eth0 inet dhcp
to
iface eth0 inet static

now, directly below this line, configure the following:

Brief explanation of paramenters:
address – The address you want to give your Pi, this can be any IP in the network range, but it’s usually advisable to go higher rather than lower, or you could end up logging different devices to the same IP! I’ve selected 192.168.1.81, as we’re already registered to that address (denoted by ‘inet addr’), but this can be any IP address from the range192.168.1.1 to 192.168.1.255.
netmask – The ‘Mask’ address we wrote down earlier.
network – The router IP address, this is the ‘Destination’ Address was found earlier. You can also grab this off your router, it will say on the side somewhere.
broadcast – The ‘Bcast’ address we wrote down earlier.
gateway – This is the ‘Gateway’ address we found earlier.

now, restart raspberry

Reference

Raspberry Pi as wifi router

Install required packages

  • rfkill: a wireless utility
  • zd1211-firmware: common firmware that works with many Wi-Fi dongles
  • hostapd: the hostap wireless access point daemon
  • hostap-utils: supplemental hostap tools
  • iw: wireless configuration utility
  • dnsmasq: DHCP and DNS utility
  • bridge-utils:  used for connecting multiple Ethernet devices together

Getting WiFi adapter running

Check that the RPi recognizes the Wi-Fi dongle.

or

Verify that the Wi-Fi dongle supports AP mode

Configure the Wireless Interface

Make a backup of /etc/network/interfaces and then open it in a text editor:

edit /etc/network/interfaces as below:

Restart the wlan0 interface:

Configure hostapd Settings

edit /etc/hostapd/hostapd.conf as below:

configure

Configure dnsmasq Settings

configure /etc/dnsmasq.conf with

After saving the file, you can easily verify all the settings were correct with the following command (it just parses out the comments and blank lines):

Restart the dnsmasq service to apply the settings:

Enable Forwarding to Reach the Internet

Enable IPv4 forwarding

Enable NAT

References

USB Hard Disks on Raspberry

List all Hard Disks

List mounted FIle Systems

List File Systems size

Add, remove and modify partitions

Format partition to ext4

Mount partition

Make partition writable by pi user

Unmount partition

Reference:

Cheat Sheet – USB drives

cgminer on Raspberry

install cgminer

set permissions on usb devices

start cgminer

activate web interface

web interface is available at http://your-raspberrypi-ip/miner.php

keep cgminer running

edit /etc/supervisor/conf.d/cgminer.conf as follow:

reboot