[Android Software/Hacking General [Developers Only]] avgjoemomma:
K here's one question. I saw that he sets

net.core.wmem_max=524288
net.core.rmem_max=524288

Now by default for most it's 112640. A recommended setting is 262144 which I have set the rmem_default and wmem_default to. We'd really need to play with this setting a bit as it's different for everyone due to their internet connection. I'd go with the lower 262144 value for the rmem_max and wmem_max as well to be a bit more cautious.

net.core.wmem_max=262144
net.core.rmem_max=262144

net.core.somaxconn[code]

I don't think we should touch this one unless you're planning to run some sort of server software on your phone and have a lot of incoming connections :p

[code]net.core.netdev_max_backlog

It should be 1000 by default. We don't want to go lower if you're focusing on throughput.

The neigh.* stuff I wouldn't recommend adding as the defaults are pretty high already for a phone and the types of networks we are connecting them to.

Here's what I would have:

# Tweaks
# Make sure TCP timestamps are enabled due to using lossy connections
sysctl -w net.ipv4.tcp_timestamps=1
# Re-use sockets in time-wait state
sysctl -w net.ipv4.tcp_tw_reuse=1
sysctl -w net.ipv4.tcp_tw_recycle=1
# Queue size modifications
sysctl -w net.core.wmem_max=262144
sysctl -w net.core.rmem_max=262144
sysctl -w net.core.rmem_default=262144
sysctl -w net.core.wmem_default=262144
sysctl -w net.unix.max_dgram_qlen=50
sysctl -w net.core.optmem_max=20480

---------- Post added at 07:41 AM ---------- Previous post was at 07:40 AM ----------

I'm on it :p

Here's the whole script so far

# Change network congestion algorithm to CUBIC
sysctl -w net.ipv4.tcp_congestion_control=cubic

# Hardening the TCP/IP stack to SYN attacks
# See http://www.symantec.com/connect/articles/hardening-tcpip-stack-syn-attacks
sysctl -w net.ipv4.tcp_syncookies=1
sysctl -w net.ipv4.conf.all.rp_filter=1
sysctl -w net.ipv4.conf.default.rp_filter=1
sysctl -w net.ipv4.tcp_synack_retries=2
sysctl -w net.ipv4.tcp_syn_retries=2
sysctl -w net.ipv4.tcp_max_syn_backlog=1024

# Bump up tw_buckets in case we get DoS'd
sysctl -w net.ipv4.tcp_max_tw_buckets=16384

# Ignore pings
sysctl -w net.ipv4.icmp_echo_ignore_all=1

# Enable bad error message protection (should be enabled by default)
sysctl -w net.ipv4.icmp_ignore_bogus_error_responses=1

# Don't cache ssthresh from previous connection
sysctl -w net.ipv4.tcp_no_metrics_save=1

sysctl -w net.ipv4.tcp_fin_timeout=15
sysctl -w net.ipv4.tcp_keepalive_intvl=30
sysctl -w net.ipv4.tcp_keepalive_probes=5
sysctl -w net.ipv4.tcp_keepalive_time=1800

# Disable IP Packet forwarding (should be disabled already)
sysctl -w net.ipv4.ip_forward=0

# Don't accept source routing
sysctl -w net.ipv4.conf.default.accept_source_route=0
sysctl -w net.ipv4.conf.all.accept_source_route=0

# Don't accept redirects
sysctl -w net.ipv4.conf.all.accept_redirects=0
sysctl -w net.ipv4.conf.default.accept_redirects=0
sysctl -w net.ipv4.conf.all.secure_redirects=0
sysctl -w net.ipv4.conf.default.secure_redirects=0

# Controls the System Request debugging functionality of the kernel
sysctl -w kernel.sysrq=0

# Tweaks
# Make sure TCP timestamps are enabled due to using lossy connections
sysctl -w net.ipv4.tcp_timestamps=1
# Re-use sockets in time-wait state
sysctl -w net.ipv4.tcp_tw_reuse=1
sysctl -w net.ipv4.tcp_tw_recycle=1
# Queue size modifications
sysctl -w net.core.wmem_max=262144
sysctl -w net.core.rmem_max=262144
sysctl -w net.core.rmem_default=262144
sysctl -w net.core.wmem_default=262144
sysctl -w net.unix.max_dgram_qlen=50
sysctl -w net.core.optmem_max=20480