Raspberry als Router - Probleme mit dem Accesspoint

Heute ist Stammtischzeit:
Jeden Donnerstag 20:30 Uhr hier im Chat.
Wer Lust hat, kann sich gerne beteiligen. ;)
  • Heyhey Raspberry-Bastler,
    seit ca. 4 Tagen sitze ich bereits daran mein Raspberry Pi als Router zu konfigurieren.
    Nach stundenlangem Internet durchforsten wende ich mich nun an euch, in der Hoffnung mein Problem in die Reihe zu bekommen. :bravo2:

    Zur Konfiguration:
    - Als OS verwende ich Raspbian
    - 1 Edimax EW-7811Un stellt eine Wlan-Verbindung zu meinem Router her.
    - 1 Edimax EW-7811Un dient als AccessPoint.
    - Ethernet wird nicht genutzt
    - Konfiguration erfolgt über SSH

    Die Verbindung mit meinen Router funktioniert Super. Auch der DNS-Server von Google lässt sich anpingen. Der Accespoint bereitet mir allerdings Kopfzerbrechen:
    Das Netzwerk lässt sich finden. Ich kann mich auch anmelden.
    Sobald ich eingeloggt bin bekomme ich auch eine IP im vordefinierten Bereich zugeeilt.
    Allerdings dauert die Anmeldung ungewöhnlich lange. Zugang zum Internet besteht leider nicht. Mein Htc One kann sich überhaupt nicht in das Netzwerk einloggen, d.h. die Verbindung bricht ab.

    Konfiguriere ich den Raspberry als Bridge, so funktioniert alles Tadelos.

    Hier das Installationsscript, welches ich mir geschrieben hatte:
    [code=php]
    #!/bin/bash

    ################################################################################
    # Betriebssystem - Update
    ################################################################################

    sudo apt-get update;
    sudo apt-get upgrade -y;

    ################################################################################
    # Installation hostapd
    ################################################################################

    sudo apt-get install -y hostapd;

    ################################################################################
    # Kompiliere eigene hostapd
    ################################################################################

    cd RTL8188C_8192C_USB_linux_v4.0.2_9000.20130911/wpa_supplicant_hostapd;

    sudo tar -xvf wpa_supplicant_hostapd-0.8_rtw_r7475.20130812.tar.gz;

    cd wpa_supplicant_hostapd-0.8_rtw_r7475.20130812/hostapd;

    sudo make;
    sudo make install;

    sudo mv /usr/sbin/hostapd /usr/sbin/hostapd.OLD;
    sudo mv hostapd /usr/sbin/hostapd;

    sudo chown root.root /usr/sbin/hostapd;
    sudo chmod 555 /usr/sbin/hostapd;

    cd #zurueck zum benutzerordner

    ################################################################################
    # Installation isc-dhcp-server
    ################################################################################

    sudo apt-get install -y isc-dhcp-server;

    ################################################################################
    # AccessPoint einrichten (hostapd)
    ################################################################################

    sudo cp hostapd.conf /etc/hostapd/hostapd.conf; #hostapd.conf verschieben
    sudo chmod 644 /etc/hostapd/hostapd.conf; #Rechte Besitzer: lesen,schreiben ; Andere: lesen

    sudo sed -i 's/.*DAEMON_CONF.*/DAEMON_CONF="\/etc\/hostapd\/hostapd.conf"/' /etc/default/hostapd; #Deamon für Hostapd

    ################################################################################
    # Netzwerk einrichten
    ################################################################################

    sudo mv /etc/network/interfaces /etc/network/interfaces.OLD;

    sudo cp interfaces /etc/network/interfaces;

    sudo chmod 644 /etc/network/interfaces|tee -a install.log;

    #iptables
    sudo iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE;
    sudo iptables -A FORWARD -i wlan0 -o wlan1 -m state --state RELATED,ESTABLISHED -j ACCEPT;
    sudo iptables -A FORWARD -i wlan1 -o wlan0 -j ACCEPT;
    sudo sh -c "iptables-save > /etc/iptables.ipv4.nat";

    ################################################################################
    # Ip-Forwarding einschalten
    ################################################################################

    sudo sed -i 's/.*net.ipv4.ip_forward=1/net.ipv4.ip_forward=1/' /etc/sysctl.conf;
    sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward";

    ################################################################################
    # DHCP-Server konfigurieren
    ################################################################################

    sudo mv /etc/default/isc-dhcp-server /etc/default/isc-dhcp-server.OLD;
    sudo mv /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf.OLD;

    sudo cp isc-dhcp-server /etc/default/isc-dhcp-server;
    sudo chmod 644 /etc/default/isc-dhcp-server;
    sudo cp dhcpd.conf /etc/dhcp/dhcpd.conf;
    sudo chmod 644 /etc/dhcp/dhcpd.conf;

    [/php]

    Die /etc/network/interfaces:
    [code=php]
    # loopback-Interface

    auto lo
    iface lo inet loopback


    # LAN / automatische Konfiguration über DHCP
    iface eth0 inet dhcp

    #WLAN / automatische Konfiguration über DHCP
    auto wlan0
    allow-hotplug wlan0
    iface wlan0 inet dhcp
    wpa-scan-ssid 1
    wpa-ap-scan 1
    wpa-ssid MEINE SSID
    wpa-psk MEIN PASSWORT

    auto wlan1
    iface wlan1 inet static
    address 192.168.99.10
    netmask 255.255.255.0
    wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf # ohne diese Anweisung wird statische ip wlan1 nicht zugewiesen
    # kann allerdings nacher wieder auskommentiert werden

    iptables-restore < /etc/iptables.ipv4.nat
    [/php]

    dhcpd.conf:
    [code=php]
    ddns-update-style none;

    default-lease-time 600;
    max-lease-time 7200;

    authoritative;

    log-facility local7;

    subnet 192.168.99.0 netmask 255.255.255.0 {
    range 192.168.99.21 192.168.99.79;
    option broadcast-address 192.168.99.255;
    option routers 192.168.99.1;
    default-lease-time 600;
    max-lease-time 7200;
    option domain-name "local";
    #open dns
    option domain-name-servers 208.67.222.222, 208.67.220.220;
    }
    [/php]

    hostapd.conf:
    [code=php]
    # Schnittstelle und Treiber
    interface=wlan1
    driver=rtl871xdrv

    # WLAN-Konfiguration
    ssid=OnionPi-AP
    channel=3

    # Zugangsschlüssel (PSK)
    wpa_passphrase=1234567890 #nur zum test

    # Übertragungsmodus
    hw_mode=g

    # MAC-Authentifizierung
    macaddr_acl=0

    # Authentifizierungsoptionen
    auth_algs=1

    # Verschlüsselung
    wpa=2
    wpa_key_mgmt=WPA-PSK
    wpa_pairwise=TKIP
    rsn_pairwise=CCMP
    [/php]

    isc-dhcp-server:
    [code=php]
    INTERFACES="wlan1"
    [/php]


    ifconfig auf RaspberryPi:
    [code=php]
    eth0 Link encap:Ethernet HWaddr b8:27:eb:a3:df:13
    UP BROADCAST MULTICAST MTU:1500 Metric:1
    RX packets:0 errors:0 dropped:0 overruns:0 frame:0
    TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

    lo Link encap:Local Loopback
    inet addr:127.0.0.1 Mask:255.0.0.0
    UP LOOPBACK RUNNING MTU:65536 Metric:1
    RX packets:8 errors:0 dropped:0 overruns:0 frame:0
    TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:0
    RX bytes:1104 (1.0 KiB) TX bytes:1104 (1.0 KiB)

    wlan0 Link encap:Ethernet HWaddr 80:1f:02:f2:ff:6b
    inet addr:192.168.1.6 Bcast:192.168.1.255 Mask:255.255.255.0
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:2270 errors:0 dropped:7 overruns:0 frame:0
    TX packets:1009 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:295213 (288.2 KiB) TX bytes:169752 (165.7 KiB)

    wlan1 Link encap:Ethernet HWaddr 80:1f:02:f2:ff:8c
    inet addr:192.168.99.10 Bcast:192.168.99.255 Mask:255.255.255.0
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:11 errors:0 dropped:0 overruns:0 frame:0
    TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
    [/php]

    iwconfig auf RaspberryPi:
    [code=php]
    wlan0 IEEE 802.11bg ESSID:"AccessDenied" Nickname:"<WIFI@REALTEK>"
    Mode:Managed Frequency:2.412 GHz Access Point: 00:1E:2A:64:D1:B2
    Bit Rate:54 Mb/s Sensitivity:0/0
    Retry:off RTS thr:off Fragment thr:off
    Power Management:off
    Link Quality=100/100 Signal level=99/100 Noise level=0/100
    Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
    Tx excessive retries:0 Invalid misc:0 Missed beacon:0

    lo no wireless extensions.

    eth0 no wireless extensions.

    wlan1 IEEE 802.11bg ESSID:"OnionPi-AP" Nickname:"<WIFI@REALTEK>"
    Mode:Master Frequency:2.427 GHz Access Point: 80:1F:02:F2:FF:8C
    Bit Rate:54 Mb/s Sensitivity:0/0
    Retry:off RTS thr:off Fragment thr:off
    Power Management:off
    Link Quality:0 Signal level:0 Noise level:0
    Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
    Tx excessive retries:0 Invalid misc:0 Missed beacon:0
    [/php]

    Hostapd-Log beim Verbinden mit AccessPoint ( sudo hostapd /etc/hostapd/hostapd.conf :(
    [code=php]
    Configuration file: /etc/hostapd/hostapd.conf
    drv->ifindex=4
    l2_sock_recv==l2_sock_xmit=0x0x1ce1638
    +rtl871x_sta_deauth_ops, ff:ff:ff:ff:ff:ff is deauth, reason=2
    rtl871x_set_key_ops
    rtl871x_set_key_ops
    rtl871x_set_key_ops
    rtl871x_set_key_ops
    Using interface wlan1 with hwaddr 80:1f:02:f2:ff:8c and ssid 'OnionPi-AP'
    rtl871x_set_wps_assoc_resp_ie
    rtl871x_set_wps_beacon_ie
    rtl871x_set_wps_probe_resp_ie
    rtl871x_set_key_ops
    rtl871x_set_beacon_ops
    rtl871x_set_hidden_ssid ignore_broadcast_ssid:0, OnionPi-AP,10
    rtl871x_set_acl
    +rtl871x_get_sta_wpaie, 60:36:dd:84:80:dc is sta's address
    wlan1: STA 60:36:dd:84:80:dc IEEE 802.11: associated
    rtl871x_set_key_ops
    rtl871x_set_key_ops
    rtl871x_set_key_ops
    +rtl871x_send_eapol
    wlan1: STA 60:36:dd:84:80:dc WPA: received EAPOL-Key 2/4 Pairwise with unexpected replay counter
    wlan1: STA 60:36:dd:84:80:dc WPA: received EAPOL-Key 4/4 Pairwise with unexpected replay counter
    +rtl871x_send_eapol
    +rtl871x_send_eapol
    +rtl871x_send_eapol
    +rtl871x_send_eapol
    rtl871x_set_key_ops
    wlan1: AP-STA-CONNECTED 60:36:dd:84:80:dc
    wlan1: STA 60:36:dd:84:80:dc RADIUS: starting accounting session 53FB3188-00000000
    wlan1: STA 60:36:dd:84:80:dc WPA: pairwise key handshake completed (RSN)
    [/php]


    Für alle die bis hierhin gelesen haben: Vielen Dank! :)
    Hoffe, dass ihr mir weiter helfen könnt.

    Grüße,
    freeandstyle

  • Raspberry als Router - Probleme mit dem Accesspoint? Schau mal ob du hier fündig wirst!

  • Heyhey framp,

    ich habe bridge-utils nicht installiert, demnach kann ich dir brctl show nicht ansagen. Ich möchte keine Bridge konfigurieren.
    Eine Bridge hatte aber bereits bei älteren versuchen funktioniert :)

    ausgabe route -n
    [code=php]
    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface
    0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 wlan0
    192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0
    192.168.99.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan1
    [/php]

    Vielen Dank für deine Hilfe

  • Das mit brctl war bullshit. Du hattest oben geschrieben, dass es mit einer Bridge funktioniert - und ich habe daraus irgendwie falsch gelesen, dass Du eine Bridge aufgesetzt hast :blush:

    Ich habe bei mir auch einen AP am laufen. Allerdings benutze ich dnsmasq. Aber daran kann es nicht liegen. Ich denke Du musst mal die logs fom dhcp und hostapd durchsuchen.
    Was auch merkwürdig ist, dass dein HTC1 keine Verbindung aufbauen kann, während es sonst geht - obwohl auch lange dauert.

Jetzt mitmachen!

Du hast noch kein Benutzerkonto auf unserer Seite? Registriere dich kostenlos und nimm an unserer Community teil!