Benutzer-Werkzeuge

Webseiten-Werkzeuge


accesspoint

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen der Seite angezeigt.

Link zu der Vergleichsansicht

Beide Seiten, vorherige ÜberarbeitungVorherige Überarbeitung
Nächste Überarbeitung
Vorherige Überarbeitung
accesspoint [2020/10/11 17:20] nooneaccesspoint [2022/03/11 23:45] (aktuell) noone
Zeile 1: Zeile 1:
-==== Raspberry Pi als WLAN Access Point nutzen ====+====Raspberry Pi als Access-Point einrichten====
  
-Um möglichst überall im Haus mit WLAN versorgt zu seinbedarf es meistens eines teuren WLAN-Repeaters oder eines zusätzlichen Access-PointsBeides ist mit einem Raspberry Pi kostengünstig umsetzbar und hier erfahren Siewie einfach Sie einen WLAN-Access-Point mit einem Raspberry Pi und einem günstigen WLAN-Stick aufbauen können.+===Software installieren=== 
 +Es empfiehlt sich gleich am Anfang die notwendige Software zu installieren. Nicht nur diedie jetzt, sondern vielleicht auch später gebraucht wird. Während der Konfiguration kann es vorkommen, dass der Zugriff aus das Internet nicht mehr gehtWenn dann die notwendige Software noch nicht installiert ist, dann kann man unter Umständen noch einmal von vorne anfangen. 
 +   sudo apt install dnsmasq hostapd iptables
  
-=== Voraussetzungen === +  * **dnsmasq** ist ein DNS-Server für die Namensauflösung und ein DHCP-Server, der im WLAN die IP-Konfiguration an die WLAN-Clients verteilt. 
-Natürlich benötigen Sie zuerst einen Raspberry Pi mit Netzteil, SD-Karte (mit installiertem Raspbian) und ein LAN-Kabel. Außerdem benötigen Sie einen WLAN-Stick/-Dongleden Sie schon für weniger als 10€ bei Amazon kaufen können. Bedenken Sie bei der Wahl der Position des Raspberry Pis, dass dieser möglichst viel Raum mit WLAN abdecken soll und platzieren Sie diesen daher möglichst zentral.+  * **hostapd** erzeugt das WLANan dem sich die WLAN-Clients anmelden können. 
 +  * **iptables** sorgt dafür, dass die WLAN-Clients per NAT eine IP-Verbindung ins nächste Netzwerk bekommen (Routing/Firewalling).
  
-=== Installation & Einrichtung === +===WLAN-Interface konfigurieren===
-Nachdem der Raspberrry Pi nun seinen Platz gefunden hat und angeschlossen ist, verbinden Sie sich mittels SSH und aktualisieren Sie zuerst alle Pakete und den Kernel, damit die Unterstützung für möglichst jeden WLAN-Stick sichergestellt ist:+
  
-   sudo apt-get update && sudo apt-get dist-upgrade -y +Seit Raspbian Jessie ist standardmäßig ein DHCP Client Daemon (DHCPCD) aktiviert. Die Netzwerk-Konfiguration wird in der Datei "/etc/dhcpcd.conf" vorgenommen. 
-   sudo rpi-update +   sudo nano /etc/dhcpcd.conf 
-   sudo reboot  + 
 +Hier tragen wir folgende Zeilen ein: 
 +   interface wlan0 
 +   static ip_address=192.168.1.1/24 
 +   nohook wpa_supplicant 
 + 
 +In dieser IPv4-Konfiguration hat das WLAN-Interface eine statische IPv4-Adresse. Das ist für den Betrieb des DHCP- und DNS-Servers wichtig. 
 + 
 +Es wäre auch denkbar, auch der Ethernet-Schnittstelle "eth0" eine statische IP-Konfiguration zu verpassen. Das muss aber nicht sein. In dieser Form hat der WLAN-Router den Vorteil, dass er in jedem lokalen Netzwerk funktioniert, wenn die IPv4-Konfiguration per DHCP an die Ethernet-Schnittstelle geliefert wird. 
 + 
 +Wir speichern und schließen die Datei mit Strg + O, Return, Strg + X. 
 + 
 +Dann starten wir den DHCP Client Daemon neu. 
 +   sudo systemctl restart dhcpcd 
 + 
 +Dann müssen wir sicherstellen, dass sowohl das Ethernet-Interface (eth0) als auch der WLAN-Adapter (wlan0) funktionieren und vorhanden sind. 
 +   ip l
  
