| Linode Forum https://forum.linode.com/ |
|
| [SOLVED] local ip and iptables - open mysql https://forum.linode.com/viewtopic.php?f=19&t=3668 |
Page 1 of 1 |
| Author: | nateleavitt [ Tue Nov 18, 2008 3:33 pm ] |
| Post subject: | [SOLVED] local ip and iptables - open mysql |
Hey guys! I'm trying to get some database replication working across linodes using the local ip addresses. For some reason I can't get the mysql port open for local network address. Here is my nmap scan at my local address: Code: Not shown: 1711 filtered ports Here is my iptable script: Code: *mangle And here is my ifconfig: (i changed the local & public address to end with 123) Code: eth0 Link encap:Ethernet HWaddr fe:fd:48:0e:b3:4b I have edited my.conf to include the bind address of: 192.168.135.123. Any help or pointers would be much appreciated. |
|
| Author: | Internat [ Tue Nov 18, 2008 5:27 pm ] |
| Post subject: | |
i assume you restarted mysql after you bound it to the ip right? and that you removed the, option for skip-local-networking? or skip-networking? i cant remember the exact one |
|
| Author: | Xan [ Tue Nov 18, 2008 11:36 pm ] |
| Post subject: | |
The more recent MySQL releases use: Code: bind-address=127.0.0.1 in the config file by default. Change this from the local IP to the one you'd like to use. |
|
| Author: | hybinet [ Wed Nov 19, 2008 1:06 am ] |
| Post subject: | |
Xan wrote: The more recent MySQL releases use:
Code: bind-address=127.0.0.1 in the config file by default. Change this from the local IP to the one you'd like to use. That will probably prevent MySQL from being accessible from localhost. In addition, I don't think it's currently possible to make MySQL bind to only two interfaces. (i.e. You can't have two "bind-address" directives.) MySQL binds either to only one interface or to all available interfaces. So just comment out the whole "bind-address" line in my.cnf. That'll make MySQL bind to all interfaces. Then you can use your firewall to make port 3306 only accessible from your other server. |
|
| Author: | Xan [ Wed Nov 19, 2008 1:13 am ] |
| Post subject: | |
It'll still be accessible via the Unix socket, so the command-line client will still work fine. |
|
| Author: | MrRx7 [ Wed Nov 19, 2008 5:57 am ] |
| Post subject: | |
Like previously mentioned your best bet is to comment out the bind to ip address option and just firewall to only allow inbound connects to 3306 from the ip address of your other server. Also make sure any sql accounts with the host of '%' are password protected. |
|
| Author: | nateleavitt [ Wed Nov 19, 2008 12:28 pm ] |
| Post subject: | |
hybinet wrote: Xan wrote: The more recent MySQL releases use: Code: bind-address=127.0.0.1 in the config file by default. Change this from the local IP to the one you'd like to use. That will probably prevent MySQL from being accessible from localhost. In addition, I don't think it's currently possible to make MySQL bind to only two interfaces. (i.e. You can't have two "bind-address" directives.) MySQL binds either to only one interface or to all available interfaces. So just comment out the whole "bind-address" line in my.cnf. That'll make MySQL bind to all interfaces. Then you can use your firewall to make port 3306 only accessible from your other server. right now I have Code: bind-address=127.0.0.1 192.168.135.123 I thought you could bind multiple addresses. I'll try removing it to see if that would work. |
|
| Author: | nateleavitt [ Wed Nov 19, 2008 12:45 pm ] |
| Post subject: | |
ok guys... I removed the bind-address and it's now open! I just added the following rule to only open port 3306 for the local network interface: Code: -A INPUT -i eth1 -p tcp -m tcp --dport 3306 -j ACCEPT Thanks for the suggestions guys! |
|
| Author: | MrRx7 [ Thu Nov 20, 2008 3:20 am ] |
| Post subject: | |
nateleavitt wrote: ok guys... I removed the bind-address and it's now open! I just added the following rule to only open port 3306 for the local network interface: Code: -A INPUT -i eth1 -p tcp -m tcp --dport 3306 -j ACCEPT Thanks for the suggestions guys! glad you got it working, however just because you have restricted traffic to the internal network within the data center does not mean you are safe. I would still suggest limiting your firewall down to the specific ip address of your other server. for example: Code: -A INPUT -p TCP -s xx.xx.xx.xx --destination-port 3306 -j ACCEPT |
|
| Page 1 of 1 | All times are UTC-04:00 |
| Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |
|