LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   No /proc/net/ip_conntrack folder in Debian Sarge (https://www.linuxquestions.org/questions/linux-networking-3/no-proc-net-ip_conntrack-folder-in-debian-sarge-488346/)

dkz 09-30-2006 06:44 PM

No /proc/net/ip_conntrack folder in Debian Sarge
 
Hi.
My status = linux newbie :)

I would like to know how many connection to port 80 and a ftp port. I have used a perlscript that worked on my other Debian box. But on this new one its says: /proc/net/ip_conntrack: No such file or directory.

Why isn't this folder in my new setup?

Used script:
Code:

netstat="/bin/netstat"
grep="/bin/grep"
sed="/bin/sed"
wc="/usr/bin/wc"
cat="/bin/cat"
printf="/usr/bin/printf"
host="/usr/bin/host"
port=$1
filter="$2"
ip="$3"

ip_conntrack=`$cat /proc/net/ip_conntrack | $grep ESTABLISHED`

if [ -n "$port" ]
then
  if [ "$filter" = src ] || [ "$filter" = dst ]
  then
    ip=`$host "$3" | grep "has address" | cut -d" " -f4`
    res=`$printf "$ip_conntrack" | $grep "dport=$port " | $grep "$filter=$ip" | $wc -l | $sed s/" "//g`
  else
    res=`$printf "$ip_conntrack" | grep "dport=$port " | $wc -l | $sed s/" "//g`
  fi
else
  res=`$printf "$ip_conntrack" | $wc -l | $sed s/" "//g`
fi
printf "$res\n$res\n"


b0uncer 10-01-2006 11:20 AM

The whole /proc is a virtual filesystem, so it doesn't "really" exist. It's often described as merely a "peek hole into the kernel", so if you don't have ip_conntrack module enabled in iptables (which is a kernel module, in addition to the iptables software you install) you probably don't have that "folder" (btw. Linux doesn't use "folders", it talks about "directories", and in this case it's a virtual directory) at all.

So, make sure you have ip_conntrack module loaded into your kernel. If it's not builtin (as it seems it's not), try
Code:

modprobe ip_conntrack
and re-run your script again.

dkz 10-01-2006 12:05 PM

Quote:

Originally Posted by b0uncer
The whole /proc is a virtual filesystem, so it doesn't "really" exist. It's often described as merely a "peek hole into the kernel", so if you don't have ip_conntrack module enabled in iptables (which is a kernel module, in addition to the iptables software you install) you probably don't have that "folder" (btw. Linux doesn't use "folders", it talks about "directories", and in this case it's a virtual directory) at all.

So, make sure you have ip_conntrack module loaded into your kernel. If it's not builtin (as it seems it's not), try
Code:

modprobe ip_conntrack
and re-run your script again.

Thanx for that b0uncer. Shall write directory insted of folder in the future ;) Old habbit from Windows enviroments.

modprobe worked... Once again thank you...


All times are GMT -5. The time now is 01:48 AM.