Find the answer to your Linux question:
Results 1 to 2 of 2
how i can log accepted and dropped packets? for example i have this rule iptables -A INPUT -p tcp --sport 80 -j ACCEPT iptables -A INPUT -p tcp --sport 80 ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Apr 2008
    Posts
    38

    log accepted/drpped packets


    how i can log accepted and dropped packets?
    for example i have this rule
    iptables -A INPUT -p tcp --sport 80 -j ACCEPT
    iptables -A INPUT -p tcp --sport 80 -j REJECT
    how i can log each rule?
    please help me.

  2. #2
    Linux Guru Lazydog's Avatar
    Join Date
    Jun 2004
    Location
    The Keystone State
    Posts
    2,677
    Simple, you need to log the packet before it is accepted or dropped like so:

    Code:
    iptables -A INPUT -p tcp --sport 80 -j LOG
    iptables -A INPUT -p tcp --sport 80 -j ACCEPT
    
    
    iptables -A INPUT -p tcp --sport 80 -j LOG
    iptables -A INPUT -p tcp --sport 80 -j REJECT
    Read the man pages or do a google search on iptables logging to get the full logging you require.

    Regards
    Robert

    Linux
    The adventure of a life time.

    Linux User #296285
    Get Counted

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •