Skip to contentSkip to conversation

nat does not work with hvm

DISCUSSION Erdem Bayer 2 participants 3 messages Apr 17, 2007 – Apr 25, 2007 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): C2466939.5DAB%[email protected]

#1 lore raw

Hi

I have been playing with the xen-unstable and observed that the vif-nat script is still running in the case of nat in qemu (although on the wrong interface as you have explained) Did I miss something or is it still running in the unstable vers. because it will have support on one of the next releases. Will nat be supported in qemu by xen in future versions or should I write my own qemu-ifup script? Also I was thinking if it is possible to have more than one qemu-ifup scripts and activate them from the config. Is this possible?

For the qemu-ifup script the steps I think is as follows:

1. Determine ip information.
2. Bring interface tap up with the ip
3. write iptables rules to route packages to the domU through tap interface ip

So the problem is passing the necessary values to qemu-ifup scripts. I wonder where qemu-ifup script is called. Is it possible to change its parameters?

Am I right? Do you have anything to add? If you can guide me through this I am sure I can come up with a reasonable script.

Thanks for help
Erdem

Keir Fraser wrote On 14-04-2007 13:19:

Quoted 23 lines · Erdem Bayer
Quoted 8 lines

Will the vif-nat script be run for the hvm domain? If not how does the vifX.0 interface and route rules in my first config be created? I think the the answer of this question is yes. Then what will the qemu-ifup script do? What I wonder is what is the purpose of the qemu-ifup script if the vif-nat script will be run also?

Vif-nat isn't run in this case.

Well actually it is run in 3.0.4 (but not in the very latest xen-unstable repository, so not in the forthcoming Xen 3.0.5). But it'll get run on the wrong interface. The vif2.0, or whatever, interfaces aren't used by qemu. qemu creates its own tap interface and the qemu-ifup script is executed to configure that tap interface.

-- Keir

#2 lore raw
Quoted 6 lines · Erdem Bayer

So the problem is passing the necessary values to qemu-ifup scripts. I wonder where qemu-ifup script is called. Is it possible to change its parameters?

Am I right? Do you have anything to add? If you can guide me through this I am sure I can come up with a reasonable script.

I think you're along the right lines. The qemu-ifup script is run from qemu-dm (source is in tools/ioemu).

-- Keir

#3 lore raw
In reply to a message not in the archive

Hi

Keir Fraser wrote On 14-04-2007 13:19:

Quoted 12 lines

Vif-nat isn't run in this case.

Well actually it is run in 3.0.4 (but not in the very latest xen-unstable repository, so not in the forthcoming Xen 3.0.5). But it'll get run on the wrong interface. The vif2.0, or whatever, interfaces aren't used by qemu. qemu creates its own tap interface and the qemu-ifup script is executed to configure that tap interface.

-- Keir

In xen-unstable vif-nat scripts still runs with qemu-ifup script, when a hvm domain is booted. There are some problems with that. First of all, an un-needed vif interface is created and configured with the values from the hvm configuration file, and you can not write a qemu-ifup script that takes same info from config file. (for example you cannot configure the ip address of your tap interface because that ip is taken by vif interface, wrongly.)

Also I strongly believe that a qemu-ifdown script is needed. For example if you write some iptables rules in qemu-ifup, then these rules should be deleted from iptables when the domain goes down.

Please correct me if I am wrong. I think there should be only one network script per config, (ex: vif-nat, vif-bridge, etc) and that script should determine whether the domain is a hvm or a modified one and make necessary configuration accordingly. This way there is no need for seperate scripts for qemu and vif and when a qemu domain shuts down, it's settings can be de-configured properly. Or as an alternative there should be two script for each config (ex. vif-nat-qemu + vif-nat-other) and but only one of them should be executed.

So the question is: What is the plan about implementing other types of network scripts in qemu domains? Is this discussed or planned? If not I want to make the necessary changes. I figured that tools/ioemu/vl.c is responsible for creating a hvm domain and execute the correct network script. But I could not figure out what piece of code is responsible for calling the network script with necessary parameters when a modified guest boots. Also are these changes that I propose are acceptable (or reasonable at least)? I would appreciate if you share your knowledge and ideas about this matter.

Thanks
Erdem