[Openstack] DHCP for host connected through a bridge (i.e. for a port 1 hop away)

Don Waterloo don.waterloo at gmail.com
Fri Aug 1 01:25:01 UTC 2014


This is icehouse on ubuntu 14.04, using nova, neutron, ml2, ovs,
vxlan, dhcp-agent, l3-agent.

I have a network topology where I have a host connected via a L2 network
(no subnet allocated) to a transparent bridge which in turn connects to a
network with a subnet assigned, and a DHCP agent (and a L3 agent connection
to my external router).

If I manually assign an IP to this host, all is good, it can reach the
world.

However, DHCP doesn't work (because the dhcp-agent doesn't see that i'm
connected). The 'data_int_net' has a subnet allocated, dhcp enabled. The
bridge 'br' is transparent, so it doesn't do DHCP or modify packets.

As an experiment (commented out), i set the MAC to be the same on the two
ports. Interestingly, this did work, but then my bridge was a little sad,
so I stopped the experiment.

If i manually add the mac to the dnsmasq in the namespace, it also works.



So my question... How can i add a mac address from a port to a DHCP agent?
In an automated fashion.


In this snippet from my Heat template, you can see what I am doing.

heat_template_version: 2013-05-23

description: >

resources:
  key:
    type: OS::Nova::KeyPair
    properties:
      name: key
      save_private_key: True

  sg:
    type: OS::Neutron::SecurityGroup
    properties:
     description: "wide open"
     rules: [
       { port_range_min: 0, port_range_max: 65535, remote_ip_prefix:
0.0.0.0/0, protocol: tcp },
       { port_range_min: 0, port_range_max: 65535, remote_ip_prefix:
0.0.0.0/0, protocol: udp },
       { remote_ip_prefix: 0.0.0.0/0, protocol: icmp } ]

  router:
    type: OS::Neutron::Router
    properties:
      admin_state_up: true
      name: rtr

  router_gw:
    type: OS::Neutron::RouterGateway
    properties:
      network_id: 0f694eb2-6e78-4e25-96dd-aeb9a1446203
      router_id: { get_resource: router }

  control_net:
    type: OS::Neutron::Net
    properties:
      name: control

  control_subnet:
    type: OS::Neutron::Subnet
    properties:
      name: control_subnet
      enable_dhcp: True
      network_id: { get_resource: control_net }
      cidr: 172.16.5/24
      allocation_pools:
        - start: 172.16.5.10
          end: 172.16.5.100

  router_i0:
    type: OS::Neutron::RouterInterface
    properties:
      router_id: { get_resource: router }
      subnet_id: { get_resource: control_subnet }

  data_sub_net:
    type: OS::Neutron::Net
    properties:
      name: br-sub

  data_int_net:
    type: OS::Neutron::Net
    properties:
      name: br-int


  data_int_subnet:
    type: OS::Neutron::Subnet
    properties:
      name: br-int-subnet
      enable_dhcp: True
      network_id: { get_resource: data_int_net }
      cidr: 172.16.6/24
      allocation_pools:
        - start: 172.16.6.10
          end: 172.16.6.100

  router_i1:
    type: OS::Neutron::RouterInterface
    properties:
      router_id: { get_resource: router }
      subnet_id: { get_resource: data_int_subnet }

  br_int_port:
    type: OS::Neutron::Port
    properties:
      name: br-int
      allowed_address_pairs: [{ "mac_address": { get_attr: [
win7_sub_port, mac_address] }, "ip_address": "0.0.0.0/0"  }]
      security_groups: []
      network_id: { get_resource: data_int_net }
      #mac_address: "00:00:00:01:02:03"

  br_sub_port:
    type: OS::Neutron::Port
    properties:
      name: br-sub
      allowed_address_pairs: [{ "mac_address": { get_attr: [
win7_sub_port, mac_address] }, "ip_address": "0.0.0.0/0"  }]
      security_groups: []
      network_id: { get_resource: data_sub_net }

  br:
    type: OS::Nova::Server
    properties:
      name: br
      key_name: { get_resource: key }
      image: "br"
      flavor: "m1.small"
      networks:
        - network: { get_resource: control_net }
        - port: { get_resource: br_sub_port }
        - port: { get_resource: br_int_port }

  win7_sub_port:
    type: OS::Neutron::Port
    properties:
      name: win7-sub
      network_id: { get_resource: data_sub_net }
      #mac_address: "00:00:00:01:02:03"

  win7:
    type: OS::Nova::Server
    properties:
      name: win7
      image: "win7"
      flavor: "m1.small"
      networks:
        - port: { get_resource: win7_sub_port }

outputs:




More information about the Openstack mailing list