[ovs-discuss] DNS support in OVN

Numan Siddique numans at ovn.org
Fri May 29 07:04:30 UTC 2020


Hi,

It works for me. Please below few comments.


On Fri, May 29, 2020 at 4:45 AM John Lang <john.x.lang at oracle.com> wrote:

> I’m trying to setup a OVN to experiment with the DNS support that is
> include.  I created a Logical Switch and a DNS record using “ovn-nbctl
> create DNS records” to create some mappings.  I pointed the Logical Switch
> field dns_records to the DNS records.  But when I tried to do nslookup or
> dig commands through the ports I created on the logical switch, I get no
> response.  I know my Switch is working, because I can ping between the 2
> ports I created.  Is there some other setup in ovn-nb or ovn-sb that needs
> to be setup for ovs to respond to DNS requests?  What IP address in in the
> switch should I be sending the DNS requests to.  My subnet is
> 192.168.50.0/24 and I’ve tried using dig to send requests to
> 192.168.50.1.  I’ve tried some other random IP addresses in the subnet, but
>  haven’t found the right one.
>
>
>
> These are the commands I used to setup my network:
>
>
>
> ovn-nbctl ls-add network1
>
> ovn-nbctl lsp-add network1 vm1
>
> ovn-nbctl lsp-add network1 vm2
>
> ovn-nbctl lsp-set-addresses vm1 "40:44:00:00:00:01 192.168.50.21"
>
> ovn-nbctl lsp-set-addresses vm2 "40:44:00:00:00:02 192.168.50.22"
>
> ovs-vsctl add-port br-int vm1 -- set Interface vm1 type=internal -- set
> Interface vm1 external_ids:iface-id=vm1
>
> ovs-vsctl add-port br-int vm2 -- set Interface vm2 type=internal -- set
> Interface vm2 external_ids:iface-id=vm2
>
> ip netns add vm1
>
> ip link set vm1 netns vm1
>
> ip netns exec vm1 ip link set vm1 address 40:44:00:00:00:01
>
> ip netns exec vm1 ip addr add 192.168.50.21/24 dev vm1
>
> ip netns exec vm1 ip link set vm1 up
>
> ip netns add vm2
>
> ip link set vm2 netns vm2
>
> ip netns exec vm2 ip link set vm2 address 40:44:00:00:00:02
>
> ip netns exec vm2 ip addr add 192.168.50.22/24 dev vm2
>
> ip netns exec vm2 ip link set vm2 up
>
>
>
> Ping then works:
>
>
>
> ip netns exec vm2 ping -c2 192.168.50.21
>
> ip netns exec vm1 ping -c2 192.168.50.22
>
>
>
> Create DNS record:
>
>
>
> ovn-nbctl show
>
> switch d780c1e6-8879-4694-aae3-5cf7eb88e55d (network1)
>
>     port vm2
>
>         addresses: ["40:44:00:00:00:02 192.168.50.22"]
>
>     port vm1
>
>         addresses: ["40:44:00:00:00:01 192.168.50.21"]
>
>
>
> ovn-nbctl create DNS records={vm1.vcn1.myvcn.com="192.168.50.21",
> vm2.vcn1.myvcn.com="192.168.50.22"}
>
> ovn-nbctl list DNS
>
> _uuid               : 8b39857f-1b22-4e66-89d0-5f75f972534c
>
> ovn-nbctl set Logical_Switch d780c1e6-8879-4694-aae3-5cf7eb88e55d
> dns_records=8b39857f-1b22-4e66-89d0-5f75f972534c
>

If you run "ovn-nbctl list DNS" you will notice that there will be no
record for vm1.vcn1.myvcn.com as the records is overwritten.

You can re add it like
ovn-nbctl set DNS  8b39857f-1b22-4e66-89d0-5f75f972534c records:"
vm1.vcn1.myvcn.com"="192.168.50.21"

records is an smap (like a dictionary)


>
> ip netns exec vm1 nslookup vm1
>
> ;; connection timed out; no servers could be reached
>
>
>

Is your network network1 connected to a logical router ?

If so you can try as -  ip netns exec vm1 dig @<logical_router_ip>
vm1.vcn1.myvcn.com

In my case I did like below and it worked

****
[root at ovn-chassis-1 /]# ip netns exec sw0p3 dig @10.0.0.1 vm1.vcn1.myvcn.com
;; Warning: Message parser reports malformed message packet.

; <<>> DiG 9.11.14-RedHat-9.11.14-2.fc31 <<>> @10.0.0.1 vm1.vcn1.myvcn.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 14323
;; flags: qr rd ad; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; WARNING: recursion requested but not available

;; QUESTION SECTION:
;vm1.vcn1.myvcn.com. IN A

;; ANSWER SECTION:
. 0 CLASS4096 OPT 10 8 nCoALfVWeo0=

;; ADDITIONAL SECTION:
vm1.vcn1.myvcn.com. 3600 IN A 10.0.0.3

;; Query time: 0 msec
;; SERVER: 10.0.0.1#53(10.0.0.1)
;; WHEN: Fri May 29 06:58:17 UTC 2020
;; MSG SIZE  rcvd: 93
*****

nslookup also worked for me.

Note that passing just hostname will not work with OVN. You need to pass
the full FQDN.
If you want "vm1" to be answered, then you need to add an entry for that

like
ovn-nbctl set DNS  8b39857f-1b22-4e66-89d0-5f75f972534c
records:"vm1"="192.168.50.21"

Hope this works.

Thanks
Numan


ip netns exec vm1 dig @192.168.50.1
>
> ; <<>> DiG 9.11.4-P2-RedHat-9.11.4-9.P2.el7 <<>> @192.168.50.1
>
> ; (1 server found)
>
> ;; global options: +cmd
>
> ;; connection timed out; no servers could be reached
>
>
>
>
>
> John Lang
>
> w (303) 272-5457
>
> c (970) 231-3724
>
>
> _______________________________________________
> discuss mailing list
> discuss at openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openvswitch.org/pipermail/ovs-discuss/attachments/20200529/b7709658/attachment.html>


More information about the discuss mailing list