Where is eth0 ?
I want to learn TCP/IP protocol etc., so I want to read raw information from my ethernet card. But I couldn't find eth0 file descriptor in /dev or in other directories.
-how can I read from eth0?
-is there another way to read raw packets?
You can use tcpdump.
to read 25 packets from eth0 and then quit.
$tcpdump -c 25 -i eth0
If you want a more sophisticated "packet sniffer", you can use Wireshark.
Thank you, I can use it.
But I can not say I'm satisfied. I want to read packets directly from eth0 in my C program. Like reading a file or writing to /dev/audio.
How can I do that?
I don't think you can read directly from a NIC in C but then again, I don't really know C that well. You might be able to read IP packets with a socket interface though.