You are not logged in.

#1 2016-03-14 18:37:24

etakeh32
Member
From: Pridnestrovie
Registered: 2014-03-08
Posts: 66

[SOLVED] Optimize WiFi to WiFi Connection Sharing Speed

Hello,

My city offers a relatively fast public WiFi, but in my apartment the signal is not very strong. Thus I took an old Laptop and set it up by the window according to Arch Wiki Router using Shorewall and hostapd.

Ext0 is at 30dbi connected to public WiFi on channel 1 and getting about 30mbps up/down to the internet on the router.
Int0 is at 20dbi with hostapd on channel 11. Connected clients only get about 5mbps up/down to the internet, but client to router easily gets 45mbps.

There are about 10 feet between both antennas. I did a survey with Android phone around the apartment and there is relatively little interference from other WiFis on overlapping channels. Htop shows 1-2% load.

Can anybody give me some pointers?

Last edited by etakeh32 (2016-03-15 18:00:44)

Offline

#2 2016-03-15 12:23:21

Awebb
Member
Registered: 2010-05-06
Posts: 6,286

Re: [SOLVED] Optimize WiFi to WiFi Connection Sharing Speed

If both WAN/router and router/client have good transfer rates, then it is not a problem with the physical wifi setup, but rather with the software on the laptop-router. Have you had a look at the CPU workload on the router?

Offline

#3 2016-03-15 13:35:22

etakeh32
Member
From: Pridnestrovie
Registered: 2014-03-08
Posts: 66

Re: [SOLVED] Optimize WiFi to WiFi Connection Sharing Speed

Thanks for your response! I also believe it has to do with the laptop. As mentioned, I had htop open during downloads from the client and it shows no difference to when everything is idle. Is there another way I should be checking?

Last night I switched from ck to stock kernel and also configured Shorewall's traffic shaping with option 'simple' (default config 'internal', i.e. complex traffic shaping, but with no devices configured, therefore essentially turned off) and added a rule to treat my client as band 1 (highest priority). Uploads are now getting about the same speed on client and router, but downloads remain unaffected...

Some interesting observations:
- Latency is the same on both, client and router.
- When downloading from the client (about 4-5mbit) and at the same time performing speedtest on the router, latency goes up and speeds drop significantly. This shouldn't happen, as when the client is idle I get 30mbit on the router. Bmon indicates same RX on ext0 as TX on int0.

Hostapd

ssid=*
wpa_passphrase=*
interface=int0
#bridge=br0
macaddr_acl=0
auth_algs=3
channel=11
driver=nl80211
hw_mode=g
#wme_enabled=1
#ieee80211n=1
#ht_capab=[HT40+] [SHORT-GI-40] [DSSS_CCK-40]
logger_stdout=1
logger_stdout_level=2
max_num_sta=5
rsn_pairwise=CCMP
wpa=2
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP

Shorewall.conf:

###############################################################################
#
# Shorewall - Sample shorewall.conf for two-interface
#                         configuration.
# Copyright (C) 2006-2014 by the Shorewall Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# See the file README.txt for further details.
#
# For information about the settings in this file, type "man shorewall.conf"
#
# The manpage is also online at
# http://shorewall.net/manpages/shorewall.conf.html
#
###############################################################################
#		       S T A R T U P   E N A B L E D
###############################################################################

STARTUP_ENABLED=Yes

###############################################################################
#		              V E R B O S I T Y
###############################################################################

VERBOSITY=1

###############################################################################
#		                L O G G I N G
###############################################################################

BLACKLIST_LOG_LEVEL=

INVALID_LOG_LEVEL=

LOG_BACKEND=

LOG_MARTIANS=Yes

LOG_VERBOSITY=2

LOGALLNEW=

LOGFILE=/var/log/messages

LOGFORMAT="Shorewall:%s:%s:"

LOGTAGONLY=No

LOGLIMIT=

MACLIST_LOG_LEVEL=info

RELATED_LOG_LEVEL=

RPFILTER_LOG_LEVEL=info

SFILTER_LOG_LEVEL=info

SMURF_LOG_LEVEL=info

STARTUP_LOG=/var/log/shorewall-init.log

TCP_FLAGS_LOG_LEVEL=info

UNTRACKED_LOG_LEVEL=

###############################################################################
#	L O C A T I O N	  O F	F I L E S   A N D   D I R E C T O R I E S
###############################################################################

ARPTABLES=

CONFIG_PATH=${CONFDIR}/shorewall:${SHAREDIR}/shorewall

GEOIPDIR=/usr/share/xt_geoip/LE

IPTABLES=

IP=

IPSET=

LOCKFILE=

MODULESDIR=

NFACCT=

PERL=/usr/bin/perl

PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin

RESTOREFILE=restore

SHOREWALL_SHELL=/bin/sh

SUBSYSLOCK=

TC=

###############################################################################
#		D E F A U L T   A C T I O N S / M A C R O S
###############################################################################

ACCEPT_DEFAULT="none"
DROP_DEFAULT="Drop"
NFQUEUE_DEFAULT="none"
QUEUE_DEFAULT="none"
REJECT_DEFAULT="Reject"

###############################################################################
#                        R S H / R C P  C O M M A N D S
###############################################################################

RCP_COMMAND='scp ${files} ${root}@${system}:${destination}'
RSH_COMMAND='ssh ${root}@${system} ${command}'

###############################################################################
#			F I R E W A L L	  O P T I O N S
###############################################################################

ACCOUNTING=Yes

ACCOUNTING_TABLE=filter

ADD_IP_ALIASES=No

ADD_SNAT_ALIASES=No

ADMINISABSENTMINDED=Yes

BASIC_FILTERS=No

IGNOREUNKNOWNVARIABLES=No

AUTOCOMMENT=Yes

AUTOHELPERS=Yes

AUTOMAKE=No

BLACKLIST="NEW,INVALID,UNTRACKED"

CHAIN_SCRIPTS=No

CLAMPMSS=Yes

CLEAR_TC=Yes

COMPLETE=No

DEFER_DNS_RESOLUTION=Yes

DISABLE_IPV6=Yes

DELETE_THEN_ADD=Yes

DETECT_DNAT_IPADDRS=No

DONT_LOAD=

DYNAMIC_BLACKLIST=Yes

EXPAND_POLICIES=Yes

EXPORTMODULES=Yes

FASTACCEPT=No

FORWARD_CLEAR_MARK=

HELPERS=

IMPLICIT_CONTINUE=No

INLINE_MATCHES=Yes

IPSET_WARNINGS=Yes

IP_FORWARDING=On

KEEP_RT_TABLES=No

LOAD_HELPERS_ONLY=Yes

MACLIST_TABLE=filter

MACLIST_TTL=

MANGLE_ENABLED=Yes

MAPOLDACTIONS=No

MARK_IN_FORWARD_CHAIN=No

MODULE_SUFFIX="ko ko.xz"

MULTICAST=No

MUTEX_TIMEOUT=60

NULL_ROUTE_RFC1918=No

OPTIMIZE=All

OPTIMIZE_ACCOUNTING=No

REJECT_ACTION=

REQUIRE_INTERFACE=No

RESTART=restart

RESTORE_DEFAULT_ROUTE=Yes

RESTORE_ROUTEMARKS=Yes

RETAIN_ALIASES=No

ROUTE_FILTER=No

SAVE_ARPTABLES=No

SAVE_IPSETS=No

TC_ENABLED=Simple

TC_EXPERT=No

TC_PRIOMAP="2 3 3 3 2 3 1 1 2 2 2 2 2 2 2 2"

TRACK_PROVIDERS=Yes

TRACK_RULES=No

USE_DEFAULT_RT=Yes

USE_PHYSICAL_NAMES=No

USE_RT_NAMES=No

WARNOLDCAPVERSION=Yes

WORKAROUNDS=No

ZONE2ZONE=-

###############################################################################
#			P A C K E T   D I S P O S I T I O N
###############################################################################

BLACKLIST_DISPOSITION=DROP

INVALID_DISPOSITION=CONTINUE

MACLIST_DISPOSITION=REJECT

RELATED_DISPOSITION=ACCEPT

RPFILTER_DISPOSITION=DROP

SMURF_DISPOSITION=DROP

SFILTER_DISPOSITION=DROP

TCP_FLAGS_DISPOSITION=DROP

UNTRACKED_DISPOSITION=CONTINUE

################################################################################
#			P A C K E T  M A R K  L A Y O U T
################################################################################

TC_BITS=

PROVIDER_BITS=

PROVIDER_OFFSET=

MASK_BITS=

ZONE_BITS=0

