vercel-dns
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseWhat I Do
功能介绍
Manage DNS records for domains hosted on Vercel, including:
- List existing DNS records
- Add new DNS records (A, AAAA, CNAME, TXT, MX, etc.)
- Remove DNS records
- Switch between Vercel teams/accounts
管理托管在Vercel上的域名的DNS记录,包括:
- 列出现有DNS记录
- 添加新的DNS记录(A、AAAA、CNAME、TXT、MX等)
- 删除DNS记录
- 在Vercel团队/账户间切换
Prerequisites
前置条件
- Vercel CLI installed: or
npm i -g vercelbrew install vercel-cli - Logged in:
vercel login - Domain must be on Vercel nameservers or have Vercel as DNS provider
- 已安装Vercel CLI:或
npm i -g vercelbrew install vercel-cli - 已登录:
vercel login - 域名必须使用Vercel域名服务器,或已将Vercel设为DNS服务商
0 Finance Project
0 Finance项目
For the 0 Finance project, always use :
--scope prologebash
vercel dns ls 0.finance --scope prologe
vercel logs www.0.finance --scope prologe针对0 Finance项目,请始终使用参数:
--scope prologebash
vercel dns ls 0.finance --scope prologe
vercel logs www.0.finance --scope prologeCommon Commands
常用命令
Check Login & Team
检查登录状态与团队
bash
undefinedbash
undefinedCheck who you're logged in as
检查当前登录账户
vercel whoami
vercel whoami
List available teams
列出可用团队
vercel teams ls
vercel teams ls
Switch to a specific team (use slug, not display name)
切换到指定团队(使用团队slug,而非显示名称)
vercel switch <team-slug>
vercel switch <team-slug>
Or use --scope flag instead of switching
或使用--scope参数替代切换操作
vercel domains ls --scope prologe
undefinedvercel domains ls --scope prologe
undefinedList Domains & Records
列出域名与记录
bash
undefinedbash
undefinedList all domains in current team/account
列出当前团队/账户下的所有域名
vercel domains ls --scope prologe
vercel domains ls --scope prologe
List DNS records for a specific domain
列出指定域名的DNS记录
vercel dns ls <domain> --scope prologe
undefinedvercel dns ls <domain> --scope prologe
undefinedAdd DNS Records
添加DNS记录
bash
undefinedbash
undefinedAdd A record
添加A记录
vercel dns add <domain> <subdomain> A <ip-address>
vercel dns add <domain> <subdomain> A <ip-address>
Add CNAME record
添加CNAME记录
vercel dns add <domain> <subdomain> CNAME <target>
vercel dns add <domain> <subdomain> CNAME <target>
Add TXT record (use quotes for values with special chars)
添加TXT记录(值包含特殊字符时请使用引号)
vercel dns add <domain> <subdomain> TXT '<value>'
vercel dns add <domain> <subdomain> TXT '<value>'
Add MX record with priority
添加带优先级的MX记录
NOTE: MX priority is a separate argument (not embedded in the value)
注意:MX优先级是单独的参数(不嵌入值中)
vercel dns add <domain> <subdomain> MX <mail-server> <priority>
vercel dns add <domain> <subdomain> MX <mail-server> <priority>
Add record at apex (root domain) - use empty string or @
添加 apex/根域名记录 - 使用空字符串''或@作为子域名
vercel dns add <domain> '' TXT '<value>'
vercel dns add <domain> @ MX mail.example.com 10
undefinedvercel dns add <domain> '' TXT '<value>'
vercel dns add <domain> @ MX mail.example.com 10
undefinedRemove DNS Records
删除DNS记录
bash
undefinedbash
undefinedFirst list to get record ID
先列出记录以获取记录ID
vercel dns ls <domain>
vercel dns ls <domain>
Remove by record ID
通过记录ID删除记录
vercel dns rm <record-id>
vercel dns rm <record-id>
Remove with confirmation skip
跳过确认直接删除
vercel dns rm <record-id> --yes
undefinedvercel dns rm <record-id> --yes
undefinedExamples
示例
Add Email DNS Records (MX + SPF)
添加邮件DNS记录(MX + SPF)
bash
undefinedbash
undefinedAdd MX record for receiving email
添加用于接收邮件的MX记录
WARNING: Setting MX at the apex (root) will route all inbound mail for the domain.
警告:在apex/根域名设置MX记录会将该域名的所有入站邮件路由到指定服务器。
If the domain already uses Google Workspace / Fastmail / etc, prefer a dedicated subdomain.
如果该域名已使用Google Workspace / Fastmail等服务,建议使用专用子域名。
vercel dns add example.com '' MX inbound-smtp.us-east-1.amazonaws.com 10
vercel dns add example.com '' MX inbound-smtp.us-east-1.amazonaws.com 10
Safer: use a subdomain for inbound routing
更安全的方式:使用子域名进行入站路由
vercel dns add example.com inbound MX inbound-smtp.us-east-1.amazonaws.com 10
vercel dns add example.com inbound MX inbound-smtp.us-east-1.amazonaws.com 10
Add SPF record
添加SPF记录
vercel dns add example.com '' TXT 'v=spf1 include:amazonses.com ~all'
undefinedvercel dns add example.com '' TXT 'v=spf1 include:amazonses.com ~all'
undefinedAdd DKIM Records for Email Authentication
添加用于邮件认证的DKIM记录
bash
undefinedbash
undefinedDKIM CNAME records (common for SES, Google Workspace, etc.)
DKIM CNAME记录(常见于SES、Google Workspace等服务)
vercel dns add example.com selector._domainkey CNAME selector.dkim.provider.com
undefinedvercel dns add example.com selector._domainkey CNAME selector.dkim.provider.com
undefinedAdd Domain Verification TXT Record
添加域名验证TXT记录
bash
undefinedbash
undefinedGoogle/AWS/other service verification
Google/AWS/其他服务的验证
vercel dns add example.com _amazonses TXT 'verification-token-here'
vercel dns add example.com '' TXT 'google-site-verification=token'
undefinedvercel dns add example.com _amazonses TXT 'verification-token-here'
vercel dns add example.com '' TXT 'google-site-verification=token'
undefinedSubdomain Setup
子域名配置
bash
undefinedbash
undefinedPoint subdomain to a service
将子域名指向某服务
vercel dns add example.com api CNAME api.service.com
vercel dns add example.com app A 192.0.2.1
undefinedvercel dns add example.com api CNAME api.service.com
vercel dns add example.com app A 192.0.2.1
undefinedTroubleshooting
问题排查
"You don't have permission to list the domain record"
“您没有权限列出域名记录”
The domain is in a different team. List teams and switch:
bash
vercel teams ls
vercel switch <correct-team-slug>该域名属于另一个团队。请列出所有团队并切换:
bash
vercel teams ls
vercel switch <correct-team-slug>Domain Not Listed
域名未显示
- Domain might be in a different team/account
- Domain might not have Vercel as nameservers
- Check with
vercel domains ls
- 域名可能属于其他团队/账户
- 域名可能未使用Vercel作为域名服务器
- 使用命令检查
vercel domains ls
Record Not Propagating
记录未生效
- DNS propagation can take up to 48 hours (usually 5-30 minutes)
- Check propagation: or use dnschecker.org
dig +short <record-name> <record-type> - Verify record was added:
vercel dns ls <domain>
- DNS生效可能需要长达48小时(通常为5-30分钟)
- 检查生效状态:或使用dnschecker.org
dig +short <record-name> <record-type> - 验证记录是否已添加:
vercel dns ls <domain>
Token Saving Tips
令牌保存技巧
Fast Verification With dig
dig使用dig
快速验证
digWhen a third-party UI says "Looking for DNS records", verify what the public internet sees:
bash
dig +short TXT resend._domainkey.example.com
dig +short TXT send.example.com
dig +short MX send.example.com
dig +short TXT example.com当第三方界面显示“正在查找DNS记录”时,验证公网环境下的记录状态:
bash
dig +short TXT resend._domainkey.example.com
dig +short TXT send.example.com
dig +short MX send.example.com
dig +short TXT example.comTips
注意事项
- Always check which team you're in before making changes
- Use single quotes around TXT values to preserve special characters
- For apex/root domain records, use empty string as subdomain
'' - Record IDs are shown in output - needed for removal
vercel dns ls - Some records (like those added by Vercel automatically) cannot be removed
- 进行更改前,请务必检查当前所在团队
- TXT值请使用单引号包裹,以保留特殊字符
- 对于apex/根域名记录,使用空字符串作为子域名
'' - 记录ID会在的输出中显示 - 删除记录时需要用到
vercel dns ls - 部分记录(如Vercel自动添加的记录)无法删除