2008/2/13 Radu Oprisan <[EMAIL PROTECTED]>:
>
> Radu Oprisan wrote:
> > Tiberiu Ungureanu wrote:
> >> On Wed, 2008-02-13 at 13:44 -0500, Mircea Vutcovici wrote:
> >>
> >>> Trimite arp request. Dar pentru asta ai nevoie de un IP. Si tocmai
> >>> adresa de IP era necunoscuta.
> >>> Iar eu sunt inca nedumerit cum poti trimite un arp-request daca nu
> >>> stii ip-ul. Sau e chestie de Harry Poker?!
> >>>
> >>
> >>
> >> ** disclaimer: n-am citit threadul de la inceput, si s-ar putea sa ma
> >> bag ca musca in lapte, fara nici o legatura cu realitatea **
> >>
> >> ** disclaimer2: mesajul asta se vrea un reply catre Mircea Vutcovici,
> >> care raspunsese unui mesaj al lui Radu Oprisan, in care Radu zicea
> >> "stiind adresa MAC, poti sa aflii adresa IP dand un arpig" **
> >>
> >> Mircea,
> >>
> >> nu trimiti arp-request, pentru ca pentru ala trebuie sa stii IP-ul.
> >> Trimiti un Rarp-request, pentru care nu trebuie sa stii ip-ul, ci MAC-ul
> >>
> >> Recommended reading:
> >> ftp://ftp.rfc-editor.org/in-notes/rfc903.txt
> >> http://en.wikipedia.org/wiki/RARP
Nici o versiune de arping nu foloseste RARP.
Mai mult, la ora de potiuni ni s-a spus ca daca vrei sa primesti
raspuns la un RARP request ai nevoie de un daemon numit rarpd, un
stramos al BOOTP/DHCP.
Sa citim un pic din ceaslov:
NAME
arping - send ARP REQUEST to a neighbour host
SYNOPSIS
arping [-AbDfhqUV] [-c count] [-w deadline] [-s source] -I
interface destination
DESCRIPTION
Ping destination on device interface by ARP packets, using
source address source.
[...]
[EMAIL PROTECTED]:~$ man arping |egrep -i 'icmp|rarp'
[EMAIL PROTECTED]:~$
[EMAIL PROTECTED]:~$ arping -V
arping utility, iputils-sss20070202
> >>
> >>
> >>
> >
> > De fapt se foloseste un artificiu:
> >
> > if (searchmac) {
> > // ping MAC
> > /*
> > * KEYWORD
> > * What the hell was I thinking when I wrote the
> > comment below?
> > * -------
> > * note: it's eth_xmas below, that's a feature. I don't
> > want
> > * a -t line to affect a MAC ping (even though it
> > can't
> > * since the lone arg is written last).
> > * -------
> > * Phew! Anyway, change eth_target to eth_xmas three lines
> > * below to change it back.
> > */
> > if (-1 == libnet_build_ethernet(eth_target, /* <----
> > here */
> > eth_source,
> > ETHERTYPE_IP,
> > NULL,
> > 0,
> > packet)) {
> > fprintf(stderr, "libnet_build_ethernet():
> > error\n");
> > exit(1);
> > }
> >
> > libnet_build_ip(ICMP_ECHO_H, /* Size of the payload */
> > 0, /* IP tos */
> > rand(), /* IP ID */
> > 0, /* frag stuff */
> > 48, /* TTL */
> > IPPROTO_ICMP, /* transport
> > protocol */
> > myip, /* source IP */
> > dip, /* destination IP */
> > NULL, /* pointer to
> > payload */
> > 0, /* payload length */
> > packet + LIBNET_ETH_H); /* header
> > memory */
> >
> > libnet_build_icmp_echo(ICMP_ECHO, /* type */
> > 0, /* code */
> > 4321, /* id */
> > 6, /* seq */
> > NULL, /* pointer to
> > payload */
> > 0, /* payload length */
> > /* header memory */
> > packet + LIBNET_ETH_H +
> > LIBNET_IP_H);
> >
> >
> >
> >
> >
> > Deci... Prietenul creeaza un packet ICMP pe care il arunca inspre
> > MAC-ul respectiv.
> >
> > if (searchmac) {
> > if (-1 == pcap_compile(pcap,&bp,"icmp",0,-1)) {
> > fprintf(stderr, "pcap_compile(): error\n");
> > exit(1);
> > }
> > } else {
> >
> > Motivul pentru care explicam ca s-ar putea sa nu functioneze la un
> > switch sau la un device vlan enabled este ca nu poti sa stii pe unde
> > va trimite raspunsul.
> >
> > mgw ~ # /home/darku/arping-2.06/arping -i eth3.100 00:19:5B:5D:47:A2
> > ARPING 00:19:5B:5D:47:A2
> > 75 bytes from 195.95.255.23 (00:19:5b:5d:47:a2): icmp_seq=598
> > time=616.388 msec
> >
>
> Mentionez ca testul este facut pe un device in uz, motiv pentru care a
> durat atat pana sa gaseasca ip-ul. Explic mai departe daca e cazul...
>
>
> >
> > case 'T': // destination IP in mac ping (default:
> > 0xffffffff)
> > if (-1 == (dip = libnet_name_resolve(optarg,
> >
> > LIBNET_RESOLVE))){
> > fprintf(stderr, "arping: can't resolve:
> > %s\n",
> > optarg);
> > exit(1);
> > }
> >
> >
> > Din cate observ... are niste "shortcommings metoda asta, dar
> > functioneaza in general.
> > Ma intorc la film.
> >
> >
> > _______________________________________________
> > RLUG mailing list
> > [email protected]
> > http://lists.lug.ro/mailman/listinfo/rlug
>
>
> _______________________________________________
> RLUG mailing list
> [email protected]
> http://lists.lug.ro/mailman/listinfo/rlug
>
_______________________________________________
RLUG mailing list
[email protected]
http://lists.lug.ro/mailman/listinfo/rlug