155 | | 1. The protocol is correct - tcp. If tcp6 is running for example (IPv6) then the connection will not likely work. |
156 | | 2. The service is listening on the correct ip. If the entry was 127.0.0.1:5432 you wouldn't get a connection because it's only listening to the localhost. 0.0.0.0:5432 or the machine's public IP are acceptable. |
157 | | 3. The service is listening for connections from where ever you're trying to connect from. In this case it will take a connection from anywhere (0.0.0.0:*). It's important to ensure that the machine isn't listening for a connections from a specific machine (ie. 10.0.0.2:*) or if it is, then it's the machine you're trying to connect from. |
| 155 | 1. The protocol is correct - tcp. If tcp6 is running for example (IPv6) then the connection will not likely work.[[BR]] |
| 156 | |
| 157 | 2. The service is listening on the correct ip. If the entry was 127.0.0.1:5432 you wouldn't get a connection because it's only listening to the localhost. 0.0.0.0:5432 or the machine's public IP are acceptable.[[BR]] |
| 158 | |
| 159 | 3. The service is listening for connections from where ever you're trying to connect from. In this case it will take a connection from anywhere (0.0.0.0:*). It's important to ensure that the machine isn't listening for a connections from a specific machine (ie. 10.0.0.2:*) or if it is, then it's the machine you're trying to connect from.[[BR]] |
| 160 | |
163 | | ps aux | grep 80 |
164 | | }}} |
165 | | |
| 166 | ps aux | grep postgresql |
| 167 | }}} |
| 168 | |
| 169 | In this example, you should see a line like: |
| 170 | {{{ |
| 171 | postgres 21296 0.0 0.0 100608 5784 ? S May28 0:01 /usr/lib/postgresql/8.3/bin/postgres -D /<path>/main |
| 172 | }}} |
| 173 | |
| 174 | This will change depending on the service you're running, but will coincide with the command you ran to start the service. (So in the example above, the command to start postgres was obviously: /usr/lib/postgresql/8.3/bin/postgres -D /<path>/main) |
| 175 | |
| 176 | ---- |
| 177 | == Quick Reference == |
| 178 | |
| 179 | === Commands === |
| 180 | {{{ |
| 181 | # list rules |
| 182 | |
| 183 | sudo iptables -L |
| 184 | sudo iptables -L -n |
| 185 | |
| 186 | # iptable command syntax |
| 187 | |
| 188 | iptables -A INPUT -s 10.104.100.167 -d 10.104.100.168 -p tcp -m tcp --dport 8023 -j ACCEPT |
| 189 | |
| 190 | # save |
| 191 | |
| 192 | sudo iptables-save > /<path>/<firewall_file> |
| 193 | |
| 194 | # apply |
| 195 | |
| 196 | sudo iptables-restore < /<path>/<firewall_file> |
| 197 | }}} |
| 198 | |
| 199 | === Necessary Ports - Database Server === |
| 200 | |