[ovs-discuss] libvirt and openvswitch

Ansis Atteka aatteka at nicira.com
Thu Jan 22 18:24:40 UTC 2015


On Thu, Jan 22, 2015 at 2:41 AM, Yaron Illouz <yaroni at radcom.com> wrote:
> Hi
>
>
>
> I am trying to create an openvswitch using libvirt and to use a virtual
> network – I mean not the physical one my computer is connected to.
>
> I want the vm to receive  an ip in the range .168.100.2,192.168.100.220
>
> Is it possible to do that?
Yes, you just need a DHCP server running on Hypervisor. I would
suggest to use libvirt DHCP feature so that you don't have to manually
start dnsmasq daemon - https://libvirt.org/formatnetwork.html. Anyway
if you still want to manually run DHCP server then keep reading my
answers below.

>
>
>
> I think it doesn't work because of the dhcp not working
Since DHCP server introduces extra layer of complexity, then have you
tried to statically assign IP address to the VM and see if regular
ping goes through? This would rule out any OVS related issues.

>
>
>
> I defined a network
>
>
>
>     <network>
>
>       <name>private</name>
>
>       <bridge name='virbr0'/>
>
>               <forward mode='bridge'/>
>
>       <virtualport type='openvswitch'/>
>
>     </network>
>
>
>
> I defined an ip address to virbr0
>
> ip addr add 192.168.100.2 dev virbr0
What subnet mask you want to assign to the virbr0? If you don't
specify one, then ip-addr uses /32. That is not what you want. See
"man ip-addr" for more details.


>
> ip link set virbr0 up
>
>
>
> I tried to launch a process to enable a dhcp
>
> /usr/sbin/dnsmasq --strict-order --bind-interfaces --interface=eth2
> --listen-address 192.168.100.1 --dhcp-range 192.168.100.2,192.168.100.220
> --dhcp-lease-max=101 --dhcp-no-override

You assigned 192.168.100.2 to virbr0, but here you are telling dnsmasq
to listen on 192.168.100.1 and eth2. Which one of those two IP
addresses you want your DHCP server to use then? Did you intend to
assign 192.168.100.1/24 to virbr0 instead?

Also, "--interface eth2' would make you to run DHCP server on physical
network. This most likely is not what you want.

See "man dsnamsq" for more details on how to configure dnsmasq.


>
> But it didn't help
>
>
>
> But get no ip for the ovs port when I launch the instance.
Assuming that below you ran tcpdump on Hypervisor it seems that
Virtual machine sent DHCP request, but DHCP server did not respond
because most likely your DHCP server is not configured properly.

>
>
>
>     ci-info: +++++++++++++++++++++++++Net device
> info++++++++++++++++++++++++++
>
>     ci-info:
> +--------+------+--------------+-------------+-------------------+
>
>     ci-info: | Device |  Up  |   Address    |     Mask    |     Hw-Address
> |
>
>     ci-info:
> +--------+------+--------------+-------------+-------------------+
>
>     ci-info: |   lo   | True |  127.0.0.1   |  255.0.0.0  |         .
> |
>
>     ci-info: |  eth1  | True |      .       |      .      |
> 52:54:00:24:16:29 |
>
>     ci-info: |  eth0  | True | 172.16.5.136 | 255.255.0.0 |
> 52:54:00:44:01:28 |
>
>
>
>
>
> In the bridge port vnet1 get assigned to virbr0
>
>
>
>     Bridge "virbr0"
>
>         Port "virbr0"
>
>             Interface "virbr0"
>
>                 type: internal
>
>         Port "vnet1"
>
>             Interface "vnet1"
>
>
>
> I also tried to add-port a real interface to virbr0, but it made no change.
> No cable is connected to this  interface.
>
>
>
> And i launch the instance the following way
>
>
>
>      virt-install --name probe9 --ram 4096 --vcpus=4 --check-cpu
> --os-type=linux --import --disk /data/KVM/Probe2-cloud3.qcow2,format=qcow2
> --network network=ext  --network network=private --graphics
> vnc,listen=0.0.0.0 --noautoconsole --disk
> vol=default/configuration2.iso,bus=virtio
>
>
>
>
>
> I did a tcpdump of vnet1 and it look like
>
>
>
> 05:14:27.843753 IP (tos 0x10, ttl 128, id 0, offset 0, flags [none], proto
> UDP (17), length 332)
>
>     0.0.0.0.bootpc > 255.255.255.255.bootps: [udp sum ok] BOOTP/DHCP,
> Request from 52:54:00:3f:08:13 (oui Unknown), length 304, xid 0x4726ff0c,
> secs 7, Flags [none] (0x0000)
>
>           Client-Ethernet-Address 52:54:00:3f:08:13 (oui Unknown)
>
>           Vendor-rfc1048 Extensions
>
>             Magic Cookie 0x63825363
>
>             DHCP-Message Option 53, length 1: Discover
>
>             Parameter-Request Option 55, length 13:
>
>               Subnet-Mask, BR, Time-Zone, Classless-Static-Route
>
>               Domain-Name, Domain-Name-Server, Hostname, YD
>
>               YS, NTP, MTU, Option 119
>
>               Default-Gateway
>
>             Vendor-Class Option 60, length 43: "anaconda-Linux
> 2.6.32-431.el6.x86_64 x86_64"
>
> 05:14:27.931015 IP6 (hlim 1, next-header Options (0) payload length: 36)
> fe80::5054:ff:fe3f:813 > ff02::16: HBH (rtalert: 0x0000) (padn)[icmp6 sum
> ok] ICMP6, multicast listener report v2, length 28, 1 group record(s) [gaddr
> ff02::1:ff3f:813 to_ex { }]
>
> 05:14:30.963975 IP6 (hlim 255, next-header ICMPv6 (58) payload length: 16)
> fe80::5054:ff:fe3f:813 > ff02::2: [icmp6 sum ok] ICMP6, router solicitation,
> length 16
>
>           source link-address option (1), length 8 (1): 52:54:00:3f:08:13
>
>             0x0000:  5254 003f 0813
>
> 05:14:40.850652 IP (tos 0x10, ttl 128, id 0, offset 0, flags [none], proto
> UDP (17), length 332)
>
>     0.0.0.0.bootpc > 255.255.255.255.bootps: [udp sum ok] BOOTP/DHCP,
> Request from 52:54:00:3f:08:13 (oui Unknown), length 304, xid 0x4726ff0c,
> secs 20, Flags [none] (0x0000)
>
>           Client-Ethernet-Address 52:54:00:3f:08:13 (oui Unknown)
>
>           Vendor-rfc1048 Extensions
>
>             Magic Cookie 0x63825363
>
>             DHCP-Message Option 53, length 1: Discover
>
>             Parameter-Request Option 55, length 13:
>
>               Subnet-Mask, BR, Time-Zone, Classless-Static-Route
>
>               Domain-Name, Domain-Name-Server, Hostname, YD
>
>               YS, NTP, MTU, Option 119
>
>               Default-Gateway
>
>             Vendor-Class Option 60, length 43: "anaconda-Linux
> 2.6.32-431.el6.x86_64 x86_64"
>
> 05:14:54.851632 IP (tos 0x10, ttl 128, id 0, offset 0, flags [none], proto
> UDP (17), length 332)
>
>     0.0.0.0.bootpc > 255.255.255.255.bootps: [udp sum ok] BOOTP/DHCP,
> Request from 52:54:00:3f:08:13 (oui Unknown), length 304, xid 0x4726ff0c,
> secs 34, Flags [none] (0x0000)
>
>           Client-Ethernet-Address 52:54:00:3f:08:13 (oui Unknown)
>
>           Vendor-rfc1048 Extensions
>
>             Magic Cookie 0x63825363
>
>             DHCP-Message Option 53, length 1: Discover
>
>             Parameter-Request Option 55, length 13:
>
>               Subnet-Mask, BR, Time-Zone, Classless-Static-Route
>
>               Domain-Name, Domain-Name-Server, Hostname, YD
>
>               YS, NTP, MTU, Option 119
>
>               Default-Gateway
>
>             Vendor-Class Option 60
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> _______________________________________________
> discuss mailing list
> discuss at openvswitch.org
> http://openvswitch.org/mailman/listinfo/discuss
>



More information about the discuss mailing list