Date: Fri, 23 Apr 2004 20:35:18 +0300 From: Ruslan Ermilov <ru@FreeBSD.org> To: David Yeske <dyeske@yahoo.com> Cc: net@FreeBSD.org Subject: Re: netgraph ability Message-ID: <20040423173518.GC2922@ip.net.ua> In-Reply-To: <20040423005057.15006.qmail@web13504.mail.yahoo.com> References: <20040423005057.15006.qmail@web13504.mail.yahoo.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--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 <if>: 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<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500 options=3D48<VLAN_MTU,POLLING> ether 00:10:a4:c0:c0:45 # ifconfig ngeth0 ngeth0: flags=3D8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> 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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040423173518.GC2922>