Raspberry Pi als AccessPoint - AZ-Delivery

Come io, ancora una volta con il Raspberry Pi qualcosa che aveva fatto e ho un Sensore WIRELESS scommessa voluto, ho un Problema che si è verificato. Voglio il Raspberry Pi di un Sensore con connessione wi-FI, ho bisogno di un wi-fi GRATUITA, oltre dell'Hardware. Il Raspberry Pi ha un Modulo wi-FI, perché non è questo access point e Router risparmiare?

Come viene impostato, vi mostriamo oggi qui:

In questo Blog, possiamo utilizzare un Raspberry Pi 3 B+ e una Scheda SD con l'attuale Immagine di Raspbian Stretch Lite - Release date: 2018-10-09)

direttamente, senza Schermo il Raspberry Pi tramite SSH, è possibile configurare un File con il Nome "ssh" sulla Partizione di Boot preferiti. Questa è la Raspberry Pi eBook spiega in dettaglio qui solo come breve Nota.

Successivamente, abbiamo accesso al Raspberry Pi e un vollständies Aggiornamento:

sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade && sudo apt-get autoremove && sudo apt-get autoclean

Dopo il nostro Raspberry Pi ora è aggiornato, è possibile configurare la WIRELESS Interfaccia di rete con un IP fisso.

sudo nano /etc/network/interfaces

In un File scriviamo quanto segue:

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

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

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

# localhost
auto lo
iface lo inet loopback
# ethernet
auto eth0
iface eth0 inet dhcp
# WIRELESS interface
allow-hotplug wlan0
iface wlan0 inet static
address 192.168.222.1
netmask 255.255.255.0

Questa Configurazione fa sì che il Raspberry Pi ora l'Indirizzo IP 192.168.222.1 su wi-FI, Interfaccia riceve e Interfaccia LAN un Indirizzo IP viene assegnato dinamicamente.

Poiché il Raspberry Pi ora come "Server" desidera utilizzare, è necessario il Client DHCP sull'Interfaccia WIRELESS disattivare.

sudo nano /etc/dhcpd.conf

alla Fine del File completiamo la seguente Riga:

denyinterfaces wlan0

Quindi riavviare abbiamo il Raspberry Pi con:

sudo reboot

Dopo il Riavvio installare un server DHCP e DNS Server e configurare questo:

sudo apt-get install dnsmasq,

Se si vuole si può notare il vecchio backup della configurazione:
sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf_alt


sudo nano /etc/dnsmasq.conf

la Seguente configurazione in un File:

=interfaccia wlan0
no dhcp=interfaccia eth0
dhcp-range=192.168.222.10,192.168.222.200,12 h
dhcp-option=opzione:dns-server,192.168.222.1

Con questa Configurazione, il Raspberry ora un Server DNS sulla 192.168.222.1 a Disposizione e il Server DHCP assegna gli Indirizzi IP di 192.168.222.10 - 200. Su LAN Interfaccia di rete, il Server DHCP non è attivo.

Se siete i Valori modificati avete e/o test che volete, se la Configurazione è corretta che è stata acquisita, potete fare questo con questo Comando per verificare:

dnsmasq --test-C /etc/dnsmasq.conf

come Risposta dovrebbe essere "dnsmasq: syntax check OK." apparire.

Ora, diamo ancora un Avvio in modo che in Futuro tutto in automatico al Riavvio scalo:

sudo systemctl enable dnsmasq,

Quindi riavviare abbiamo il Raspberry Pi nuovo con:

sudo reboot

 

, Come ultimo Passo, attivare e installare un access point:

sudo apt-get install hostapd

sudo nano /etc/hostapd/hostapd.conf

Di Konfiguratonsinhalt:

=interfaccia wlan0 ssid=raspberry-fi channel=1 hw_mode=g ieee80211n=1 ieee80211d=1 country_code=IT wmm_enabled=1 auth_algs=1 wpa=2 wpa_key_mgmt=WPA-PSK rsn_pairwise=CCMP wpa_passphrase= " az-delivery

 

Con questa Konfiguraton creiamo ora un wi-FI Segnale sul Canale 1, con il Nome di "raspberry-wi-fi" e la Password "az-delivery".

Se la WLAN dovrebbe ora essere creata automaticamente dopo un riavvio, dobbiamo riattivarla nell'avvio automatico:

sudo nano / etc / default / hostapd

Aggiungiamo il seguente contenuto del file alla fine del file:

RUN_DAEMON = sì DAEMON_CONF = "/ etc / hostapd / hostapd.conf"

E quindi attivarlo nel sistema:

sudo systemctl start hostapd

sudo systemctl abilita hostapd

Ora possiamo riavviare Raspberry e richiamare lo stato in qualsiasi momento con questo comando:

sudo systemctl status hostapd

Ora vediamo una nuova rete WLAN nella nostra panoramica WLAN e possiamo collegarci a questa rete:

Dopo aver inserito la password:

az-consegna

Siamo già connessi?

Il server DHCP su Raspberry funziona anche perché assegna un indirizzo IP corretto dall'intervallo specificato:

Ora possiamo usare Raspberry come router per creare ulteriori progetti.

Ti auguriamo buon divertimento e facci sapere per cosa usi il "Raspberry Router".

