Your registrar should also offer somewhere in the control panel the ability to create "glue records". Glue records are records that are submitted to the TLD's registry. The question Mr Shunz linked to in the comments has a great answer on explaining exactly how DNS works and why this is required, so I won't go into any detail here, but it boils down to the following:
- Create an A record for
ns1.example.com
pointing at the IP address you need it to. You'll need to do the same for ns2.example.com
as there's a minimum requirement of 2 nameservers per domain name.*
- Create the same glue records using your registrar's tools
Obviously I can't tell you how you might go about that as you've not told us what registrar you're using, but a simple Google search for " glue records" should start to point you in the right direction. Or ask your registrar's customer support team if you still can't find it.
Now to my asterisk...
You don't have to point your 2 ns
records at different servers, but be aware that if you do point them at the same server and that server goes offline, your entire domain goes offline with it. And as NXDOMAIN responses can get cached at upstream providers, it might take a while to show up again when the DNS service on your server comes back online. This is why there's a minimum requirement of 2, to provide a "backup", in case one of the nameservers goes offline, you don't run the risk of having "no idea what domain name you're talking about" responses being sent to your users.