Skip to content

Instantly share code, notes, and snippets.

@rakesh2215
rakesh2215 / apache-modules-optimization
Created November 23, 2016 17:51
changes done to apache on when server was becoming too slow
app.griggi.com was too slow to load, giving 502 timeout message in browser. Wifidog was reporting error and timeout in logread.
Did following:
1. Deleted all previous months' connections. Restarted mysql and httpd, didn't help
2. Restarted server, it became normal.
Since i was seeing apache2 PIDs in 'top' commands contributing to high cpu % utilization, read up on solutions for this.
There were suggestions to disable un-needed apach2 modules.
So I commented out modules one by one; restarted httpd and checked server is ok or not.
I was able to reduce total module count from 59 to 28.
oug@osboxes:~/n2n > git diff edge.c
diff --git a/edge.c b/edge.c
index a754f4d..b27af51 100644
--- a/edge.c
+++ b/edge.c
@@ -534,16 +534,18 @@ static ssize_t sendto_sock( int fd, const void * buf, size_t len, const n2n_sock
sizeof(peer_addr),
dest );
+ socklen_t peer_addr_len = sizeof(peer_addr);
@rakesh2215
rakesh2215 / post_fw_test
Last active November 17, 2016 11:49
Checks to do after firmware flash
For 740n/841n/mr3420:
FW image will be have either luci or n2n as both couldn't fit.
Verify if it has luci or n2n based on from where image is picked from. (rc/with_luci has images with luci)
These images will also have no SQM and MWAN3.
For 1043nd/ER-Lite3:
FW images will have all packages.
Access 192.168.7.1 and verify it has luci, SQM and load balancer in luci GUI.
ssh/telnet and verify n2n is installed.
@rakesh2215
rakesh2215 / erlite3 openwrt flashing
Created November 16, 2016 08:20
Steps to flash openwrt on erlite
1. Take out the USB flash drive from the router and plug into a linux PC.
2. Have the images named 'KERNEL' and 'root' ready on PC.
3. Run following commands on the linux terminal.
These commands are taken from https://wiki.openwrt.org/toh/ubiquiti/edgerouter.lite
$ sudo fdisk -l
Device Boot Start End Sectors Size Id Type
/dev/sdc1 2048 292863 290816 142M c W95 FAT32 (LBA)
/dev/sdc2 292864 3710975 3418112 1,6G 83 Linux
@rakesh2215
rakesh2215 / gist:8e45504c8281ba1b0550f00ae912400a
Created November 8, 2016 08:46
sqm/qos debug: iptables commands
qos-scripts: log icmp marked packets
iptables -t mangle -A qos_Default -m mark --mark 0x110000/0xff0000 -p icmp -m limit --limit 60/min -j LOG --log-level 7 --log-prefix “qos_fwmark_11_icmp”
qos-scripts: log udp packets, ignore logread packets by destination ip
iptables -t mangle -A qos_Default -m mark --mark 0x22/0xff ! -d 52.220.125.81 -m length --length 0:500 -m limit --limit 60/min -j LOG --log-level 7 --log-prefix "qos_fwmark_22"
sqm-scripts: log icmp marked packets
iptables -t mangle -A QOS_MARK_eth0 -m mark --mark 0x20000/0xff0000 -p icmp -m limit --limit 60/min -j LOG --log-level 7 --log-prefix "sqm_fwmark_11_icmp"