Projekte für anfängerRaspberry piSmart home

14 commenti

Marco

Marco

Hallo zusammen.
Ich versuche gerade für einen Urlaub einen lokalen Medienserver aufzusetzen.
Ziel ist es einen RasPi zusammen mit einer Festplatte im Auto zu betreiben und in einem lokalen Netzwerk Medien auszutauschen.
Sollte mit einem RasPi 3b+ und minidlna eigentlich funktionieren.
Ich bin allerdings was den RasPi angeht absoluter Anfänger.
Habt ihr vielleicht Erfahrung mit so etwas machen können?
Gruss Marco

Marcel

Marcel

Hallo,

habe das Problem, dass sich mein RaspPi nach dem ersten reboot nicht mehr mit dem WLan Netzwerk verbindet. Das brauche ich ja aber um mich mit dem RaspPi zu verbinden.

DS61

DS61

Es scheint als müsste man bei Verwendung von dnsmasq zusätzlich auch die Datei /etc/resolv.conf anpassen. Hier muss ein DNS Server eingetragen werden, um Anfragen außerhalb des lokalen Netzes beantworten zu können. Also am besten die Adresse des eigentlichen Routers eintragen:

nameserver 127.0.0.1
nameserver 192.168.178.1

Beste Grüße

pit02

pit02

Hat alles geklappt, doch wenn ich den Raspi z.b mit meinem Handy verbinde bekomme ich kein Internet und neben der WLAN Anzeige ein Ausrufezeichen.
Finde den Fehler nicht.
Kann jemand helfen?
Danke im voraus

Rago

Rago

Hallo,
vielen Dank für die Anleitung, es hat geklappt.
An einem verzweifele ich aber…. wenn ich dem wlan einen eigenen namen und ein anderes PW geben will startet der hostapd nicht.

was mache ich falsch ?

Gruss
Rago

sc4ry

sc4ry

Hi,

danke für die Anleitung. Wie bei meinem Vorredner komme ich leider auch nicht ins Internet, woran kann das liegen?

Anschließend würde ich gerne noch Tor nutzen, falls jemand eine funktionierende Anleitung kennt ;-)

Marc

Marc

Vielen Dank für die super Anleitung! Leider haben bei mir die Geräte, welche sich mit dem Wifi verbinden keinen Internet Zugriff? Ist das Absicht?

Nick

Nick

@Ingolf
schreibe nacheinander die Anweisungen
sudo systemctl unmask hostapd
sudo systemctl enable hostapd
sudo systemctl start hostapd
systemctl status hostapd

Ingolf

Ingolf

Genau was ich gesucht habe.
Leider kann ich die letzten Schritte nicht abschließen.
Folgende Fehlermeldung wird ausgegeben:
pi@raspberrypi:~ $ sudo systemctl start hostapd
Failed to start hostapd.service: Unit hostapd.service is masked.
bzw.:
pi@raspberrypi:~ $ sudo systemctl enable hostapd
Synchronizing state of hostapd.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable hostapd
Failed to enable unit: Unit file /etc/systemd/system/hostapd.service is masked.
Ich hoffe ihr könnt mir da weiterhelfen.

Stephan Strittmatter

Stephan Strittmatter

Hier findet sich eine Anleitung, wo auch eine Netzwerkbrücke konfiguriert wird:
https://www.elektronik-kompendium.de/sites/raspberry-pi/2002161.htm

Fritz

Fritz

Hallo,
super, sowas habe ich gesucht.
Eine Frage, kann man auch bestimmten MAC-Adressen die IP vorgeben? Viele Router können das nicht, oder nur sehr begrenzt.
Wenn nun noch Pi-Hole gleichzeitig mit darauf laufen würde, wäre es der absolute Renner.
https://pi-hole.net/

Dankeschön an alle Entwickler.

Martin

Martin

Hi Leute, erst mal danke für die schöne genaue Erklärung und die einzelnen steps.
Ich hatte auch letztens mit diesem Gedanken gespielt, bin aber an ein paar Grenzen gestoßen und zwar: die Reichweite: die Raspis sind nicht für Ihre Sendeleistung bekannt, gibt es da eine Option eventuell ein Meshwlan aufzubauen, wie es Zigbee macht (also auch die Aktoren und Sensoren mit einzubinden ?

2: Könnt ihr das mit der Portweiterleitung noch mal erklären ? Also ich würde gerne schon weiterhin mit dem Handy die Geräte steuern ohne jedes Mal das WLAN zu wechseln. Kann ich einfach eine Portweiterleitung konfigurieren, die meine „Befehle“ ins iot Netz schiebt ? Ich hoffe ich habe mich verständlich ausgedrückt :D manchmal ist es echt blöd zu beschreiben 🙈

Danke schon mal für eure Antwort.

Knuzen

Knuzen

Klasse, auf genau solch einen Vorschlag hab ich wirklich gewartet. Sehr sinnvoll für eine mögliche Überwachungsmöglichleit außerhalb von Netzen, denke ich mir.

Stephan Strittmatter

Stephan Strittmatter

Cool! Genau das wollte ich mal recherchieren und realisieren!

Vielen Dank.

Lascia un commento

Tutti i commenti vengono moderati prima della pubblicazione