Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


KVM/SolusVM - How to add IPs from eth1 to virtual machines?
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

KVM/SolusVM - How to add IPs from eth1 to virtual machines?

OttoYiuOttoYiu Member
edited March 2013 in Help

I have an internal network amongst my rack, say 10.0.0.0/24, that is accessible through eth1 on the host node. I want some virtual machines on the host node to have access to said network.

Does anyone know how I can accomplish this, in SolusVM or through any other means? It seems like I cannot specify which interface to use when I add an IP block in SolusVM.

Not sure if this affects the solution, but, I already have a virtual internal network (172.16.124.0/24) setup to allow virtual machines within the host node to communicate with each other. This means that each virtual machine have two virtual ethernet interfaces (eth0/eth1).

Thanks,

Comments

  • XFS_BrianXFS_Brian Member
    edited March 2013

    There is only one way that I know of that will work for this this. It is not an automated process as you will have to make changes to the virtual config files.

    Are you using KVM or XEN? If it is KVM, then I can tell you how to do this but if it is XEN, I won't be of much help as I have not messed with it as of yet.

    Just read you topic name. That answered my question. This will not be hard at all.

  • OttoYiuOttoYiu Member
    edited March 2013

    @XFS_Brian said: There is only one way that I know of that will work for this this. It is not an automated process as you will have to make changes to the virtual config files.

    That is fine, as this host node will only have one or two VMs that need access to the internal network. Can you please point me in the right direction?

    Thanks in advance! Appreciate it :)

  • I am working on the guide for you now. Should have it ready here soon.

  • Here is what you will need to do. Create a new bridge for this private network. This needs to be done the same way you did for the public network as posted at http://docs.solusvm.com/kvm_bridge_setup
    Just change the bridge name to something different then what the guide has listed. Also change eth0 to match what the private network interface is. Depending on the setup you may have, this could be eth1

    Make sure the virtual that you will be making the changes to is powered off.

    You will not be able to add this bridge to SolusVM as you are only allowed to have one public and private bridge. What you will need to do is make the change to the config file for the virtual that needs access to this network. Lets say you create the new bridge as privbr0. Take the config file for said virtual and add the following below the current interface assigned to the virtual.

    <interface type='bridge'>
     <model type='virtio' />
     <source bridge='intbr0'/>
     <target dev='kvm146.2'/>
     <mac address='00:00:00:00:00:00'/>
    </interface>
    

    Change model type to match the same as the public interface.
    Make sure you change the source bridge to the new bridge.
    Change the target dev to the virtual number followed by .2. The .2 will change for each new interface you add to the virtual. If you currently have a private IP assigned from the internal network, that one will show kvmxxx.2. This new interface will need to have .3 if that is the case.
    The mac address needs be changed as well. This has to be unique and different then what is currently in use on any other virtual. This site will be helpful for creating on for you http://www.miniwebtool.com/mac-address-generator/

    Once you have made the changes and saved them, be sure to click on the reboot button. This will recreate the config file with the changes to the host node.

    The next step is to sign into the VPS by RDP or SSH to add the new interface. When you add the interface, you will also need to specify the IP address that it will use form the 10.0.0.0/24 block.

    I hope this helps. Let me know if you have any questions or need help.

  • @XFS_Brian said: I hope this helps. Let me know if you have any questions or need help.

    It works! Thanks a lot for spending the time to write such a clear tutorial on how to do it.

    I do have a question out of curiosity though... what's stopping a VM from stealing an IP? how does SolusVM deal with IP delegation?

  • They use ebtables for this. At this time, it is bugged. I have found the bug and reported it to them. You can are more then welcome to use this by enabling it in SolusVM but you will need to restart the service each time a new IP is assigned. The includes when a new VPS is created.

  • The command to restart the ebtables services is

    service solusvm-ipsecure restart

  • @XFS_Brian said: They use ebtables for this. At this time, it is bugged. I have found the bug and reported it to them. You can are more then welcome to use this by enabling it in SolusVM but you will need to restart the service each time a new IP is assigned. The includes when a new VPS is created.

    I see - good to know. If I don't use ebtables, and specifically filter the IP based on the MAC address I generated above at the switch level, would that work? More specifically, will the switch actually see the generated MAC address or will the switch see the physical interface's MAC address? I'm still fairly new to Linux bridges, so sorry for asking such a stupid question.

  • If you are talking about the switch the host node is on, from my understanding, it will see the MAC that is assigned to the VM. I could be wrong about that. Filtering by the MAC should work. Have not tested it myself.

Sign In or Register to comment.