Question about tun/tap networking
Hi,
i am trying to set up two virtual machines with qemu 0.5.4. I have them running, both with 2 network cards. I am able to ping all 4 interfaces from the host they are running from but am not able to ping between both virtual machines...
If i do a tcpdump on the corrsponding tun interfaces while trying to ping i see a lot of arp who-has 172.16.0.254 tell 172.16.0.1 messages (172.16.0.1 is the one machine, the other is 172.16.0.254). Is there something i have to do to get the arp responses right ?? Or am i totally wrong ?
thanks for any help,
--arne
Quoting Arne Bernin <[email protected]>:
Quoted 12 lines
Hi,
i am trying to set up two virtual machines with qemu 0.5.4. I have them running, both with 2 network cards. I am able to ping all 4 interfaces from the host they are running from but am not able to ping between both virtual machines...
If i do a tcpdump on the corrsponding tun interfaces while trying to ping i see a lot of arp who-has 172.16.0.254 tell 172.16.0.1 messages (172.16.0.1 is the one machine, the other is 172.16.0.254). Is there something i have to do to get the arp responses right ?? Or am i totally wrong ?
You've stuck both virtual machines on the same subnet, so they think they're on the same physical LAN. That's why they're doing ARPs and expecting replies. But you're actually running two QEMU instances on two seperate TUN interfaces and they *aren't* bridged. So the ARP on tun0 never gets seen on tun1 (and vice-versa).
Set the second TUN interface to a different subnet (eg, 172.16.1.x) and enable ipv4 forwarding. Linux will then forward packets between tun0 and tun1.
You could also muck about with proxyarp or bridging but honestly, I wouldn't bother with that. Routing is a lot easier to understand.
Quoted 2 lines · On Mon, 2004-05-03 at 02:35, [email protected] wrote:
You could also muck about with proxyarp or bridging but honestly, I wouldn't bother with that. Routing is a lot easier to understand.
Bridging is not that difficult, either:
0. Get the userland bridge utils from http://bridge.sourceforge.net/ and make sure your host Linux kernel is configured with CONFIG_BRIDGE
1. Create a bridge device (called 'br0', for instance):
# brctl addbr br0
2. Activate both TUN interfaces (but don't assign them IP addresses:
you'll do that for the bridge device instead)
# ifconfig tun0 0.0.0.0 # ifconfig tun1 0.0.0.0
3. Add both TUN interfaces to the bridge:
# brctl addif br0 tun0 # brctl addif br0 tun1
4. Set the bridge device IP address:
# ifconfig br0 172.16.1.1
C