Hi My domU''s runs in each their VLAN. I''m revising my vif-vlan script. I''d like to switch away from the ip="xyz", netmask="abc", gateway="def" syntax in /etc/xen/blah and instead use the new vif=[''ip=1.2.3.4,etc''] syntax. I''m stumbling into a few shortcomings. There''s no netmask=abc, no gateway=abc, no broadcast=abc when using the new syntax. I''ll have to hardcode those depending on the IP. So be it. There''s also no apparent way to read out the ip=abc value when inside the domU - there''s nothing relevant in /proc/cmdline, under /proc/xen, or under /sys/devices/xen/vif-*. How do I read out the values on the vif=[...] line from within each domU? _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Martin Hierling wrote:> Are you willing to share your vif-vlan script?Sure.> prevents me from writing it all new because your script rocks.Hardly :-). Before I go out and gather the scripts, let me try and outline the concept. Some of the scripts are rather Gentoo-specific anyway, so if you''re just looking for inspiration, this might do it. In xend-config.sxp, I''ve got: ==========================(network-script network-manual) (vif-script ''vif-vlan'') ========================== "network-manual" does absolutely nothing, since I''ve set up the VLAN bridges etc. in dom0 using the tools that my distro (Gentoo) provides. Doing things this way prevents various breakage compared to letting the Xen scripts do it. The dom0 distro scripts sets up the VLAN bridges, basically by creating them and adding one VLAN interface from the trunk to each bridge. For example, xenbr200 is created for VLAN with id 200, and eth1.200 is added to that bridge. "vif-vlan" figures out which VLAN bridge a particular domU belongs too. I''ve started numbering the VLANs at 200, and I''m giving each domU a /29 subnet. Bridges are named after the VLAN id. So if a domU has an IP address of x.y.z.2, it belongs to "xenbr200". If it has x.y.z.10, it belongs to "xenbr208". vif-vlan takes care of adding the vifX.0 interface to the correct VLAN bridge. Inside each domU, I''ve modified the network init script to take just the IP address from the kernel command line (which in turn comes from the domU config file) and figure out which /29 subnet this is, what the broadcast address is, and what the default gateway (hardcoded to second IP in subnet, eg. x.y.z.1 for the first subnet) address is. And that''s basically it. I wired my firewall''s VLAN trunk interface to the Xen box''s VLAN trunk interface (eth1) too, of course. And I did a bit of preparatory work too, by creating a slew of VLAN interfaces in my firewall and create a slew of VLAN interfaces and bridges on the Xen box. Whenever I want to create a new domU, I just have to assign it an IP address within an unused VLAN, and the scripts take care of the rest on the Xen box. Then punch a few holes in the firewall, and we''re set. (If you still think the scripts would be useful, let me know.) _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Hello My domU''s runs in each their VLAN. I''m revising my vif-vlan script. I''d like to switch away from the ip="xyz", netmask="abc", gateway="def" syntax in /etc/xen/domU-config and instead use the new vif=[''ip=1.2.3.4,etc''] syntax. I''m stumbling into a few shortcomings. There''s no netmask=abc, no gateway=abc, no broadcast=abc when using the new syntax. I''ll have to hardcode those depending on the IP. So be it. A much harder problem to tackle is that there''s also no apparent way to read out the ip=abc value when inside the domU - there''s nothing relevant in /proc/cmdline, under /proc/xen, or under /sys/devices/xen/vif-*. So how do I read out the values on the vif=[...] line from within each domU? Hope you can help. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
On Fri, Jul 07, 2006 at 06:15:54PM +0200, Molle Bestefich wrote:> Hello > > My domU''s runs in each their VLAN. > I''m revising my vif-vlan script. > > I''d like to switch away from the ip="xyz", netmask="abc", > gateway="def" syntax in /etc/xen/domU-config and > instead use the new vif=[''ip=1.2.3.4,etc''] syntax. > > I''m stumbling into a few shortcomings. > > A much harder problem to tackle is that there''s also no apparent way to > read out the ip=abc value when inside the domU - there''s nothing relevant > in /proc/cmdline, under /proc/xen, or under /sys/devices/xen/vif-*. > > So how do I read out the values on the vif=[...] line from within each domU?The ip=, netmask=, gateway= parameters are munged together to make the kernel command line. The vif=[''ip=''] is different -- that parameter is used inside domain 0 to set up networking. The problem with using the kernel command line is that you can only set the IP parameters for the first interface in this way. That''s why we''re trying to move away from that -- you can only configure one interface like this. That doesn''t make it wrong to do so, if it suits you better. The vif parameters, as you''ve found out, are only available to domain 0 (in the hotplug scripts). The best way to get those parameters into the guest, if that''s what you need to do, is to run a DHCP server inside domain 0. That way, you can set up the guest''s networking, using your distro''s normal network scripts, setting it up for DHCP, and then intercept those DHCP requests in domain 0. The tools/examples/vif-nat script in the Xen tree does exactly that.> There''s no netmask=abc, no gateway=abc, no broadcast=abc when using > the new syntax. I''ll have to hardcode those depending on the IP. So > be it.I think that the vif-nat scripts use ip=1.2.3.4/24 rather than netmask/broadcast, and use the address of the interface in dom0 for the gateway. If you need more flexibility than this, feel free to submit a patch -- it sounds reasonable that the flexibility might be needed. Ewan. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel