Thursday, June 27, 2013

Nutanix Network Config -KVM

virsh # net-list
Name                 State      Autostart     Persistent
--------------------------------------------------
NTNX-Local-Network   active     yes           yes
VM-Network           active     yes           yes

virsh # net-dumpxml VM-Network
<network connections='6'>
  <name>VM-Network</name>
  <uuid>2869d684-71ba-a598-5c4c-bff4a1566282</uuid>
  <forward mode='bridge'/>
  <bridge name='br0' />
  <mac address='52:54:00:53:5C:E1'/>
  <virtualport type='openvswitch'/>
  <portgroup name='VM-Network' default='yes'>
  </portgroup>
</network>

virsh #  net-dumpxml NTNX-Local-Network
<network connections='1'>
  <name>NTNX-Local-Network</name>
  <uuid>74ee8a15-4400-05e5-4924-a4f073437b4d</uuid>
  <forward mode='bridge'/>
  <bridge name='brNutanix' />
  <mac address='52:54:00:F1:FB:26'/>
  <virtualport type='openvswitch'/>
  <portgroup name='svm-iscsi-pg' default='yes'>
  </portgroup>
</network>



virsh # net-info NTNX-Local-Network
Name            NTNX-Local-Network
UUID            74ee8a15-4400-05e5-4924-a4f073437b4d
Active:         yes
Persistent:     yes
Autostart:      yes
Bridge:         brNutanix

virsh # net-info VM-Network
Name            VM-Network
UUID            2869d684-71ba-a598-5c4c-bff4a1566282
Active:         yes
Persistent:     yes
Autostart:      yes
Bridge:         br0

[root@NTNX-12AM2K480036-A ~]# ifconfig br0
br0       Link encap:Ethernet  HWaddr 00:25:90:84:1D:21
          inet addr:10.3.200.19  Bcast:10.3.203.255  Mask:255.255.252.0
          inet6 addr: fe80::225:90ff:fe84:1d21/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:100441421 errors:0 dropped:0 overruns:0 frame:0
          TX packets:38563532 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:249788959789 (232.6 GiB)  TX bytes:153229990823 (142.7 GiB)

[root@NTNX-12AM2K480036-A ~]# cat  /etc/sysconfig/network-scripts/ifcfg-br0
DEVICE="br0"
NM_CONTROLLED="no"
ONBOOT="yes"
BOOTPROTO=none
IPADDR=10.3.200.19
NETMASK=255.255.252.0
GATEWAY=10.3.200.1


[root@NTNX-12AM2K480036-C ~]# virsh dominfo 1
Id:             1
Name:           NTNX-12AM2K480036-C-CVM
UUID:           7508fc1b-d7de-5331-102a-4a41832831ce
OS Type:        hvm
State:          running
CPU(s):         8
CPU time:       3814975.4s
Max memory:     12574720 KiB
Used memory:    12574720 KiB
Persistent:     yes
Autostart:      enable
Managed save:   no
Security model: selinux
Security DOI:   0
Security label: system_u:system_r:svirt_t:s0:c162,c801 (enforcing)


 ovs-vsctl show --- Bridge is Vswitch,  Port vnet is the individual vm ports., bond is NIC teaming.  N
bee10d10-c5f2-4ede-a7d0-2b219507ff3b
    Bridge "br0" ----- VM-Network
        Port "vnet5"
            Interface "vnet5"
        Port "vnet6"
            Interface "vnet6"
        Port "br0"
            Interface "br0"
                type: internal
        Port "vnet9"
            Interface "vnet9"
        Port "vnet10"
            Interface "vnet10"
        Port "vnet11"
            Interface "vnet11"
        Port "vnet4"
            Interface "vnet4"
        Port "vnet3"
            Interface "vnet3"
        Port "vnet7"
            Interface "vnet7"
        Port "vnet0"
            Interface "vnet0"
        Port "vnet8"
            Interface "vnet8"
        Port "bond-10g"
            Interface "eth2"
            Interface "eth3"
        Port "vnet2"
            Interface "vnet2"
    Bridge brNutanix -----------------Nutanix Vsiwtch with one port
        Port "vnet1"
            Interface "vnet1"
        Port brNutanix
            Interface brNutanix
                type: internal
    Bridge "br1"     ---
        Port "bond-1g"
            Interface "eth1"
            Interface "eth0"
        Port "br1"
            Interface "br1"
                type: internal
    ovs_version: "1.9.0"


ovs-appctl           ovsdb-tool           ovs-pki
ovs-benchmark        ovs-dpctl            ovs-tcpundump
ovs-brcompatd        ovs-ofctl            ovs-vlan-test
ovs-bugtool          ovs-parse-backtrace  ovs-vsctl
ovsdb-client         ovs-parse-leaks      ovs-vswitchd
ovsdb-server         ovs-pcap

Active/Passive
ovsdb-tool query

http://libvirt.org/formatnetwork.html


vswitch 1 br1 --- bond-1g --eth0,eth1 - we don' t use this
vswitch 2 br0 ---bond-10g --eth2 and eth3(not there in 24xx)
vswitch brNutanix - internal interface
ifconfig br0 and ifconfig eth2 has same mac address



[root@NTNX-12AM2K480036-B ~]# virsh net-dumpxml VM-VLAN60
<network>
  <name>VM-VLAN60</name>
  <uuid>afd477fe-6f2f-0b63-f83c-6bc3442684aa</uuid>
  <forward mode='bridge'/>
  <bridge name='br0' />
  <virtualport type='openvswitch'/>
  <portgroup name='VM-VLAN60' default='yes'>
    <vlan>
      <tag id='60'/>
    </vlan>
  </portgroup>
</network>


ovs-appctl bond/show bond-1g
---- bond-1g ----
bond_mode: active-backup
bond-hash-basis: 0
updelay: 0 ms
downdelay: 0 ms
lacp_status: off

slave eth0: enabled
        active slave
        may_enable: true

slave eth1: disabled
        may_enable: false

[root@NTNX-12AM2K480036-B ~]# ovs-appctl bond/list
bond    type    slaves
bond-1g active-backup   eth1, eth0

Add a additional management port

ovs-vsctl set port br1 tag=60
ifconfig br1



=====

Create two VMs and add them to same private vlan

virsh net-dumpxml VM-Network > /tmp/win20.net.xml

[root@NTNX-12AM2K480036-B ~]# cat /tmp/win20.net.xml
<network connections='10'>
  <name>Bridge-20</name>
  <forward mode='bridge'/>
  <bridge name='br20' />
  <virtualport type='openvswitch'/>
  <portgroup name='Bridge-20' default='yes'>
  </portgroup>
</network>

virsh net-define /tmp/win20.net.xml
virsh net-start Bridge-20

 [root@NTNX-12AM2K480036-B ~]# virsh net-list
Name                 State      Autostart     Persistent
--------------------------------------------------
Bridge-20            active     no            yes
NTNX-Local-Network   active     yes           yes
VM-Network           active     yes           yes
VM-VLAN60            active     no            yes

Edit the VM.Xml and change the (virsh edit <vm name> add additonal VM
virsh destory and start


http://openvswitch.org/pipermail/dev/2011-July/009993.html