-Prüfen Sie nun, ob der WLAN-Stick erkannt wird, indem Sie dazu lsusb  auf dem Terminal eingeben. Die Ausgabe der letzten Zeile sollte dann folgendermaßen (oder ähnlichaussehen: +Beide Netzwerk-Schnittstellen (eth0 und wlan0müssen vorhanden seinDie IP-Konfiguration ist dabei unerheblich.
-   Bus 001 Device 005: ID 0bda:8176 Realtec Semiconductor CorpRTL8188CUS 802.11n WLAN Adapter+
  
-Anschließend können Sie die nötigen Pakete hostapd und dnsmasq installieren: +===DHCP-Server und DNS-Cache einrichten (dnsmasq)=== 
-   sudo apt-get install hostapd dnsmasq+Als nächstes richten wir den DHCP-Server und DNS-Cache ein. Der DHCP-Server sorgt dafür, dass die WLAN-Clients nach der Anmeldung alle nötigen Informationen für die IP-Konfiguration bekommen. Der DNS-Dienst übernimmt die Namensauflösung. Um beides kümmert sich "dnsmasq".
  
-=== Access Point einrichten === +Dazu müssen wir "dnsmasq" konfigurierenWir erstellen zuerst ein Backup der alten Konfigurationsdatei und öffnen eine neue Datei "/etc/dnsmasq.conf"
-Zuerst müssen Sie dem WLAN-Stick eine feste IP-Adresse zuweisenEditieren Sie dazu die Datei /etc/network/interfaces, sodass der Inhalt nun folgendermaßen aussieht+   sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf_alt 
-   auto lo +   sudo nano /etc/dnsmasq.conf 
-   iface lo inet loopback+ 
 +Dort tragen wir folgende Zeilen als Minimal-Konfiguration ein
 +   # DHCP-Server aktiv für WLAN-Interface 
 +   interface=wlan0
        
-   # ...+   # DHCP-Server nicht aktiv für bestehendes Netzwerk 
 +   no-dhcp-interface=eth0
        
-   iface wlan0 inet static +   # IPv4-Adressbereich und Lease-Time 
-   address 192.168.2.1 +   dhcp-range=192.168.1.100,192.168.1.200,255.255.255.0,24h
-   netmask 255.255.255.0+
        
-Wichtig istdass wlan0 nur einmalig in dieser Datei genannt werden darf!+   # DNS 
 +   dhcp-option=option:dns-server,192.168.1.1 
 + 
 +Hier wird der DHCP-Server und das DNS-Forwarding für die Netzwerk-Schnittstelle "wlan0" aktiviert und für die Schnittstelle "eth0" nur DNS, aber kein DHCP serviert. Außerdem wird festgelegt, dass im WLAN die IPv4-Adressen von 192.168.1.100 bis 192.168.1.200 für die Clients vergeben werden und die Adresse des DNS-Servers festgelegt. 
 + 
 +===DHCP-Server und DNS-Cache prüfen und in Betrieb nehmen (dnsmasq)=== 
 +Vor der Inbetriebnahme empfiehlt es sich, die Konfiguration zu testen. 
 +   dnsmasq --test -C /etc/dnsmasq.conf
  
-Nun muss hostapd eingerichtet werden. Dazu editieren Sie zunächst die 10. Zeile in der Datei /etc/default/hostapd: +Die Syntaxprüfung sollte mit "OKerfolgreich sein.
-   # Defaults for hostapd initscript +
-   # +
-   # See /usr/share/doc/hostapd/README.Debian for information about alternative +
-   # methods of managing hostapd. +
-   # +
-   # Uncomment and set DAEMON_CONF to the absolute path of a hostapd configuration +
-   # file and hostapd will be started during system boot. An example configuration +
-   # file can be found at /usr/share/doc/hostapd/examples/hostapd.conf.gz +
-   # +
-   DAEMON_CONF="/etc/hostapd/hostapd.conf" +
-    +
-   # Additional daemon options to be appended to hostapd command:- +
-   #       -d   show more debug messages (-dd for even more) +
-   #       -K   include key data in debug messages +
-   #       -t   include timestamps in some debug messages +
-   # +
-   # Note that -B (daemon mode) and -P (pidfile) options are automatically +
-   # configured by the init.d script and must not be added to DAEMON_OPTS. +
-   # +
-   #DAEMON_OPTS=""+
  
-Und schließlich muss die dort angegebene Deamon-Konfiguration erstellt und mit den gewünschten Einstellungen gefüllt werden. Dazu kopieren Sie einfach diese Konfiguration (mit eventuellen Anpassungenin die /etc/hostapd/hostapd.conf-Datei. +DNSMASQ neu starten: 
-Die wichtigste Anpassung ist die des verwendeten TreibersBei den meisten Edimax-Dongles muss nichts nachinstalliert werdensodass Sie hier den Treiber verwenden können, den die Eingabe von dmesg nach dem Einstecken des Dongles selbst anzeigt+   sudo systemctl restart dnsmasq 
-   # Genutztes Interface, muss bei Bedarf geändert werden (siehe "ifconfig"-Ausgabe)+ 
 +DNSMASQ-Status anzeigen: 
 +   sudo systemctl status dnsmasq 
 + 
 +DNSMASQ beim Systemstart starten: 
 +   sudo systemctl enable dnsmasq 
 + 
 +===WLAN-AP-Host einrichten (hostapd)=== 
 +Dann installieren wir den Host Access Point Daemon, kurz "hostapd". Das ist ein WLAN-Authenticator. Er kümmert sich darum, WLAN-Funktionen verschlüsselt anzubieten und die dazu notwendige Authentifizierung der WLAN-Clients vorzunehmen. 
 + 
 +Die Konfiguration des WLAN-AP-Hosts: 
 +   sudo nano /etc/hostapd/hostapd.conf 
 + 
 +Die Datei sollte noch nicht vorhanden und somit leer sein. Wenn die Datei doch vorhanden ist, dann sollte man sie vollständig überschreiben. 
 +In die Datei tragen wir folgende Minimal-Konfiguration ein. Selbstverständlich gibt es noch mehr Parameter, die in diesem Fall keine Rolle spielen
 +   # WLAN-Router-Betrieb 
 +    
 +   # Schnittstelle und Treiber
    interface=wlan0    interface=wlan0
-   # Realtek-Treiber, muss bei anderem Hersteller angepasst werden +   #driver=nl80211
-   driver=rtl871xdrv +
-    +
-   # Deamon-Einstellungen +
-   ctrl_interface=/var/run/hostapd +
-   ctrl_interface_group=0+
        
    # WLAN-Konfiguration    # WLAN-Konfiguration
-   ssid=Raspberry Pi+   ssid=NETZWERKNAME
    channel=1    channel=1
    hw_mode=g    hw_mode=g
    ieee80211n=1    ieee80211n=1
 +   ieee80211d=1
 +   country_code=DE
 +   wmm_enabled=1
        
-   # WLAN-Sicherheit (Passwort unbedingt anpassen!)+   # WLAN-Verschlüsselung 
 +   auth_algs=1
    wpa=2    wpa=2
-   wpa_passphrase=passwort123456 
    wpa_key_mgmt=WPA-PSK    wpa_key_mgmt=WPA-PSK
-   wpa_pairwise=CCMP 
    rsn_pairwise=CCMP    rsn_pairwise=CCMP
-    +   wpa_passphrase=GEHEIMES_PASSWORT
-   # Ländercode +
-   country_code=DE  +
  
-Zum Abschluss muss ein Client noch eine IP-Adresse erhalten, wenn er sich beim Access Point anmeldetDazu editieren Sie die dnsmasq-Konfiguration unter /etc/dnsmasq.conf folgendermaßen: +Drei Einstellungen sind individuell zu tätigenDas sind der WLAN-Name ("ssid"), der Kanal ("channel"), der von 1 bis 13 frei konfiguriert werden kann, wobei man hier nichts ändern mussEventuell muss man hier den Kanal wechselnwenn eine WLAN-Analyse ergibtdass bereits mehrere andere WLANs diesen Kanal belegenPrinzipiell können mehrere WLANs den selben Kanal belegenDas ist besserals wenn sich die Kanäle überschneiden
-   # Configuration file for dnsmasq. +Der dritte Parameter ist das WLAN-Passwort ("wpa_passphrase")Hier sollte man ein Passwort von mindestens 8 Zeichen Länge im Klartext eintragen.
-   # ... +
-   # If you want dnsmasq to listen for DHCP and DNS requests only on +
-   # specified interfaces (and the loopbackgive the name of the +
-   # interface (eg eth0here. +
-   # Repeat the line for more than one interface. +
-   interface=wlan0 +
-   # ... +
-   # Uncomment this to enable the integrated DHCP serveryou need +
-   # to supply the range of addresses available for lease and optionally +
-   # a lease timeIf you have more than one networkyou will need to +
-   # repeat this for each network on which you want to supply DHCP +
-   # service. +
-   dhcp-range=192.168.2.2,192.168.2.100,255.255.255.0,12h +
-   # ...+
  
-Somit vergibt der Raspberry Pi nun IP-Adressen im Bereich von 192.168.2.2 bis 192.168.2.100 für jeweils 12 Stunden. Starten Sie nun die beiden Services neu und verbinden Sie sich mit dem neuen WLAN "Raspberry Pi". Zwar haben Sie noch keine Internet-Verbindungjedoch können Sie (falls installiertunter 192.168.2.1 einen Webserver erreichen. +Hinweis zum WLAN-Treiber: Es gibt in dieser Konfigurationsdatei den Parameter "driver", der auskommentiert (#istNormalerweise wird von "hostapd" automatisch der richtige Treiber geladenEs kann natürlich sein, dass das nicht gelingtDann muss man hier den richtigen Treiber explizit angeben.
-   sudo service hostapd restart +
-   sudo service dnsmasq restart  +
  
-=== Internet-Verbindung weiterleiten === +Anschließend speichern und schließen mit Strg + OReturn, Strg + X.
-Damit nun auch die WLAN-Clients eine Verbindung zum Internet erhaltenmüssen Sie ein paar weitere Einstellungen vornehmen: Entfernen Sie zunächst die Raute vor dieser Zeile in der Datei /etc/sysctl.conf: +
-   # Uncomment the next line to enable packet forwarding for IPv4 +
-   #net.ipv4.ip_forward=1+
  
-Und lesen Sie die Datei anschließend erneut ein: +Weil diese Datei das WLAN-Passwort im Klartext enthält, sollte nur der Benutzer "root" Leserechte auf diese Datei haben. 
-   sudo sysctl -p  +   sudo chmod 600 /etc/hostapd/hostapd.conf
  
-Nun weisen Sie iptables anden Internet-Traffic von wlan0 auf eth0 weiterzuleiten, indem Sie folgendes Skript bei jedem Neustart des Raspberry Pis ausführen lassen. Legen Sie dazu eine Datei unter /etc/network/if-up.d/accesspoint an und kopieren Sie folgenden Inhalt dort hinein: +Keine Sorgemit dem Benutzer "pi" und sudo kann man die Datei jederzeit wieder ändern und speichern.
-   #!/bin/sh +
-   iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE +
-   iptables --append FORWARD --in-interface wlan0 -j ACCEPT+
  
-Schließlich machen Sie diese Datei noch ausführbar und starten den Raspberry Pi neu: +===WLAN-AP-Host-Konfiguration prüfen und in Betrieb nehmen (hostpad)=== 
-   sudo chmod +x /etc/network/if-up.d/accesspoint +Bevor wir uns an das weitere Einrichten des WLAN-Routers machen, nehmen wir zuerst den WLAN-Host in Betrieb. Nur wenn das funktioniert, lohnen sich die weiteren Schritte. Wenn der WLAN-Host nicht in Betrieb geht, braucht man die Router-Funktionen gar nicht erst einzurichten.
-   sudo reboot  +
  
-=== Abschluss === +Zur Inbetriebnahme des WLAN-Hosts starten wir "hostapd" im Debug-Modus. Dabei werden uns "alle" Fehlermeldungen angezeigt. 
-Nun können Sie sich mit dem Access Point verbinden und haben eine funktionierende Internetverbindung.+   sudo hostapd -dd /etc/hostapd/hostapd.conf
  
-Sollten Sie jedoch weiterhin nicht das Internet erreichen können, prüfen Sie folgende Fehlerquellen:+**Hinweis:** Mit "Strg + C" kann man die laufende hostapd-Instanz bei Bedarf beenden.
  
-  * Wurden die iptables-Einstellungen übernommen? Führen Sie die beiden Zeilen (s.o.) mit einem vorgestellten sudo einzeln aus und prüfen Sie die Verbindung erneut. +"hostapd" wird in jedem Fall Meldungen produzieren. Sofern die Konfiguration richtig ist und der WLAN-Adapter mitspielt, läuft die Konfiguration durchDas Programm wird aber nicht beendetDas heißt, "hostapd" kehrt nicht zur Befehlseingabe zurückWenn folgende Meldungen erscheinen, dann ist alles im grünen Bereich: 
-  * Dem Gerät ist der Gateway unbekannt? Fügen Sie folgenden Zeile in die dnsmasq-Konfiguration ein:+   ... 
 +   wlan0: interface state COUNTRY_UPDATE->ENABLED 
 +   ... 
 +   wlan0AP-ENABLED 
 +   ...
  
-   dhcp-option=3,192.168.2.1+Das ist eine gute Gelegenheit den WLAN-AP zu testen (ohne Internet-Verbindung)Dazu versucht man mit einem WLAN-Client das WLAN zu finden und sich dort anzumelden. 
 +Dabei kann man in der Kommandozeile schön beobachten, wie sich der WLAN-Client anmeldet (AP-STA-CONNECTED) und auch wieder abmeldet (AP-STA-DISCONNECTED), wenn er die Verbindung zum WLAN beendet.
  
-  Die Treiber für Ihren WLAN-Stick fehlen? Meist bieten die Hersteller auch Linux-Treiber an; andernfalls gibt es auch zu vielen Modellen bereits detaillierte Anleitungen in Foren oder Blogs.+**Hinweis:** Wenn man die Konfiguration per SSH vornimmt, dann sollte man das Prüfen des WLAN-AP mit einem anderen Client vornehmen, weil man sich sonst durch das Wechseln des WLANs die SSH-Verbindung abschießt.
  
-====Raspberry Pi as Access Point===+Wenn "hostapd" mit Fehlermeldungen abbricht und zur Kommandoeingabe zurückkehrt, dann stimmt irgendetwas noch nicht. Die Fehler sind allerdings äußerst vielfältig und die dazugehörigen Fehlermeldungen nicht immer eindeutig. 
 +  * Ein beliebter Fehler ist das fehlende "sudo" beim Aufrufen von "hostapd"
 +  * Weitere Fehlerquellen kann man ausschließen, wenn man sicherstellt, dass der WLAN-Adapter grundsätzlich funktioniert und den AP-Modus beherrscht. 
 +  * Eine weitere Fehlerquelle ist die verwendete Distribution. Funktionieren wird es auf alle Fälle mit Raspberry Pi OS.
  
-Equipment List +Damit der "hostapd" als Daemon im Hintergrund startetmuss man dem Daemon noch sagen, wo er seine Konfiguration (Dateifindet
-Below are all the bits and pieces that I used for this Raspberry Pi Wireless Access Point tutorialthere is nothing super special that you will need to be able to complete this. +Wenn "hostapd" noch läuftdann beenden wir es mit "Strg C"Dann öffnen wir eine Konfigurationsdatei:
-Recommended: +
-   * Raspberry Pi 2 or 3 +
-   * Micro SD Card or a SD card if you’re using an old version of the Pi. +
-   * Wifi dongle (The Pi 3 has WiFi inbuilt) +
-   * Ethernet Connection +
-Optional: +
-   * Raspberry Pi Case +
- +
-===Setting up the Wireless Access Point=== +
-As with most tutorials I do, this one just uses a clean version of Raspbian that has been updated to the latest packages+
-To setup the Raspberry Pi wireless access point we will be making the use of two packages. These two packages are //hostapd// and //dnsmasq//. //hostapd// is the package that allows us to utilize a Wi-Fi device as an access pointin our case we will be utilizing this to turn the Raspberry Pi 3’s Wi-Fi into our access point. +
-The other package, //dnsmasq// acts as both a DHCP and DNS server so that we can assign IP addresses and process DNS requests through our Raspberry Pi itself. As a bonus //dnsmasq// is very easy to configure while being somewhat lightweight in comparison to isc-dhcp-server and bind9 packages. +
- +
-Remember for this specific Raspberry Pi tutorial we will need to be utilizing an ethernet network connection and not the Wi-Fi connection. +
- +
-**1.** Before we get started installing and setting up our packages, we will first run an update on the Raspberry Pi by running the following two commands. +
-   sudo apt-get update +
-   sudo apt-get upgrade +
- +
-**2.** With that done we can now install our two packages, run the following to commands to install hostapd and dnsmasq. +
-   sudo apt-get install hostapd +
-   sudo apt-get install dnsmasq +
- +
-**3.** With the packages now installed we will want to deny any interfaces from using our wlan0 connection, this will help ensure it is free for our access point. To do this we need to edit our dhcpd configuration file with the following command: +
-   sudo nano /etc/dhcpcd.conf +
- +
-**4.** Within this file we need to add the following line to the bottom. However, if you have any interfaces there, then make sure you place it above those as it is needed to override them. +
-   denyinterfaces wlan0 +
-Now we can save and quit out of the file by pressing Ctrl +X then pressing Y and then Enter. +
- +
-**5.** Now we need to setup and configure our static IP address for the wlan0 connection, we will do this within our interfaces file. Begin editing this file by running the following command: +
-   sudo nano /etc/network/interfaces +
- +
-**6.** Within this file change the //wlan0// section so it looks like below, this will setup the static ip address and allow hot plugging on the wlan0 connection. +
-   allow-hotplug wlan0   +
-   iface wlan0 inet static   +
-       address 192.168.220.1 +
-       netmask 255.255.255.0 +
-       network 192.168.220.0 +
-       broadcast 192.168.220.255 +
-   #    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf +
-Now we can save and quit out of the file by pressing Ctrl +X then Y and then Enter. +
- +
-**7.** Now we need to restart our dhcpd service so it will load in all our configuration changes, we also need to reload our wlan0 interface to make sure it’s loaded in our interface changes. Run the following two commands to reload both: +
-   sudo service dhcpcd restart +
-   sudo ifdown wlan0 && sudo ifup wlan0 +
- +
-**8.** Next, we need to adjust our hostapd configuration, to do this we need to begin editing the config file with the following command: +
-   sudo nano /etc/hostapd/hostapd.conf +
- +
-**9.** In this file we need to write out the following lines, these basically set up how we want to interact with the wlan device. The only real lines you should worry about in this file is the ssid= line and the wpa_passphrase= line. +
- +
-**NOTE:** If you are doing this tutorial with a different Wi-Fi device then the inbuilt Pi 3 one, you may have to also change the driver= line to the best driver for your device, google will be your friend for working out what the best driver to use is. +
-   interface=wlan0 +
-   driver=nl80211 +
-    +
-   hw_mode=g +
-   channel=6 +
-   ieee80211n=1 +
-   wmm_enabled=1 +
-   ht_capab=[HT40][SHORT-GI-20][DSSS_CCK-40] +
-   macaddr_acl=0 +
-   ignore_broadcast_ssid=0 +
-    +
-   # Use WPA2 +
-   auth_algs=1 +
-   wpa=2 +
-   wpa_key_mgmt=WPA-PSK +
-   rsn_pairwise=CCMP +
-    +
-   # This is the name of the network +
-   ssid=Pi3-AP +
-   # The network passphrase +
-   wpa_passphrase=raspberry +
-Remember to change wpa_passphrase to your own password, make sure you set it to something secure so random people can’t just connect into your Wi-Fi access point. +
-Now we can save and quit out of the file by pressing Ctrl +X then pressing Y and then Enter. +
- +
-**10.** With that done we should now have our hostapd configuration, but before it can be used we need to edit two files. These files are what hostapd will read to find our new configuration file. +
-To begin editing the first of these two files run the following command:+
    sudo nano /etc/default/hostapd    sudo nano /etc/default/hostapd
  
-**11.** In this file, we need to find the following line and replace it: +Darin ergänzen wir folgende Parameter
-Find+   RUN_DAEMON=yes
-   #DAEMON_CONF=""  +
-Replace with:+
    DAEMON_CONF="/etc/hostapd/hostapd.conf"    DAEMON_CONF="/etc/hostapd/hostapd.conf"
-Now we can save and quit out of the file by pressing Ctrl +X then pressing Y and then Enter. 
  
-**12.** Now we need to edit the second configuration filethis file is located within the init.d folder. We can edit the file with the following command: +Anschließend speichern und schließen mit Strg + OReturn, Strg + X.
-   sudo nano /etc/init.d/hostapd+
  
-**13.** In this file, we need to find the following line and replace it: +Den "hostapd" nimmt man dann mit folgenden Kommandos in Betrieb
-Find: +   sudo systemctl unmask hostapd 
-   DAEMON_CONF=  +   sudo systemctl start hostapd 
-Replace with: +   sudo systemctl enable hostapd
-   DAEMON_CONF=/etc/hostapd/hostapd.conf +
-Now we can save and quit out of the file by pressing Ctrl +X then pressing Y and then Enter.+
  
-**14.** With hostapd now set up we need to move onto setting up dnsmasq, before we begin editing its configuration we will move the default one to a new location. We can do this with the following command: +Den Status des Daemons kann man mit folgendem Kommando prüfen
-   sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig+   sudo systemctl status hostapd
  
-**15.** Now that the original configuration file is moved out of the way we can begin by creating our own new configuration file. We will create and edit the new file with the following command: +Hier sollten folgende Zeilen stehenLoaded: loaded und Active: active
-   sudo nano /etc/dnsmasq.conf+
  
-**16.** To this file add the following lines, these lines basically tell the dnsmasq service how to handle all the connections coming through. +===Routing und NAT für die Internet-Verbindung konfigurieren==
-   interface=wlan0       # Use interface wlan0   +Bis hierhin hat man im Optimalfall mit dem WLAN-Client eine Verbindung zum WLAN und eine IPv4-Konfiguration erhaltenWas noch nicht funktioniertist eine Verbindung ins Internet.
-   listen-address=192.168.220.1   # Specify the address to listen on   +
-   bind-interfaces      # Bind to the interface +
-   server=8.8.8.8       # Use Google DNS   +
-   domain-needed        # Don't forward short names   +
-   bogus-priv           # Drop the non-routed address spaces  +
-   dhcp-range=192.168.220.50,192.168.220.150,12h # IP range and lease time   +
-Now we can save and quit out of the file by pressing Ctrl +X then pressing Y and then Enter.+
  
-**17.** Next, we need to configure your Raspberry Pi so that it will forward all traffic from our wlan0 connection over to our ethernet connectionFirst we must enable it through the sysctl.conf configuration file, so let’s begin editing it with the following command:+Zuerst aktivieren wir das RoutingDazu öffnen wir eine System-Datei.
    sudo nano /etc/sysctl.conf    sudo nano /etc/sysctl.conf
  
-**18.** Within this file you need to find the following lineand remove the # from the beginning of it. +Hier ergänzen wir die folgende Zeile und schließen die Datei mit Strg + OReturn, Strg + X.
-Find: +
-   #net.ipv4.ip_forward=1 +
-Replace with:+
    net.ipv4.ip_forward=1    net.ipv4.ip_forward=1
  
-**19.** Now since we are impatient and don’t want to wait for it to enable on next boot we can run the following command to activate it immediately: +Dann aktivieren wir NAT. Wichtig ist hier, dass iptables installiert ist
-   sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"+   sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
  
-**20.** With IPv4 Forwarding now enabled we can configure a NAT between our wlan0 interface and our eth0 interface. Basicallythis will forward all traffic from our access point over to our ethernet connection. +Dann stellen wir sicherdass diese Routing-Information gespeichert wird.
-Run the following commands to add our new rules to the iptable: +
-   sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE   +
-   sudo iptables -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT   +
-   sudo iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT   +
- +
-**21.** Of course iptables are flushed on every boot of the Raspberry Pi so we will need to save our new rules somewhere so they are loaded back in on every boot. +
-To save our new set of rules run the following command:+
    sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"    sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"
  
-**22.** Now with our new rules safely saved somewhere we need to make this file be loaded back in on every reboot. The most simple way to handle this is to modify the rc.local file. +Damit die Routing-Information beim Systemstart geladen wird müssen wir noch ein Systemdatei bearbeiten.
-Run the following command to begin editing the file:+
    sudo nano /etc/rc.local    sudo nano /etc/rc.local
  
-**23.** Now we are in this file, we need to add the line below. Make sure this line appears above exit 0. This line basically reads the settings out of our iptables.ipv4.nat file and loads them into the iptables. +Hier tragen wir vor der Zeilte mit "exit 0" folgende Zeile ein.
-Find: +
-   exit 0 +
-Add above “exit 0”:+
    iptables-restore < /etc/iptables.ipv4.nat    iptables-restore < /etc/iptables.ipv4.nat
-Now we can save and quit out of the file by pressing Ctrl +X then pressing Y and then Enter. 
  
-**24.** Finally all we need to do is start the two services and enable them in systemctl. Run the following two commands: +Anschließend muss man die Datei speichern und schließen: Strg + O, Return, Strg + X.
-   sudo service hostapd start +
-   sudo service dnsmasq start+
  
-**25.** Now you should finally have a fully operational Raspberry Pi wireless access point, you can ensure this is working by using any of your wireless devices and connecting to your new access point using the SSID and WPA Passphrase that was set earlier on in the tutorial. +Ein Neustart des Raspberry Pi ist abschließend erforderlich.
-To ensure everything will run smoothly it's best to try rebooting now. This will ensure that everything will successfully re-enable when the Raspberry Pi is started back up. Run the following command to reboot the Raspberry Pi:+
    sudo reboot    sudo reboot
-This is yet another great project for the Raspberry Pi that can be extended to make it an extremely useful utility. As I mentioned above you can make this a WiFi access node where you can route all the internet traffic through a VPN. 
  
-I hope this Raspberry Pi Wireless access point tutorial has helped you be able to expand your wireless network. If you come across any issues or have some feedback related to this tutorialthen please don’t hesitate to leave a comment below.+===WLAN-, Router- und DHCP/DNS-Funktion prüfen=== 
 + 
 +Wenn der Raspberry Pi neu gestartet ist, sollte man kontrollieren, ob die Dienste "hostapd" und "dnsmasq" laufenbevor man sich am neu eingerichteten WLAN-Router anmeldet. 
 +   sudo systemctl status hostapd 
 +   ps ax | grep hostapd 
 +   sudo systemctl status dnsmasq 
 +   ps ax | grep dnsmasq
  
-https://www.raspberrypi.org/documentation/configuration/wireless/access-point-routed.md+Wenn die Dienste laufen und die Prozesse für die beiden Dienste angezeigt werden, dann kann man versuchen sich mit einem WLAN-Client am WLAN-Router anzumelden und eine Internet-Verbindung aufzubauen.
  
accesspoint.1602429655.txt.gz · Zuletzt geändert: 2020/10/11 17:20 von noone

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki