Connecting VM eth0 to guest tap device [message #11764] |
Thu, 05 April 2007 11:39 |
HRogge
Messages: 16 Registered: April 2007
|
Junior Member |
|
|
Hello,
I'm looking for a way to connect a simulated eth0 device inside the virtual machine with a tap device on the guest computer.
I'm using NS2 to emulate a WLAN connection and NS2 was connected with tap devices to UML (User Mode Linux) VMs. Unfortunately UML has performance problems so I would like to try the same with OpenVZ.
|
|
|
|
|
|
|
|
|
Re: Connecting VM eth0 to guest tap device [message #11863 is a reply to message #11862] |
Tue, 10 April 2007 08:48 |
dev
Messages: 1693 Registered: September 2005 Location: Moscow
|
Senior Member |
|
|
So you can simply bridge veth and tap devices like this:
VE0 VE
|
|
veth100 < - > eth0
^ |
| |
br0 |
^ |
| |
tap |
^ |
| |
NS-2 |
No, tap cannnot be granted to VE (moved), since it's another pair should be at the same VE.
I suppose bridging is what you need, i.e. you need to add both veth100 and tap to bridge br0.
[Updated on: Tue, 10 April 2007 08:49] Report message to a moderator
|
|
|
|
|
|
Re: Connecting VM eth0 to guest tap device [message #12069 is a reply to message #11764] |
Tue, 17 April 2007 06:32 |
HRogge
Messages: 16 Registered: April 2007
|
Junior Member |
|
|
This is the network I'm working on:
Bridges
*------------------------* *----------------------*
| Virtual Machine 100 | ------- vzbr100 ------- | NS-2 |
| | / \ | |
| eth0 ============== veth100.0 tap100 ============ |
| Ip: 10.0.0.100 | Mac: 00:00:00:00:01:00 Ip: 10.0.0.200 | |
| Mac: 00:00:00:00:02:00 | Mac: 16:2C:D1:C5:09:83 | |
*------------------------* | |
| WLAN Emulation |
*------------------------* | |
| Virtual Machine 101 | ------- vzbr101 ------- | |
| | / \ | |
| eth0 ============== veth101.0 tap101 ============ |
| Ip: 10.0.0.101 | Mac: 00:00:00:00:01:01 Ip: 10.0.0.201 | |
| Mac: 00:00:00:00:02:01 | Mac: D2:87:CA:1E:63:E8 | |
*------------------------* *----------------------*
- VM 100 is sending UDP broadcasts:
vn100:/# tcpdump -e -i eth0
06:23:05.415945 00:00:00:00:02:00 (oui Ethernet) > Broadcast, ethertype IPv4 (0x0800), length 62: 10.0.0.100.698 > 10.0.0.255.698: UDP, length 20
- I can see this packages on veth100.0 on the host-machine:
host:/# tcpdump -e -i veth100.0
08:25:32.584301 00:00:00:00:02:00 (oui Ethernet) > Broadcast, ethertype IPv4 (0x0800), length 62: 10.0.0.100.698 > 10.0.0.255.698: UDP, length 20
- I can see them on the bridge vzbr100:
host:/# tcpdump -e -i vzbr100
08:26:48.403584 00:00:00:00:02:00 (oui Ethernet) > Broadcast, ethertype IPv4 (0x0800), length 62: 10.0.0.100.698 > 10.0.0.255.698: UDP, length 20
- The packages enter the NS2 emulation through tap100:
host:/# tcpdump -e -i tap100
08:27:43.959279 00:00:00:00:02:00 (oui Ethernet) > Broadcast, ethertype IPv4 (0x0800), length 62: 10.0.0.100.698 > 10.0.0.255.698: UDP, length 20
- They are leaving the emulation through tap101:
host:/# tcpdump -e -i tap101
08:28:37.466638 00:00:00:00:02:00 (oui Ethernet) > Broadcast, ethertype IPv4 (0x0800), length 62: 10.0.0.100.698 > 10.0.0.255.698: UDP, length 20
- But they do NOT appear on the second bridge vzbr101
- They don't reach veth101.0
- And they don't reach the eth device of VM 101
Maybe this informations will help you to understand my configuration and my problem.
The same happens when I start the broadcasting on VM 101. They packages go through NS2 and don't appear on bridge vzbr100.
|
|
|
|
|
|
|
|
|
|
|
Re: Connecting VM eth0 to guest tap device [message #12085 is a reply to message #11764] |
Tue, 17 April 2007 13:05 |
HRogge
Messages: 16 Registered: April 2007
|
Junior Member |
|
|
I tried something like this but got a kernel panic:
static int veth_xmit(struct sk_buff *skb, struct net_device *dev)
{
struct net_device_stats *stats;
struct net_device *rcv = NULL;
struct veth_struct *entry;
int length;
const unsigned char *dest = eth_hdr(skb)->h_dest;
printk("veth_xmit dst: %02x:%02x:%02x:%02x:%02x:%02x\n",
(int)(dest[0]),(int)(dest[1]),(int)(dest[2]),(int)(dest[3]),(int)(dest[4]),(int)(dest[5]));
|
|
|