#LAST LINE -- DO NOT REMOVE
[tkh@tk13 ~]$ cat /etc/shorewall/tcinterfaces 
#
# Shorewall -- /etc/shorewall/tcinterfaces
#
# For information about entries in this file, type "man shorewall-tcinterfaces"
#
# See http://shorewall.net/simple_traffic_shaping.htm for additional
# information.
#
###############################################################################
#INTERFACE	TYPE		IN_BANDWIDTH		OUT_BANDWIDTH
ext0		External	30mbit			8mbit
[tkh@tk13 ~]$ cat /etc/shorewall/tcpri 
#
# Shorewall -- /etc/shorewall/tcpri
#
# For information about entries in this file, type "man shorewall-tcpri"
#
# See http://shorewall.net/simple_traffic_shaping.htm for additional
# information.
#
###############################################################################
#BAND	PROTO	PORT		ADDRESS		INTERFACE	HELPER
1	-	-		192.168.93.64
[tkh@tk13 ~]$ cat /etc/sysctl.d/93-ipstack.conf 
kernel.shmall = 67108864
kernel.shmmax = 67108864
net.core.netdev_max_backlog = 50000
net.core.optmem_max = 40960
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.all.accept_source_route = 0
net.ipv4.conf.all.log_martians = 1
net.ipv4.conf.all.rp_filter = 1
net.ipv4.conf.all.secure_redirects = 0
net.ipv4.conf.all.send_redirects = 0
net.ipv4.conf.default.accept_redirects = 0
net.ipv4.conf.default.secure_redirects = 0
net.ipv4.conf.default.send_redirects = 0
net.ipv4.icmp_echo_ignore_broadcasts = 1
net.ipv4.icmp_ignore_bogus_error_responses = 1
net.ipv4.ip_forward = 1
net.ipv4.ip_local_port_range = 10000 65000
net.ipv4.route.flush = 1
net.ipv4.tcp_fin_timeout = 15
net.ipv4.tcp_keepalive_time = 1200
net.ipv4.tcp_max_syn_backlog = 30000
net.ipv4.tcp_max_tw_buckets = 2000000
net.ipv4.tcp_max_tw_buckets = 360000
net.ipv4.tcp_reordering = 5
net.ipv4.tcp_rfc1337 = 1
net.ipv4.tcp_rmem = 4096 87380 8388608
net.ipv4.tcp_slow_start_after_idle = 0
net.ipv4.tcp_synack_retries = 2
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_syn_retries = 3
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_wmem = 4096 87380 8388608
net.ipv4.udp_rmem_min = 8192
net.ipv4.udp_wmem_min = 8192
[tkh@tk13 ~]$ cat /etc/sysctl.d/93-ipstack.conf 
kernel.shmall = 67108864
kernel.shmmax = 67108864
net.core.netdev_max_backlog = 50000
net.core.optmem_max = 40960
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.all.accept_source_route = 0
net.ipv4.conf.all.log_martians = 1
net.ipv4.conf.all.rp_filter = 1
net.ipv4.conf.all.secure_redirects = 0
net.ipv4.conf.all.send_redirects = 0
net.ipv4.conf.default.accept_redirects = 0
net.ipv4.conf.default.secure_redirects = 0
net.ipv4.conf.default.send_redirects = 0
net.ipv4.icmp_echo_ignore_broadcasts = 1
net.ipv4.icmp_ignore_bogus_error_responses = 1
net.ipv4.ip_forward = 1
net.ipv4.ip_local_port_range = 10000 65000
net.ipv4.route.flush = 1
net.ipv4.tcp_fin_timeout = 15
net.ipv4.tcp_keepalive_time = 1200
net.ipv4.tcp_max_syn_backlog = 30000
net.ipv4.tcp_max_tw_buckets = 2000000
net.ipv4.tcp_max_tw_buckets = 360000
net.ipv4.tcp_reordering = 5
net.ipv4.tcp_rfc1337 = 1
net.ipv4.tcp_rmem = 4096 87380 8388608
net.ipv4.tcp_slow_start_after_idle = 0
net.ipv4.tcp_synack_retries = 2
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_syn_retries = 3
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_wmem = 4096 87380 8388608
net.ipv4.udp_rmem_min = 8192
net.ipv4.udp_wmem_min = 8192
[tkh@tk13 ~]$ cat /etc/sysctl.d/99-sysctl.conf 
vm.swappiness=1
vm.vfs_cache_pressure=50
fs.inotify.max_user_watches = 524288
vm.dirty_background_bytes = 4194304
vm.dirty_bytes = 4194304
[tkh@tk13 ~]$ 

Offline

#4 2016-03-15 13:41:37

etakeh32
Member
From: Pridnestrovie
Registered: 2014-03-08
Posts: 66

Re: [SOLVED] Optimize WiFi to WiFi Connection Sharing Speed

On a side note: Is there a more elegant way of making a Linux WiFi repeater? Or is that essentially what I'm doing? (not sure how those little devices actually work)

EDIT: Looks like those little repeaters use a protocol called WDS, which needs to be configured on both ends. Source: http://www.tummy.com/blogs/2004/12/20/u … der-linux/

UPDATE: I have switched the WiFI adapters, so ext0 is now the 20dbi and int0 is the 30dbi. I am now getting between 30-40mbit on router and between 10-20 on the client in, about 20mbit out on both. This is progress! Also, maxing out the client no longer slows down latency on the router and the router still gets the remaining bandwidth, i.e. if client is pulling at 10-15mbit, router still achieves 10-15mbit at the same time. Starting to look like it may be an interference problem? Lowering txpower on the 30dbi has a negative effect...

Last edited by etakeh32 (2016-03-15 15:41:46)

Offline

#5 2016-03-15 18:00:26

etakeh32
Member
From: Pridnestrovie
Registered: 2014-03-08
Posts: 66

Re: [SOLVED] Optimize WiFi to WiFi Connection Sharing Speed

After some usage of aircrack I realized that my Android phone channel survey did not pick up a lot of networks with low signal stengths. With help of crunch created wordlist containing all local area-code phone numbers I moved some neighboring WiFi channels to 6 and now I am at about 20mbits of the 30 my router gets. So, issue is resolved. Problem was interference...

Offline

Board footer

Powered by FluxBB