On Wed, Oct 02, 2013 at 12:40:26PM -0700, Ross Boylan wrote:
> Can anyone explain to me what difference between tap and the bridge is?
> They both seem to do the same thing*, but apparently tap needs to be hooked
> in to a bridge.  And for some reason the qemu/kvm docs seems to recommend
> tap.

Ok, let me try to explain. If I'm wrong here, then someone who knows
better please jump in and correct me. Let's use a physical analogy. A
tap device is a virtual network device VS. a physical eth device which
is a card/chip in your computer. They both pass ethernet traffic, but
ethx is physical, and tapx is virtual.

Now, sticking to physical analogies, pretend you have standard
ethernet cables, and an ethernet switch. Your ethx, and tapx devices
are ethernet cables. Your brx device is the network switch. When you
bridge ethernet interfaces like eth0 and tap0 into a single bridge
device like br0, you're doing the equivalent of plugging your ethernet
cables into an ethernet switch. When you do that, your bridge becomes
a single network device. Traffic from any of the eth/tap interfaces
bridged together is seen by all other eth/tap interfaces on that
bridge. So, maybe I should have compared the bridge to a network hub,
instead of a switch.

Ok, here's where my analogy breaks down. When you bridge an ethx
interface, you don't use that interface anymore. So, if you bridge
your eth0 interface into an br0 bridge a line like iface eth0 in your
/etc/network/interfaces line becomes iface br0 instead. 
You have a line that says bridge_ports all tap0 in your interfaces
file, and that worries me. If I understand correctly, that line
combines all ethx interfaces on your system into a single bridge,
which likely isn't what you want. You also seem to have eth0 through
eth2 on your system. Do you really want the virtual machine to be able
to communicate over all three interfaces? If not, then which network do
you want the virtual machine to be on, eth0, eth1, or eth2? Whichever
one that is, you want to put that into your bridge. So, let's say you
want your virtual machine(s) to be on the eth2 network. So, a bridge
would look something like this:

...
iface br0 inet dhcp
bridge_ports eth2 tap0
...

Once you do that, the virtual machine configured to use tap0 would be
able to talk to all computers on the network to which eth2 is
connected. Since you are bridging eth2, you don't want to have:

...
iface eth2 inet dhcp
...

anywhere in your interfaces file. I use virtualbox and user-mode-linux
here, not kvm, so I don't know why kvm has its own networking script,
or how that script exactly does what it does. From looking at what you
posted, it looks like it adds tap devices used by virtual machines to
an existing bridge. If I'm right here, and I don't know for sure that
I am, you probably want something like this in your interfaces file:

...
iface br0 inet dhcp
bridge_ports eth2
...

which would make a bridge with one interface. Then if I'm right, your
kvm networking script would create tap devices, and add them to the
br0 bridge as needed. HTH.

Greg


-- 
web site: http://www.gregn..net
gpg public key: http://www.gregn..net/pubkey.asc
skype: gregn1
(authorization required, add me to your contacts list first)

--
Free domains: http://www.eu.org/ or mail dns-mana...@eu.org


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/20131002231003.ga22...@gregn.net

Reply via email to