From owner-freebsd-net@FreeBSD.ORG Fri Apr 23 10:35:14 2004 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 557E516A4D0; Fri, 23 Apr 2004 10:35:14 -0700 (PDT) Received: from tigra.ip.net.ua (tigra.ip.net.ua [82.193.96.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id 85C8043D31; Fri, 23 Apr 2004 10:35:13 -0700 (PDT) (envelope-from ru@ip.net.ua) Received: from heffalump.ip.net.ua (heffalump.ip.net.ua [82.193.96.213]) by tigra.ip.net.ua (8.12.11/8.12.11) with ESMTP id i3NHdvLh099042 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 23 Apr 2004 20:39:59 +0300 (EEST) (envelope-from ru@ip.net.ua) Received: (from ru@localhost) by heffalump.ip.net.ua (8.12.11/8.12.11) id i3NHZIJo003269; Fri, 23 Apr 2004 20:35:18 +0300 (EEST) (envelope-from ru) Date: Fri, 23 Apr 2004 20:35:18 +0300 From: Ruslan Ermilov To: David Yeske Message-ID: <20040423173518.GC2922@ip.net.ua> References: <20040423005057.15006.qmail@web13504.mail.yahoo.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="lCAWRPmW1mITcIfM" Content-Disposition: inline In-Reply-To: <20040423005057.15006.qmail@web13504.mail.yahoo.com> User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp) cc: Archie Cobbs cc: net@FreeBSD.org Subject: Re: netgraph ability 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: Fri, 23 Apr 2004 17:35:14 -0000 --lCAWRPmW1mITcIfM Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable [ Redirected to -net ] On Thu, Apr 22, 2004 at 05:50:57PM -0700, David Yeske wrote: > I'm in a situation where I need to emulate multiple ethernet devices with > different mac addresses. I have gotten far enough to have this. >=20 > I ran ngctl and then ran > "mkpeer . eiface hook ether" >=20 > I then ran > ifconfig ngeth0 link '00:bd:03:11:21:11' > ifconfig ngeth0 192.168.20.5 > ifconfig sis0 192.168.23.45 >=20 > So basically I want to be able to ping / connect to=20 > 192.168.20.5 from another box on the 192.168.23.0/24 network, and have it= see > the mac address that I have set rather than the mac address of my sis0 de= vice. > I know I can do this with vmware, but I am trying to avoid that. >=20 > Anyone know if this is possible? Is there a way to do this with the tap = device > and or arpd? >=20 Using Netgraph, you can emulate any number of Ethernet interfaces on one physical interface. Here's my recipe for you: 1. Load the ng_ether(4) module. 2. Create the required number of ng_eiface(4) nodes. 3. Connect "lower" and "upper" of sis0: and all ngethX: ng_ether(4) nodes to one ng_bridge(4). 4. Make sure to "ngctl msg : setautosrc 0" to all ng_ether(4) nodes. 5. Optionally set net.link.ether.inet.log_arp_wrong_iface=3D0. Here's my test (I've omitted obvious configuration steps): # ifconfig dc0 ether dc0: flags=3D8843 mtu 1500 options=3D48 ether 00:10:a4:c0:c0:45 # ifconfig ngeth0 ngeth0: flags=3D8843 mtu 1500 ether 00:00:00:01:02:03 # ngctl show bridge: Name: bridge Type: bridge ID: 0000000b Num hooks: 4 Local hook Peer name Peer type Peer ID Peer hook ---------- --------- --------- ------- --------- link4 ngeth0 ether 00000007 lower link3 ngeth0 ether 00000007 upper link2 dc0 ether 00000002 lower link1 dc0 ether 00000002 upper # ifconfig ngeth0 1.2.3.4 # tcpdump -lenx -i dc0 ether host 0:0:0:1:2:3 tcpdump: listening on dc0 20:29:05.571179 0:0:0:1:2:3 ff:ff:ff:ff:ff:ff 0806 42: arp who-has 1.2.3.4 = tell 1.2.3.4 0001 0800 0604 0001 0000 0001 0203 0102 0304 0000 0000 0000 0102 0304 Cheers, --=20 Ruslan Ermilov ru@FreeBSD.org FreeBSD committer --lCAWRPmW1mITcIfM Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (FreeBSD) iD8DBQFAiVPWUkv4P6juNwoRAm9cAJ408iFmsjqyt7BsbUCLLdBghhM7YACfcYJv qqwP5OCSr4gezalcnT0WFIg= =fYNN -----END PGP SIGNATURE----- --lCAWRPmW1mITcIfM--