Re: IPTables script problem...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux Netfilter Development]     [Linux Kernel Networking Development]     [Netem]     [Berkeley Packet Filter]     [Linux Kernel Development]     [Advanced Routing & Traffice Control]     [Bugtraq]

  Powered by Linux