There are two approaches you can take here:
- keep everything in the example.com zone file, or
- delegate dev.example.com to a separate name server.
Option 1 is simple: you keep everything in the same file, and there's no need to set up a second server. The disadvantage is that your production and development DNS settings are in the same file, which may not be what you want -- especially if you're as prone to typo'ing config files as I am!
If you go this route, your zone file should look something like this:
# example.com
# SOA, NS, etc.
@ IN A 77.123.45.67
dev IN A 77.765.43.21
dev2.dev IN CNAME dev
If you don't terminate a label with a dot character, the zone name is automatically appended.
Option 2 is a bit more complicated: you need to set up a second DNS server to host the dev.example.com domain. If you're trying to replicate a production environment, this could be what you want. It would look like this, assuming that your second nameserver lives on 1.2.3.4:
# example.com
# SOA, NS, etc.
@ IN A 77.123.45.67
dev IN NS 1.2.3.4
and for the other zone:
# dev.example.com
# SOA, NS, etc.
@ IN A 77.765.43.21
dev2 IN A 77.765.43.21
This delegates authority over the entire dev.example.com domain to nameserver 1.2.3.4, in the same manner that .com delegates example.com to your current nameserver.