Tuesday, August 31, 2010

How to enable iptables modules on linux?

Guys,

I have referred following steps and enabled the iptables modules.

1. Required modules to be installed for any firewall like csf or apf :

======
ipt_MASQUERADE
ipt_helper
ipt_SAME
ipt_REDIRECT
ipt_state
ipt_TCPMSS
ipt_LOG
ipt_TOS
tun
iptable_nat
ipt_length
ipt_tcpmss
iptable_mangle
ipt_limit
ipt_tos
iptable_filter
ipt_helper
ipt_tos
ipt_ttl
ipt_REJECT
======

2. Check the loaded module like : lsmod |grep ip
3. touch enableiptablemod.sh
4. vi enableiptablemod.sh and add the following list in this file.

=====
#!/bin/bash
modprobe ipt_helper
modprobe ipt_SAME
modprobe ipt_REDIRECT
modprobe ipt_state
modprobe ipt_TCPMSS
modprobe ipt_LOG
modprobe ipt_TOS
modprobe tun
modprobe iptable_nat
modprobe ipt_length
modprobe ipt_tcpmss
modprobe iptable_mangle
modprobe ipt_limit
modprobe ipt_tos
modprobe iptable_filter
modprobe ipt_helper
modprobe ipt_tos
modprobe ipt_ttl
modprobe ipt_REJECT
=====

5. chmod +x enableiptablemod.sh
6. ./enableiptablemod.sh //execution of the script
=====

That's it.

You can execute following command to enable iptables modules on the VPS :

=====
vzctl set VEID --iptables ipt_REJECT --iptables ipt_tos --iptables ipt_TOS --iptables ipt_LOG --iptables ip_conntrack --iptables ipt_limit --iptables ipt_multiport --iptables iptable_filter --iptables iptable_mangle --iptables ipt_TCPMSS --iptables ipt_tcpmss --iptables ipt_ttl --iptables ipt_length --iptables ipt_state --iptables iptable_nat --iptables ip_nat_ftp --save
=====

Then restart csf or iptables on the VPS.

Try :)

No comments:

Post a Comment