Iptables: bytes count does increment

Issues related to configuring your network
Post Reply
Spytronic
Posts: 2
Joined: 2018/04/17 17:08:36

Iptables: bytes count does increment

Post by Spytronic » 2018/04/17 18:00:31

Hello Guys,

I will explain my environment:

I need to monitor the total traffic of my Network. I want create some iptables rules like the example:

192.168.0.1 to any (customer 1)
192.1268.0.2 to any (customer 2)
192.168.0.3 to any (customer 3)... and go on...

I did a mirroring in my switch port from the firewall port to my CentOS. This is a trunk port, so It receive 802.1q traffic with vlans tags.

The problem is: the byte count is always 0.

1 - I see all the traffic with tcpdump
2 - I thought that might be the vlan tag, I used the br_netfilter module and give a "echo 1 >" in the /proc/sys/net/bridge/bridge-nf-call-iptable and bridge-nf-filter-vlan-tagge, no success.
3 - After, I tried to use the 802.1q module and create sub-interfaces to remove the tag, I saw that works using tcpdump, but no success with the bytes count of iptables.
4 - I tried to use promiscuous port, no success.
5 - I tried to turn on the ip_forward because the rule is using the FORWARD chain, but no success.

Anybody have any ideia why the iptables does not increment the bytes count when I use mirroring traffic ???

tunk
Posts: 1206
Joined: 2017/02/22 15:08:17

Re: Iptables: bytes count does increment

Post by tunk » 2018/04/18 14:34:00

ifconfig shows some TX/RX data.

hunter86_bg
Posts: 2019
Joined: 2015/02/17 15:14:33
Location: Bulgaria
Contact:

Re: Iptables: bytes count does increment

Post by hunter86_bg » 2018/04/19 04:03:11

Are you using VMs or you are monitoring incomming traffic?

User avatar
TrevorH
Site Admin
Posts: 33218
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Iptables: bytes count does increment

Post by TrevorH » 2018/04/19 08:39:14

Do you have an ip address assigned to the interface?
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Spytronic
Posts: 2
Joined: 2018/04/17 17:08:36

Re: Iptables: bytes count does increment

Post by Spytronic » 2018/04/19 12:41:31

tunk wrote:ifconfig shows some TX/RX data.
Yes

tunk wrote:Are you using VMs or you are monitoring incomming traffic?
No, is a baremetal server, I´m trying to monitor the traffic that go to the internet, out
tunk wrote:Do you have an ip address assigned to the interface?
No

User avatar
TrevorH
Site Admin
Posts: 33218
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Iptables: bytes count does increment

Post by TrevorH » 2018/04/19 13:39:38

No ip address and I suspect that means iptables isn't involved. I think it's only called by the kernel for packets that are inbound to the machine. Even with an ip address I suspect it won't be invoked for packets that are not specifically destined for this machine.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Post Reply