Le jeudi 15 mai 2008 20:53, Frédéric ZULIAN a écrit : > Le Thu, May 15, 2008 at 07:55:35PM +0200, Serge Cavailles écrivait : > > Bonjour, > > > > Le jeudi 15 mai 2008 18:52, .:: Alfred Sawaya ::. a écrit : > > > Une petite question technique : Comment faire pour découvrir les > > > ordinateurs de mon sous-réseau en C ? (Juste un ptit algo, ou quelles > > > fonctions utiliser) > > > > Un "ping -b" sur l'IP de broadcast?. > > Ben oui, mais il ne pingue que la premiere adresse IP active qu'il > découvre.
Ce qui ne devrait pas empêcher de sniffer tous les ECHO_REPLY je pense. > sherpa:~# ping -b 192.168.0.255 > PING 192.168.0.255 (192.168.0.255) 56(84) bytes of data. > 64 bytes from 192.168.0.1: icmp_seq=1 ttl=64 time=0.150 ms > 64 bytes from 192.168.0.254: icmp_seq=1 ttl=64 time=0.760 ms (DUP!) > 64 bytes from 192.168.0.1: icmp_seq=2 ttl=64 time=0.142 ms > 64 bytes from 192.168.0.254: icmp_seq=2 ttl=64 time=0.625 ms (DUP!) > 64 bytes from 192.168.0.1: icmp_seq=3 ttl=64 time=0.143 ms > 64 bytes from 192.168.0.254: icmp_seq=3 ttl=64 time=0.608 ms (DUP!) > > --- 192.168.0.255 ping statistics --- > 3 packets transmitted, 3 received, +3 duplicates, 0% packet loss, time > 1998ms rtt min/avg/max/mdev = 0.142/0.404/0.760/0.265 ms et un tcpdump sur l'interface de la machine émétrice révèle: > tcpdump: verbose output suppressed, use -v or -vv for full protocol > decode listening on eth0, link-type EN10MB (Ethernet), capture size 96 > bytes 21:37:35.741135 IP sherpa.cvs-home > 192.168.0.255: ICMP echo > request, id 42817, seq 1, length 64 21:37:35.741264 IP biniou.cvs-home > > sherpa.cvs-home: ICMP echo reply, id 42817, seq 1, length 64 > 21:37:35.741846 IP hatchill.cvs-home > sherpa.cvs-home: ICMP echo reply, > id 42817, seq 1, length 64 21:37:36.742229 IP sherpa.cvs-home > > 192.168.0.255: ICMP echo request, id 42817, seq 2, length 64 > 21:37:36.742352 IP biniou.cvs-home > sherpa.cvs-home: ICMP echo reply, id > 42817, seq 2, length 64 21:37:36.742903 IP hatchill.cvs-home > > sherpa.cvs-home: ICMP echo reply, id 42817, seq 2, length 64 > 21:37:37.742234 IP sherpa.cvs-home > 192.168.0.255: ICMP echo request, id > 42817, seq 3, length 64 21:37:37.742363 IP biniou.cvs-home > > sherpa.cvs-home: ICMP echo reply, id 42817, seq 3, length 64 > 21:37:37.742907 IP hatchill.cvs-home > sherpa.cvs-home: ICMP echo reply, > id 42817, seq 3, length 64 Comme on peut le voir, un seul ping suffit. Note: pour faire ces manips, il faut avoir activé le icmp_broadcast par echo "0" > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts. PS: merci de répondre à la liste. -- Serge -- Lisez la FAQ de la liste avant de poser une question : http://wiki.debian.org/DebFrFrenchLists Vous pouvez aussi ajouter le mot ``spam'' dans vos champs "From" et "Reply-To:" To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]