SD cards for RPi

https://elinux.org/RPi_SD_cards

 

Get host IP in LAN

hostname -I

/sbin/ifconfig [-a]

ip addr show eth0

 

For a static IP address on an Ethernet connection:
  1. sudo nano /etc/dhcpcd.conf.
  2. Type in the following lines on the top of the file: 
    interface eth0 staticip_address=192.168.1.XX/24 static routers=192.168.1.1 staticdomain_name_servers=192.168.1.1
    interface eth0 staticip_address=10.0.1.XX/24 static routers=10.0.1.26 staticdomain_name_servers=10.0.1.26
  3. sudo reboot.

sudo leafpad /etc/dhcpcd.conf

-------------------

interface eth0
static ip_address=10.0.1.3/24
static routers=10.0.1.1
static domain_name_servers=10.0.1.1

interface wlan0
static ip_address=10.0.1.3/24
static routers=10.0.1.1
static domain_name_servers=10.0.1.1

Get router external WAN IP

 

google for: how to get wan router ip in lan raspberry pi

curl -s "http://whatismyip.org/"
sudo apt-get install curl

 

wget http://aschillings.co.uk/myscripts/getip.php

wget -q -O- icanhazip.com


Or if your router has a HTML admin interface and you have the router admin username and password, you could wget the relevant config page and grep ... DOES NOT WORK FOR Airport Extreme

 

import urllib2
ip = urllib2.urlopen("http://automation.whatismyip.com/n09230945.asp").read()

 

from requests import get

ip = get('https://api.ipify.org').text

 

import urllib.request
external_ip = urllib.request.urlopen('https://ident.me').read().decode('utf8')
print(external_ip)

Airport Extreme configuration

Airport Extreme can be configured through the AirPort_Utility ONLY!!! There is no web interface....

Set static IP address

for raspbery pi in LAN (10.0.1.3)

AirPort_Utility (V7.7.9, 10.0.1.1) -> Manual Setup  -> Internet -> DHCP -> + -> Description: raspberrypi, MAC Address -> Continue -> b8:27:eb:f3:0a:74 ...

AirPort_Utility (V7.7.9, 10.0.1.1) -> Manual Setup  -> Internet -> DHCP -> + -> Description: "Home raspberrypi", DHCP Client Id: raspberrypi, 10.0.1.3

Port Forwarding

AirPort_Utility (V7.7.9, 10.0.1.1) -> Manual Setup  -> Advanced > Port Mapping ->"Home raspberrypi", 10.0.1.3, port-number

Add and remove user

$sudo -s
$adduser username
$usermod -a -G adm,dialout,cdrom,sudo,audio,video,plugdev,games,users,input,netdev,gpio,i2c,spi username 

Turn off "Login as user pi" in Menu -> Preferences -> Raspberry Pi Configuration -> System

$reboot
$deluser --remove-home pi

 

Editor

leafpad, vi, idle are installed

sudo apt-get install emacs

sudo apt-get install vim

 

Setup get

git config --global user.name <my-name>

git config --global user.email <my@email>

git config -l

 

Find MAC address

 

cat /sys/class/net/wlan0/address : b8:27:eb:f3:0a:74

cat /sys/class/net/eth0/address : b8:27:eb:a6:5f:21

 

 

 

 

  • No labels