From: "Gáspár Lajos" <swifty@freemail.hu>
To: Don Gould <don@bowenvale.co.nz>
Cc: netfilter@lists.netfilter.org
Subject: Re: IPTables script problem...
Date: Thu, 26 Oct 2006 14:06:51 +0200 [thread overview]
Message-ID: <4540A4DB.6080001@freemail.hu> (raw)
In-Reply-To: <4540847B.8080407@bowenvale.co.nz>
Don Gould írta:
> Can anyone tell me why this isn't working?
>
...
>
> [root@bowenvale shared]# cat dhcp.src
> #!/bin/sh
For debug try this:
#!/bin/bash -x
> nowdate=$(date)
> # echo $nowdate, $0, $1, $2, $3 >> /home/shared/dhcpconnect.log
>
> echo $nowdate, $2, $3 >> /home/shared/dhcpconnect.log
>
> echo "Start" >> /home/shared/dhcpconnect.log
>
> mysql -h bowenvale -u oncs -pbutterfly -e "INSERT INTO
> oncs.tblSessionRequest (MACAddress, IPAddress) VALUES('$2', '$3
> ');" &> /home/shared/dhcpconnect.log
hmm...
You mean:
&>>/home
???
> echo "Done - database log" >> /home/shared/dhcpconnect.log
>
> # Now we start the data accounting bit using IP tables...
> # Make sure the iptables rules exist! This should return errors because
> these rules should always already exist.
> iptables -N traffic_in >> /home/shared/dhcpconnect.log
> iptables -N traffic_out >> /home/shared/dhcpconnect.log
>
> echo $nowdate, $2, $3 >> /home/shared/dhcpconnect.log
>
> echo "Done - rule create" >> /home/shared/dhcpconnect.log
>
> # Create Rule for IP to count the data.
> iptables -A traffic_in -d $3 >> /home/shared/dhcpconnect.log
> iptables -A traffic_out -s $3 >> /home/shared/dhcpconnect.log
>
> echo "Done - counter add" >> /home/shared/dhcpconnect.log
>
> #add chains as target to FORWARD rule - after the first time, this
> should always be already done.
> iptables -I FORWARD 1 -j traffic_in >> /home/shared/dhcpconnect.log
> iptables -I FORWARD 2 -j traffic_out >> /home/shared/dhcpconnect.log
>
>
> echo "Done forward rule add" >> /home/shared/dhcpconnect.log
>
> echo "Done", $2, $3 >> /home/shared/dhcpconnect.log
>
What is in dhcpconnect.log ??? :)
Could you post it? :)
Swifty
next prev parent reply other threads:[~2006-10-26 12:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-26 9:48 IPTables script problem Don Gould
2006-10-26 12:06 ` Gáspár Lajos [this message]
2006-10-26 23:12 ` Don Gould
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4540A4DB.6080001@freemail.hu \
--to=swifty@freemail.hu \
--cc=don@bowenvale.co.nz \
--cc=netfilter@lists.netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox