iptables doubt
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
Quoted 8 lines · varun
Hi all,
Iam new to netfilters and iam trying to play around to
understand a few things. By default when no policies are specified then it allows all traffic to go out and in to the n/w. I want to change this to default as deny.
That is when there is no policy all should be default deny.
Quoted 5 lines
So in order to achieve that i tried to change the code a little.
In the fileiptable_filter.cthere is a variable called
static int forward =NF_ACCEPT
I changed this toNF_DROPand when i compiled and used it
sure i was not able to send any or recv any packets
I think you made the right change in your code in order to have a DROP policy by default in your netfilter. the problem is just after ...
Quoted 4 lines
but even after i give a policy like iptables -t filter -A
INPUT -j ACCEPT
Nothing changes. So achieve what i want what should i do?
And where do i change?
It is quiet normal as you told netfilter to accept incoming packets but you did not configure netfilter to accept *outgoing* packets ... iptables -t filter -A OUTPUT -j ACCEPT
Quoted 8 lines
Another thing is that in normally when i put a policy like
iptables -t filter -A OUTPUT -j REJECT
Even my own self IP doesnt ping? Why should this happen?
Isint it ok to ping local ip and loopback ip?
If i want such implementation where i should be able to
ping to self and local but not any other ip?
Is it possible?
lo is the interface allotted to your local interface (i.e. your host)! You must therefore create two rules in order to let netfilter accept outgoing and incoming packets from and arriving to your local interface. iptables -A INPOUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT
Quoted 2 lines
I dont want to add policies rather is it possible just by
changing the iptables kernel code?
You have to initialize netfilter by adding two static rules implementing the ones described here above.
sta
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFEPiSEw76McB8jGxkRAhzNAJoCC6FwR6PvmEJG8IzNXeod29u8jQCdFPY7 N9fguzx+i6R9s+sCpz+AHfc=
=120L
-----END PGP SIGNATURE-----