vercel-dns

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

What 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:
    npm i -g vercel
    or
    brew install vercel-cli
  • Logged in:
    vercel login
  • Domain must be on Vercel nameservers or have Vercel as DNS provider
  • 已安装Vercel CLI:
    npm i -g vercel
    brew install vercel-cli
  • 已登录:
    vercel login
  • 域名必须使用Vercel域名服务器,或已将Vercel设为DNS服务商

0 Finance Project

0 Finance项目

For the 0 Finance project, always use
--scope prologe
:
bash
vercel dns ls 0.finance --scope prologe
vercel logs www.0.finance --scope prologe
针对0 Finance项目,请始终使用
--scope prologe
参数:
bash
vercel dns ls 0.finance --scope prologe
vercel logs www.0.finance --scope prologe

Common Commands

常用命令

Check Login & Team

检查登录状态与团队

bash
undefined
bash
undefined

Check 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
undefined
vercel domains ls --scope prologe
undefined

List Domains & Records

列出域名与记录

bash
undefined
bash
undefined

List 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
undefined
vercel dns ls <domain> --scope prologe
undefined

Add DNS Records

添加DNS记录

bash
undefined
bash
undefined

Add 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
undefined
vercel dns add <domain> '' TXT '<value>' vercel dns add <domain> @ MX mail.example.com 10
undefined

Remove DNS Records

删除DNS记录

bash
undefined
bash
undefined

First 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
undefined
vercel dns rm <record-id> --yes
undefined

Examples

示例

Add Email DNS Records (MX + SPF)

添加邮件DNS记录(MX + SPF)

bash
undefined
bash
undefined

Add 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'
undefined
vercel dns add example.com '' TXT 'v=spf1 include:amazonses.com ~all'
undefined

Add DKIM Records for Email Authentication

添加用于邮件认证的DKIM记录

bash
undefined
bash
undefined

DKIM 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
undefined
vercel dns add example.com selector._domainkey CNAME selector.dkim.provider.com
undefined

Add Domain Verification TXT Record

添加域名验证TXT记录

bash
undefined
bash
undefined

Google/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'
undefined
vercel dns add example.com _amazonses TXT 'verification-token-here' vercel dns add example.com '' TXT 'google-site-verification=token'
undefined

Subdomain Setup

子域名配置

bash
undefined
bash
undefined

Point 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
undefined
vercel dns add example.com api CNAME api.service.com vercel dns add example.com app A 192.0.2.1
undefined

Troubleshooting

问题排查

"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:
    dig +short <record-name> <record-type>
    or use dnschecker.org
  • Verify record was added:
    vercel dns ls <domain>
  • DNS生效可能需要长达48小时(通常为5-30分钟)
  • 检查生效状态:
    dig +short <record-name> <record-type>
    或使用dnschecker.org
  • 验证记录是否已添加:
    vercel dns ls <domain>

Token Saving Tips

令牌保存技巧

Fast Verification With
dig

使用
dig
快速验证

When 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.com

Tips

注意事项

  1. Always check which team you're in before making changes
  2. Use single quotes around TXT values to preserve special characters
  3. For apex/root domain records, use empty string
    ''
    as subdomain
  4. Record IDs are shown in
    vercel dns ls
    output - needed for removal
  5. Some records (like those added by Vercel automatically) cannot be removed
  1. 进行更改前,请务必检查当前所在团队
  2. TXT值请使用单引号包裹,以保留特殊字符
  3. 对于apex/根域名记录,使用空字符串
    ''
    作为子域名
  4. 记录ID会在
    vercel dns ls
    的输出中显示 - 删除记录时需要用到
  5. 部分记录(如Vercel自动添加的记录)无法删除