![]() |
Iptables Control Outbound Connections - need help
I want to have this script run at start up and add these rules to iptables. But, do I have to flush all chains first? Or will this work ok, how it is?
My virtual machine software places a bunch of rules in there and I didn't want it to conflict with that. I'm not sure what all the processes are that the vm uses, so kind of difficult to whitelist that. Any ideas/suggestions? Should I try to whitelist the vm? Code:
#!/bin/bash |
well it doesn't look like it would conflict, expect the default drops at the bottom, but you've not said anything about what distro / firewall system you're currently using. it's normally a much better option to take these rules and add them to your normal iptables configuration, e.g. /etc/sysconfig/iptables on a redhat / fedora system.
|
Quote:
I guess i'm having a hard time figuring out how to integrate them with the rules already in place from what the vm software put there. If I just whitelist whatever process the vm software is (and needs) will it work the same as if it was using it's own previous rules? |
iptables is the same, but there are a million ways to control configuration files and services around iptables, which is just a command line tool that needs something to use it.
|
I know how to get the script to run at start up. That is not my problem.
My main question/problem is: Quote:
For example, I have something similar to this already in iptables: Code:
-A POSTROUTING -s 192.168.xxx.0/24 -d ! 192.168.xxx.0/24 -j MASQUERADE |
Again, it depends how these rules are being implemented, so again can depend on what distro and firewall mechanism you are using. is it a secret??
in your specific example, you have a nat operation and a filter operation, so they wouldn't directly conflict as POSTROUTING is always done after OUTPUT. Of course a catchall DROP in OUTPUT would mean nothing explicitly passed already would never hit POSTROUTING and the rest of the world. |
| All times are GMT -5. The time now is 11:11 AM. |