Results 1 to 6 of 6

Thread: Log all TCP/UDP connections

  1. #1
    Junior Member
    Join Date
    Jun 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Question Log all TCP/UDP connections

    Hello all,
    i am using a debian box as router
    what i need is i want to save all the connections to mysql database
    like connection from 192.168.2.2 to 8.8.8.8 protocol DNS port 53 date : xxxx time xxx
    and so on
    can any one guide me

    the setup is like
    INTERNET>>(eth0)LINUX(eth1)(192.168.2.1)>>>PC(192. 168.2.2)

    Thanks

  2. #2
    Member
    Join Date
    Feb 2008
    Posts
    64
    Thanks
    0
    Thanked 6 Times in 5 Posts
    Rep Power
    7

    Default

    Quote Originally Posted by gowifi View Post
    what i need is i want to save all the connections to mysql database
    Split that requirement into three parts:
    0.) configuring logging of traffic by using iptables "-j LOG" rules, and
    1.) configuring your database of choice with the right scheme, and
    2.) configuring the syslog daemon to log (only) these messages (facility and priority or string match) to the database.
    As far as guidance is concerned this should be a simple DIY exercise as log as you invest time reading 'man iptables' (LOG target), the manual page for your syslog daemon and the (on or offline) syslog daemons documentation explaining how to configure logging to MySQL.

  3. #3
    Junior Member
    Join Date
    Jun 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default

    as i am new to iptables can you help me in just sending the log to syslog
    i can configure syslog to save the details to mysql

    Thanks

  4. #4
    Member
    Join Date
    Feb 2008
    Posts
    64
    Thanks
    0
    Thanked 6 Times in 5 Posts
    Rep Power
    7

    Default

    Quote Originally Posted by gowifi View Post
    as i am new to iptables can you help me in just sending the log to syslog
    Sure. Start by posting your 'iptables-save' output, preferably between code tags.

  5. #5
    Junior Member
    Join Date
    Jun 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default

    i don't have anything special in iptables
    just using it as a router by using this

    -A POSTROUTING -o eth0 -j MASQUERADE

  6. #6
    Member
    Join Date
    Feb 2008
    Posts
    64
    Thanks
    0
    Thanked 6 Times in 5 Posts
    Rep Power
    7

    Default

    In its simplest form any "decision" rule should be preceded by a logging rule for example:
    Code:
    iptables -t nat -A POSTROUTING -o eth0 -j LOG
    iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
    iptables -A FORWARD -i eth1 -j LOG
    iptables -A FORWARD -i eth1 -j ACCEPT

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Max connections per IP?
    By maxtox in forum Web servers
    Replies: 3
    Last Post: 24th April 2011, 04:48 AM
  2. auto logging IP connections
    By zZDDU in forum Linux software
    Replies: 0
    Last Post: 23rd February 2011, 04:01 AM
  3. Limiting Irc connections
    By ProfiMK in forum Ubuntu / Debian
    Replies: 6
    Last Post: 20th February 2010, 02:47 PM
  4. iscsi SAN connections
    By lsysamc in forum Ubuntu / Debian
    Replies: 4
    Last Post: 10th April 2009, 10:17 PM
  5. Postgres idle connections
    By kasimani in forum Databases servers
    Replies: 1
    Last Post: 14th May 2007, 06:58 PM

Posting Permissions

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