From owner-freebsd-net@FreeBSD.ORG Sun Sep 28 15:57:40 2003 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6D87D16A4B3; Sun, 28 Sep 2003 15:57:40 -0700 (PDT) Received: from postfix4-2.free.fr (postfix4-2.free.fr [213.228.0.176]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2A37343FF5; Sun, 28 Sep 2003 15:57:39 -0700 (PDT) (envelope-from yannick.dambielle@free.fr) Received: from shibuya (nord-5-82-67-198-63.fbx.proxad.net [82.67.198.63]) by postfix4-2.free.fr (Postfix) with SMTP id 15052C195; Mon, 29 Sep 2003 00:57:38 +0200 (CEST) Message-ID: <006c01c38613$eaa728f0$3fc64352@shibuya> From: "Dambielle Yannick" To: "Dambielle Yannick" , "Robert Watson" , "Giovanni P. Tirloni" References: <006201c38610$a8a0b910$3fc64352@shibuya> Date: Mon, 29 Sep 2003 00:57:39 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 cc: freebsd-net@freebsd.org Subject: Re: tcpdump - tun/tap virtual interfaces X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Sep 2003 22:57:40 -0000 Sorry for the mistakes (again)... need to sleep :/ Bellow are the right results with the right ip address... # route add 10.0.10.1 10.0.10.2 results are : # route get 10.0.10.1 route to: 10.0.10.1 destination: 10.0.10.1 gateway: 10.0.10.2 interface: tap0 # route get 10.0.10.2 route to: 10.0.10.2 destination: 10.0.10.2 interface: tap0 # ping 10.0.10.1 # tcpdump -i lo0 <-- nothing # tcpdump -i tap0 blablabla.... icmp: echo request blablabla.... icmp: echo reply # ping 10.0.10.2 # tcpdump -i lo0 <-- nothing # tcpdump -i tap0 blablabla.... icmp: echo request blablabla.... icmp: echo reply Yannick ----- Original Message ----- From: "Dambielle Yannick" To: "Robert Watson" ; "Giovanni P. Tirloni" Cc: Sent: Monday, September 29, 2003 12:34 AM Subject: Re: tcpdump - tun/tap virtual interfaces > Hello, > Thank you very much for the details. I think I'm starting to understand the > subject better. > Well, I've did all again from the beggining and now I have the same results > has you had. It works. > 10.0.10.1 is routed via lo0, and 10.0.10.2 is routed via tap0. > Icmp requests and replies could be seen with tcpdump on lo0 for 10.0.10.1, > but for 10.0.10.2, the request were passing trough tap0 while the replies > took lo0 (??). > I don't know, if what I'm going to say is the right method for having both > replies and requests passing through the same interface, so please, give me > a better one. > > I did the following trick : > > # route add 10.0.10.1 10.0.10.2 > > and the result is : > > # route get 10.0.10.1 > route to: 10.0.10.1 > destination: 10.0.0.1 > gateway: 10.0.0.1 > interface: tap0 > > # route get 10.0.10.2 > route to: 10.0.10.2 > destination: 10.0.0.2 > interface: tap0 > > # ping 10.0.0.1 > # tcpdump -i lo0 <-- nothing > # tcpdump -i tap0 > blablabla.... icmp: echo request > blablabla.... icmp: echo reply > > # ping 10.0.0.2 > # tcpdump -i lo0 <-- nothing > # tcpdump -i tap0 > blablabla.... icmp: echo request > blablabla.... icmp: echo reply > > Now I can go back to my jails and my little project :) > > Yannick > > ----- Original Message ----- > From: "Robert Watson" > To: "Giovanni P. Tirloni" > Cc: > Sent: Sunday, September 28, 2003 8:05 PM > Subject: Re: tcpdump - tun/tap virtual interfaces > > > > > > On Sun, 28 Sep 2003, Giovanni P. Tirloni wrote: > > > > > * Robert Watson (rwatson@freebsd.org) wrote: > > > > > > > Do you see anything when you ping the broadcast address or other > foreign > > > > address of the tap interface? Packets delivered to local IP addresses > > > > generally don't go out an interface. > > > > > > About Ethernet frames not going out to the wire and being sent to the > > > loopback.. > > > > > > The check seems to happen at line 291 in if_ethersubr.c and then it > > > uses the if_simloop() function to copy the packet to the loopback > > > interface. Is that right? > > > > > > The rcvif interface is set to the hardware device, how is this used in > > > this case? What kind of checks are done to the rcvif usually? > > > > > > I haven't received my copy of Steven's Volume 2 yet so if it's > > > explained there (as I hope) I will sit in my corner and wait to for it > > > patiently :) > > > > Ethernet loopback does occur, and BPF will pick those up. However, the > > loopback you're seeing is actually happening at the IP layer, as a result > > of routing rather than link layer behavior: > > > > 10 link#6 UC 1 0 tap0 > > 10.0.10.1 00:bd:18:a1:11:00 UHLW 0 26 lo0 > > > > Local IP addresses have their packets routed to them over lo0, so the > > packets being looked for can be found by doing tcpdump on lo0: > > > > test1# tcpdump -eni lo0 & > > [2] 511 > > tcpdump: listening on lo0 > > test1# Sep 28 14:03:07 test1 kernel: lo0: promiscuous mode enabled > > > > test1# ping -c 1 10.0.10.1 > > PING 10.0.10.1 (10.0.10.1): 56 data bytes > > 64 bytes from 10.0.10.1: icmp_seq=0 ttl=64 time=0.073 ms > > > > --- 10.0.10.1 ping statistics --- > > 1 packets transmitted, 1 packets received, 0% packet loss > > round-trip min/avg/max/stddev = 0.073/0.073/0.073/0.000 ms > > test1# 14:03:12.713690 AF 2 84: 10.0.10.1 > 10.0.10.1: icmp: echo request > > 14:03:12.713724 AF 2 84: 10.0.10.1 > 10.0.10.1: icmp: echo reply > > > > Route command output appended below. > > > > Robert N M Watson FreeBSD Core Team, TrustedBSD Projects > > robert@fledge.watson.org Network Associates Laboratories > > > > route get 10.0.10.1 > > route to: 10.0.10.1 > > destination: 10.0.10.1 > > interface: lo0 > > flags: > > recvpipe sendpipe ssthresh rtt,msec rttvar hopcount mtu > > expire > > 0 0 0 0 0 0 1500 > > 0 > > test1# route get 10.0.10.2 > > route to: 10.0.10.2 > > destination: 10.0.0.0 > > mask: 255.0.0.0 > > interface: tap0 > > flags: > > recvpipe sendpipe ssthresh rtt,msec rttvar hopcount mtu > > expire > > 0 0 0 0 0 0 1500 > > -100 > > > > > > _______________________________________________ > > freebsd-net@freebsd.org mailing list > > http://lists.freebsd.org/mailman/listinfo/freebsd-net > > To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org" > > > > _______________________________________________ > freebsd-net@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-net > To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org" >