Originally Posted by
remeny
I have MySQL 5.5.31 running on Ubuntu server 12.04.1. I really don't know much about MySQL and, I managed to set it up so the data base can only be accessed from a computer with a specific ip address.
I would like to set it up to be accessed from any computer on my network. I have been trying to figure out where I went wrong and have hit a brick wall.
I can post which ever configuration files are needed
Thanks in advance
Use iptables to make it so that only a specific network is allowed to access it. - see below example where 10.0.0.0/8 is my network. This restricts all data incoming to the server so that only those on the network can send incoming data
Run the below (warning, it will remove all your current iptables rules)
Code:
sudo iptables -F
sudo iptables -A INPUT -m tcp -p tcp -s 10.0.0.0/8 -d <ip of your server here> -j ACCEPT
sudo iptables -A INPUT -m tcp -p tcp -d <ip of your server here> -j REJECT
sudo iptables-save > /path/to/iptables/rules
Replace /path/to/iptables/rules with an appropriate place to save the iptables rules
Now, to set the rules, just run
Code:
sudo iptables-restore < /path/to/iptables/rules
To make it apply on startup (If youve already done this, remove it)
Code:
sudo nano /etc/network/if-up.d/iptables
Enter in the below
Code:
#!/bin/bash
sudo iptables-restore < /path/to/iptables/rules
Control +X to save.
Run
Code:
sudo chmod +x /etc/network/if-up.d/iptables
to enable it.
To add more rules, just run iptables-restore, add the rules to iptables like above, and use iptables-save like above.
Bookmarks