Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

post/2019-12-19-ovn-and-dhcp/ #8

Open
utterances-bot opened this issue Jan 6, 2020 · 5 comments
Open

post/2019-12-19-ovn-and-dhcp/ #8

utterances-bot opened this issue Jan 6, 2020 · 5 comments

Comments

@utterances-bot
Copy link

@utterances-bot utterances-bot commented Jan 6, 2020

OVN and DHCP: A minimal example · The Odd Bit

Introduction A long time ago, I wrote an article all about OpenStack Neutron (which at that time was called Quantum). That served as an excellent reference for a number of years, but if you've deployed a recent version of OpenStack you may have noticed that the network architecture looks completely different. The network namespaces previously used to implement routers and dhcp servers are gone (along with iptables rules and other features), and have been replaced by OVN (“Open Virtual Network”).

https://blog.oddbit.com/post/2019-12-19-ovn-and-dhcp/

This comment has been minimized.

Copy link

@flavio-fernandes flavio-fernandes commented Jan 6, 2020 — with utterances

Nice post! On the subject of doc/info, it got removed from Openvswitch site when OVN split into its own repo. You can get to the OVN doc in github, but we will eventually have a dedicated page for under ovn.org.

This comment has been minimized.

Copy link
Owner

@larsks larsks commented Jan 6, 2020 — with utterances

It would be great to have that hosted somewhere more discoverable :).

This comment has been minimized.

Copy link

@flavio-fernandes flavio-fernandes commented Jan 10, 2020 — with utterances

I would like to offer a small contribution for folks interested in trying
the steps described by this great page: a Vagrantfile

If that interests you, see:
https://gist.github.com/flavio-fernandes/862747708512c1967c7b412f500fb56d

And a couple of comments to make this page even more awesome:

I'm not sure about the difference between the ovs version you used the one
I used, but I think that 'ovn-remote' should include the protocol and port.
In other words:

central='192.168.122.100' && \
ovs-vsctl set open . external-ids:ovn-remote=tcp:${central}:6642

I think the way you used the command 'ovn-nbctl dhcp-options-create' is not doing
what we need. For this particular command, all the parameters provided after the cidr
are stored as external_ids and these are not used in the dhcp offer. They should be
part of the options column. In summary, I think this is what you may need to do:

ovn-nbctl dhcp-options-create 10.0.0.0/24

CIDR_UUID=$(ovn-nbctl --bare --columns=_uuid find dhcp_options cidr="10.0.0.0/24")

ovn-nbctl dhcp-options-set-options ${CIDR_UUID} \
  lease_time=3600 \
  router=10.0.0.1 \
  server_id=10.0.0.1 \
  server_mac=c0:ff:ee:00:00:01

ovn-nbctl list dhcp_options command should list the options under 'options' and not 'external_ids'.

As you do below, you can instead set it straight into the NB db with the command
'ovn-nbctl create dhcp_options'.

I am a bit of a lazy typer, so I used that command to grab the uuid of the row dhcp_options.
I wonder if you would find it interesting to tweak that part of this page to make it easier to
follow. Just a suggestion:

ovn-nbctl lsp-set-dhcpv4-options port1 ${CIDR_UUID}

I see a tiny little discrepancy on the mac you gave to port1 in your page. I think you
meant to use c0:ff:ee:00:00:11 instead of c0:ff:ee:00:00:10, right?

ovn-nbctl lsp-set-addresses port1 "c0:ff:ee:00:00:10 dynamic"   ; # maybe c0:ff:ee:00:00:11 ?

Another nit: There is no 's' in the logical_switch_ports table. So the command should be

ovn-nbctl list logical_switch_port

Lastly, since vm has eth0 reserved for mgmt access, the command to configure the
ovn-encap-ip needed a small tweak on my Vagrant based vm cluster:

ETH_DEV=$(ip route get 192.168.122.0 | grep -oP "(?<= dev )[^ ]+")

ovs-vsctl set open-vswitch .  \
   external_ids:ovn-encap-ip=$(ip addr show $ETH_DEV | awk '$1 == "inet" {print $2}' | cut -f1 -d/)

Best!

-- flaviof

@larsks

This comment has been minimized.

Copy link
Owner

@larsks larsks commented Jan 10, 2020

Flavio,

Thanks for the comments!

I'm not sure about the difference between the ovs version you used the one I used, but I think that 'ovn-remote' should include the protocol and port.

Yeah, good catch; that was just a typo. My running environment actually has the protocol and port.

I think the way you used the command 'ovn-nbctl dhcp-options-create' is not doing
what we need.

Ugh. A dhcp-options-create command that doesn't actually let you set options seems sadistic.

I actually used the ovn-nbctl create ... command when I set up my environment, but I was looking for a simpler mechanism, since the quoting requirements for the database commands can sometimes verge on the ridiculous.

I've updated the post to just use what you suggested.

I think you meant to use c0:ff:ee:00:00:11 instead of c0:ff:ee:00:00:10, right?
Another nit: There is no 's' in the logical_switch_ports table.

Yeah, I've fixed those, too.


Thanks for taking a look and correcting things!

This comment has been minimized.

Copy link

@flavio-fernandes flavio-fernandes commented Jan 16, 2020 — with utterances

Sorry, me again. :^) I came across a good read on how OVN implements the DHCP functionality and thought of sharing it here: https://blogs.rdoproject.org/2016/08/native-dhcp-support-in-ovn/ Enjoy!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.