hondagx35 wrote:Yes we DO NaTed !
Did i miss the joke?
Frank
by hondagx35 » 12 Aug 2016, 20:26
hondagx35 wrote:Yes we DO NaTed !
by dror » 14 Aug 2016, 09:11
by hondagx35 » 14 Aug 2016, 14:14
To the subject, a NaTed AP configuration could be a great feature to my opinion.
RuneAudio is a free and open source software with one specific objective: to transform an embedded platform (a cheap, silent and low-consumption mini-PC) into an Hi-Fi digital music player.
by keithdw » 14 Aug 2016, 18:21
by johnbanks » 14 Aug 2016, 20:16
by hondagx35 » 14 Aug 2016, 22:19
Frank, is there a chance you could release some early ‘alpha’ information that a few of us could try?
pacman -Sy --force raspberrypi-firmware-bootloader linux-raspberrypi
pacman -Sy --force raspberrypi-firmware raspberrypi-bootloader linux-raspberrypi
# Uncomment one of these lines to enable an audio interface
#dtoverlay=hifiberry-dac
#dtoverlay=hifiberry-dacplus
#dtoverlay=hifiberry-digi
#dtoverlay=hifiberry-amp
#dtoverlay=iqaudio-dac
#dtoverlay=iqaudio-dacplus
dtparam=audio=on
iw list
Wiphy phy0
max # scan SSIDs: 9
max scan IEs length: 2304 bytes
max # sched scan SSIDs: 0
max # match sets: 0
Retry short limit: 7
Retry long limit: 4
Coverage class: 0 (up to 0m)
Supported Ciphers:
* WEP40 (00-0f-ac:1)
* WEP104 (00-0f-ac:5)
* TKIP (00-0f-ac:2)
* CCMP (00-0f-ac:4)
Available Antennas: TX 0 RX 0
Supported interface modes:
* IBSS
* managed
* AP
* monitor
* P2P-client
* P2P-GO
Band 1:
Capabilities: 0x1862
HT20/HT40
Static SM Power Save
RX HT20 SGI
RX HT40 SGI
No RX STBC
Max AMSDU length: 7935 bytes
DSSS/CCK HT40
Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
Minimum RX AMPDU time spacing: 16 usec (0x07)
HT Max RX data rate: 150 Mbps
HT TX/RX MCS rate indexes supported: 0-7, 32
Bitrates (non-HT):
* 1.0 Mbps
* 2.0 Mbps
* 5.5 Mbps
* 11.0 Mbps
* 6.0 Mbps
* 9.0 Mbps
* 12.0 Mbps
* 18.0 Mbps
* 24.0 Mbps
* 36.0 Mbps
* 48.0 Mbps
* 54.0 Mbps
Frequencies:
* 2412 MHz [1] (20.0 dBm)
* 2417 MHz [2] (20.0 dBm)
* 2422 MHz [3] (20.0 dBm)
* 2427 MHz [4] (20.0 dBm)
* 2432 MHz [5] (20.0 dBm)
* 2437 MHz [6] (20.0 dBm)
* 2442 MHz [7] (20.0 dBm)
* 2447 MHz [8] (20.0 dBm)
* 2452 MHz [9] (20.0 dBm)
* 2457 MHz [10] (20.0 dBm)
* 2462 MHz [11] (20.0 dBm)
* 2467 MHz [12] (20.0 dBm)
* 2472 MHz [13] (20.0 dBm)
* 2484 MHz [14] (disabled)
Band 2:
Capabilities: 0x1862
HT20/HT40
Static SM Power Save
RX HT20 SGI
RX HT40 SGI
No RX STBC
Max AMSDU length: 7935 bytes
DSSS/CCK HT40
Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
Minimum RX AMPDU time spacing: 16 usec (0x07)
HT Max RX data rate: 150 Mbps
HT TX/RX MCS rate indexes supported: 0-7, 32
Bitrates (non-HT):
* 6.0 Mbps
* 9.0 Mbps
* 12.0 Mbps
* 18.0 Mbps
* 24.0 Mbps
* 36.0 Mbps
* 48.0 Mbps
* 54.0 Mbps
Frequencies:
* 5170 MHz [34] (20.0 dBm)
* 5180 MHz [36] (20.0 dBm)
* 5190 MHz [38] (20.0 dBm)
* 5200 MHz [40] (20.0 dBm)
* 5210 MHz [42] (20.0 dBm)
* 5220 MHz [44] (20.0 dBm)
* 5230 MHz [46] (20.0 dBm)
* 5240 MHz [48] (20.0 dBm)
* 5260 MHz [52] (20.0 dBm) (radar detection)
DFS state: usable (for 40621 sec)
DFS CAC time: 60000 ms
* 5280 MHz [56] (20.0 dBm) (radar detection)
DFS state: usable (for 40621 sec)
DFS CAC time: 60000 ms
* 5300 MHz [60] (20.0 dBm) (radar detection)
DFS state: usable (for 40621 sec)
DFS CAC time: 60000 ms
* 5320 MHz [64] (20.0 dBm) (radar detection)
DFS state: usable (for 40621 sec)
DFS CAC time: 60000 ms
* 5500 MHz [100] (26.0 dBm) (radar detection)
DFS state: usable (for 40621 sec)
DFS CAC time: 60000 ms
* 5520 MHz [104] (26.0 dBm) (radar detection)
DFS state: usable (for 40621 sec)
DFS CAC time: 60000 ms
* 5540 MHz [108] (26.0 dBm) (radar detection)
DFS state: usable (for 40621 sec)
DFS CAC time: 60000 ms
* 5560 MHz [112] (26.0 dBm) (radar detection)
DFS state: usable (for 40621 sec)
DFS CAC time: 60000 ms
* 5580 MHz [116] (26.0 dBm) (radar detection)
DFS state: usable (for 40621 sec)
DFS CAC time: 60000 ms
* 5600 MHz [120] (26.0 dBm) (radar detection)
DFS state: usable (for 40621 sec)
DFS CAC time: 60000 ms
* 5620 MHz [124] (26.0 dBm) (radar detection)
DFS state: usable (for 40621 sec)
DFS CAC time: 60000 ms
* 5640 MHz [128] (26.0 dBm) (radar detection)
DFS state: usable (for 40621 sec)
DFS CAC time: 60000 ms
* 5660 MHz [132] (26.0 dBm) (radar detection)
DFS state: usable (for 40621 sec)
DFS CAC time: 60000 ms
* 5680 MHz [136] (26.0 dBm) (radar detection)
DFS state: usable (for 40621 sec)
DFS CAC time: 60000 ms
* 5700 MHz [140] (26.0 dBm) (radar detection)
DFS state: usable (for 40621 sec)
DFS CAC time: 60000 ms
* 5745 MHz [149] (disabled)
* 5765 MHz [153] (disabled)
* 5785 MHz [157] (disabled)
* 5805 MHz [161] (disabled)
* 5825 MHz [165] (disabled)
* 5920 MHz [184] (disabled)
* 5940 MHz [188] (disabled)
* 5960 MHz [192] (disabled)
* 5980 MHz [196] (disabled)
* 6000 MHz [200] (disabled)
* 6020 MHz [204] (disabled)
* 6040 MHz [208] (disabled)
* 6060 MHz [212] (disabled)
* 6080 MHz [216] (disabled)
Supported commands:
* new_interface
* set_interface
* new_key
* start_ap
* new_station
* set_bss
* join_ibss
* set_pmksa
* del_pmksa
* flush_pmksa
* remain_on_channel
* frame
* set_channel
* connect
* disconnect
Supported TX frame types:
* IBSS: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
* managed: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
* AP: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
* AP/VLAN: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
* P2P-client: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
* P2P-GO: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
Supported RX frame types:
* IBSS: 0xd0
* managed: 0x40 0xd0
* AP: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
* AP/VLAN: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
* P2P-client: 0x40 0xd0
* P2P-GO: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
software interface modes (can always be added):
* monitor
interface combinations are not supported
Device supports scan flush.
Supported interface modes:
* IBSS
* managed
* AP
* monitor
* P2P-client
* P2P-GO
pacman -S haveged
systemctl enable haveged
pacman -S hostapd dnsmasq
nano /etc/hostapd/hostapd.conf
# interface and driver
interface=wlan0
driver=nl80211
# WIFI-Config
ssid=RuneAudioAP
channel=7
hw_mode=g
wmm_enabled=1
auth_algs=1
max_num_sta=10
# WIFI authorization
wpa=2
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP CCMP
rsn_pairwise=CCMP
wpa_passphrase=RuneAudio
nano /etc/dnsmasq.conf
# DHCP-Server for WIFI-Interface
interface=wlan0
# exclude DHCP-Server for ethernet
no-dhcp-interface=eth0
# IPv4 address-range and lease-time
dhcp-range=192.168.1.2,192.168.1.254,24h
# DNS
dhcp-option=option:dns-server,192.168.1.1
nano /var/www/command/refresh_nics
// start AP if configured and no IP is assigned
if (FALSE === $redis->hGet('AccessPoint', 'enabled')) {
$redis->hSet('AccessPoint', 'enabled', 0);
}
if (FALSE === $redis->hGet('AccessPoint', 'ip-address')) {
$redis->hSet('AccessPoint', 'ip-address', '192.168.1.1');
}
if (FALSE === $redis->hGet('AccessPoint', 'broadcast')) {
$redis->hSet('AccessPoint', 'broadcast', '192.168.1.255');
}
if (FALSE === $redis->hGet('AccessPoint', 'ssid')) {
$redis->hSet('AccessPoint', 'ssid', 'RuneAudioAP');
}
if (FALSE === $redis->hGet('AccessPoint', 'passphrase')) {
$redis->hSet('AccessPoint', 'passphrase', 'RuneAudio');
}
if (FALSE === $redis->hGet('AccessPoint', 'dhcp-range')) {
$redis->hSet('AccessPoint', 'dhcp-range', '192.168.1.2,192.168.1.254,24h');
}
if (FALSE === $redis->hGet('AccessPoint', 'dhcp-option')) {
$redis->hSet('AccessPoint', 'dhcp-option', 'option:dns-server,192.168.1.1');
}
if (FALSE === $redis->hGet('AccessPoint', 'enable-NAT')) {
$redis->hSet('AccessPoint', 'enable-NAT', 0);
}
if ($redis->hGet('AccessPoint', 'enabled') === '1') {
runelog('------------------ try to start AP if no IP is assigned ---------------------');
$got_one_IP = false;
if (!empty($active_nics)) {
foreach($active_nics as $nic) {
if (($nic === "wlan0") && (sysCmd('ip address show dev '.$nic.' | grep inet | wc -l')[0] !== '0')) {
runelog('########### got one IP for nic: '.$nic);
$got_one_IP = true;
}
}
}
if ($got_one_IP === false) {
runelog('########### no IP => start AP on wlan0');
sysCmd('systemctl stop netctl-auto@wlan0');
// change AP name
$file = '/etc/hostapd/hostapd.conf';
$newArray = wrk_replaceTextLine($file, '', 'ssid=', 'ssid='.$redis->hGet("AccessPoint", "ssid"));
$fp = fopen($file, 'w');
$return = fwrite($fp, implode("", $newArray));
fclose($fp);
// change passphrase
$file = '/etc/hostapd/hostapd.conf';
$newArray = wrk_replaceTextLine($file, '', 'wpa_passphrase=', 'wpa_passphrase='.$redis->hGet("AccessPoint", "passphrase"));
$fp = fopen($file, 'w');
$return = fwrite($fp, implode("", $newArray));
fclose($fp);
sysCmd('systemctl start hostapd');
// change dhcp-range
$file = '/etc/dnsmasq.conf';
$newArray = wrk_replaceTextLine($file, '', 'dhcp-range=', 'dhcp-range='.$redis->hGet("AccessPoint", "dhcp-range"));
$fp = fopen($file, 'w');
$return = fwrite($fp, implode("", $newArray));
fclose($fp);
// change dhcp-option
$file = '/etc/dnsmasq.conf';
$newArray = wrk_replaceTextLine($file, '', 'dhcp-option=', 'dhcp-option='.$redis->hGet("AccessPoint", "dhcp-option"));
$fp = fopen($file, 'w');
$return = fwrite($fp, implode("", $newArray));
fclose($fp);
sysCmd('systemctl start dnsmasq');
sysCmd('ip addr add '.$redis->hGet("AccessPoint", "ip-address").'/24 broadcast '.$redis->hGet("AccessPoint", "broadcast").' dev wlan0');
if ($redis->hGet('AccessPoint', 'enable-NAT') === '1') {
sysCmd('iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE');
sysCmd('iptables -A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT');
sysCmd('iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT');
sysCmd('sysctl net.ipv4.ip_forward=1');
}
}
}
// start AP end
// end - unlock the scan system
runelog('--------------------------- unlock the scan system ---------------------------');
$redis->Set('lock_wifiscan', 0);
// colse Redis connection
$redis->close();
redis-cli hset AccessPoint enabled 1
redis-cli hset AccessPoint enable-NAT 1
redis-cli hgetall AccessPoint
root@runeaudio(rw):~# redis-cli hgetall AccessPoint
1) "enabled"
2) "1"
3) "ip-address"
4) "192.168.1.1"
5) "broadcast"
6) "192.168.1.255"
7) "ssid"
8) "RuneAudioAP"
9) "passphrase"
10) "RuneAudio"
11) "dhcp-range"
12) "192.168.1.2,192.168.1.254,24h"
13) "dhcp-option"
14) "option:dns-server,192.168.1.1"
15) "enable-NAT"
16) "1"
redis-cli hset AccessPoint enabled 1
redis-cli hset AccessPoint enabled 0
redis-cli hset AccessPoint enable-NAT 1
redis-cli hset AccessPoint enable-NAT 0
by johnbanks » 14 Aug 2016, 22:46
by dror » 15 Aug 2016, 12:21
Give me some good reasons why we should implement NAT and it will get in.
My Eureka moment was your post earlier today when you stated “The create_ap script and the way RuneAudio handles network do not fit.”
So I’ll stop wasting my time (but always a learning experience) and await your promised How To.
by johnbanks » 15 Aug 2016, 14:08
by dror » 15 Aug 2016, 14:20
johnbanks wrote:Dror ...
create_ap script problems could well be associated with up to date Rune versions which handle networking differently as I understand it.
johnbanks wrote:If your NAS is disconnecting is it possible that your wifi adapter is automatically going into power saving mode?
support RuneAudio