Skip to content

Instantly share code, notes, and snippets.

@vimfun
Last active July 12, 2017 02:54
Show Gist options
  • Save vimfun/6d48ff7be2dcb5b3696785b5e089396a to your computer and use it in GitHub Desktop.
Save vimfun/6d48ff7be2dcb5b3696785b5e089396a to your computer and use it in GitHub Desktop.
iptables for mysql 'max_allowed_packet' 1024 ------ (2006, 'MySQL server has gone away')
> mysql> show global variables like 'max_allowed_packet';
>
> +--------------------+----------+
> 
| Variable_name      | Value    |
>
+--------------------+----------+
>
| max_allowed_packet | 16777216 |
>
+--------------------+----------+
>
1 row in set (0.00 sec)
/sbin/iptables -I INPUT -p tcp --dport 3306 -j DROP
root@test:~$ cat /etc/network/if-pre-up.d/iptables_load 
#!/bin/sh
iptables-restore < /etc/iptables.rules
exit 0
root@test:~$ cat /etc/network/if-post-down.d/iptables_save 
#!/bin/sh
iptables-save -c > /etc/iptables.rules
if [ -f /etc/iptables.downrules ]; then
   iptables-restore < /etc/iptables.downrules
fi
exit 0
root@test:~$ 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment