Configure VM to a static port in Open vSwitch

Issues related to applications and software problems
Post Reply
simon_lefisch
Posts: 51
Joined: 2017/07/12 21:02:02

Configure VM to a static port in Open vSwitch

Post by simon_lefisch » 2019/09/04 21:03:02

Hey everyone,

I finally got Open vSwitch (new to it so still learning) running on my machine and was wondering if anyone knows if you can configure a VM (running KVM) to use a specific port in Open vSwitch any time the VM is started. Any info anyone can provide would be quite helpful. TIA
Hardware:
Supermicro X10SRi-F mobo
E5-2620v4 CPU
58GB RAM
2x 250GB SSD RAID1 (OS)
2x 4TB HDD RAID 1 (Storage)

User avatar
jlehtone
Posts: 2383
Joined: 2007/12/11 08:17:33
Location: Finland

Re: Configure VM to a static port in Open vSwitch

Post by jlehtone » 2019/09/05 12:42:59

I've never seen OVS so I have to ask: what is a "specific port"?

simon_lefisch
Posts: 51
Joined: 2017/07/12 21:02:02

Re: Configure VM to a static port in Open vSwitch

Post by simon_lefisch » 2019/09/05 14:17:23

Well I'm still learning how OVS works, but from what I can tell it seems that a VM will take the first available vport on the switch. So VM1 is currently on vport3. If I end up having to reboot the KVM host and start VM1 again, it moves to vport1 this time. I'd like VM1 to assigned to vport3 every time the VM starts up. Again, I'm still learning how OVS works but this is from what I've seen just by experimenting so far. There's documentation on OVS but it doesn't seem mention being able to do what I'm looking for, so I was hoping someone on here with a little more experience might be able to help me out or point me in the direction.
Hardware:
Supermicro X10SRi-F mobo
E5-2620v4 CPU
58GB RAM
2x 250GB SSD RAID1 (OS)
2x 4TB HDD RAID 1 (Storage)

User avatar
jlehtone
Posts: 2383
Joined: 2007/12/11 08:17:33
Location: Finland

Re: Configure VM to a static port in Open vSwitch

Post by jlehtone » 2019/09/05 17:39:43

How do "vport1" and "vport3" differ in behaviour?

For comparison, take a cheap unmanaged physical switch. Does it matter to which port you plug your cable to? No.

Things are different with a managed switch, where some ports are in different vlan than the other ports. Plugging cable carelessly will connect your machine to wrong lan, wrong subnet.

Therefore, if you have defined multiple vlans on your OVS, then it makes sense to connect VM predictably.

http://docs.openvswitch.org/en/latest/howto/kvm/
Shows that you give KVM a custom script that in the example runs:

Code: Select all

ovs-vsctl add-port br0 tap0
http://docs.openvswitch.org/en/latest/howto/vlan/
Shows how to define the vlan of a port:

Code: Select all

ovs-vsctl add-port br0 tap0 tag=100
Logically, augmenting the ovs-ifup script(s) should solve the "issue".

simon_lefisch
Posts: 51
Joined: 2017/07/12 21:02:02

Re: Configure VM to a static port in Open vSwitch

Post by simon_lefisch » 2019/09/05 20:57:42

Well, they don't differ. However I would thing that it would be good to set a static port per VM for management purposes. If there is something going on with one of the VMs, knowing which "vport" the VM is attached to would be easier find to troubleshoot (since I document everything on my network)....but maybe I'm wrong ¯\_(ツ)_/¯ Thanks for the info tho, I'll give it a read when I get home from work.
Hardware:
Supermicro X10SRi-F mobo
E5-2620v4 CPU
58GB RAM
2x 250GB SSD RAID1 (OS)
2x 4TB HDD RAID 1 (Storage)

Post Reply

Return to “CentOS 7 - Software Support”