מדריך למתחילים: הגדרת רשומות DNS לשם דומיין באמצעות Cloud DNS

במאמר הזה מוסבר איך להגדיר אזור מנוהל של Cloud DNS ורשומת משאב לשם הדומיין. המדריך כולל דוגמה ליצירת אזור מנוהל, ולאחר מכן להגדרת רשומות של כתובת (A) ושם קנוני (CNAME) עבור הדומיין.


לחצו על תראו לי איך כדי לקרוא הסבר מפורט על המשימה ישירות במסוף Google Cloud :

תראו לי איך


מידע נוסף זמין במקורות המידע הבאים:

דרישות

במדריך למתחילים הזה אנחנו יוצאים מנקודת הנחה שיש לכם:

  • שם דומיין דרך רשם שמות דומיין. אתם יכולים לרשום שם דומיין באמצעות Cloud Domains או רשם דומיינים אחר לפי בחירתכם. ‫Cloud Domains מאפשר לכם לנהל דומיינים באמצעות Cloud Domains API.
  • מכונה וירטואלית (VM) של Windows Server או מכונת VM של Linux.
  • כתובת IP שאליה תפנה רשומת A באזור שלכם. כתובת IP תקינה יכולה להיות שרת שכבר פועל עם כתובת IP שאפשר להפנות אליה. לדוגמה, אפשר לעבור על המדריך הפעלת שרת אינטרנט בסיסי של Apache כדי להפעיל שרת אינטרנט במכונה וירטואלית ב-Compute Engine.

לפני שמתחילים

  1. נכנסים לחשבון Google Cloud . אם אתם משתמשים חדשים ב- Google Cloud, צרו חשבון כדי שתוכלו להעריך את הביצועים של המוצרים שלנו בתרחישים מהעולם האמיתי. לקוחות חדשים מקבלים בחינם גם קרדיט בשווי 300$ להרצה, לבדיקה ולפריסה של עומסי העבודה.
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator role (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  3. Verify that billing is enabled for your Google Cloud project.

  4. Make sure that you have the following role or roles on the project: Service Usage Admin, DNS Administrator

    Check for the roles

    1. In the Google Cloud console, go to the IAM page.

      Go to IAM
    2. Select the project.
    3. In the Principal column, find all rows that identify you or a group that you're included in. To learn which groups you're included in, contact your administrator.

    4. For all rows that specify or include you, check the Role column to see whether the list of roles includes the required roles.

    Grant the roles

    1. In the Google Cloud console, go to the IAM page.

      Go to IAM
    2. Select the project.
    3. Click Grant access.
    4. In the New principals field, enter your user identifier. This is typically the email address for a Google Account.

    5. Click Select a role, then search for the role.
    6. To grant additional roles, click Add another role and add each additional role.
    7. Click Save.
  5. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator role (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  6. Verify that billing is enabled for your Google Cloud project.

  7. Make sure that you have the following role or roles on the project: Service Usage Admin, DNS Administrator

    Check for the roles

    1. In the Google Cloud console, go to the IAM page.

      Go to IAM
    2. Select the project.
    3. In the Principal column, find all rows that identify you or a group that you're included in. To learn which groups you're included in, contact your administrator.

    4. For all rows that specify or include you, check the Role column to see whether the list of roles includes the required roles.

    Grant the roles

    1. In the Google Cloud console, go to the IAM page.

      Go to IAM
    2. Select the project.
    3. Click Grant access.
    4. In the New principals field, enter your user identifier. This is typically the email address for a Google Account.

    5. Click Select a role, then search for the role.
    6. To grant additional roles, click Add another role and add each additional role.
    7. Click Save.
  8. מפעילים את DNS API.

    תפקידים שנדרשים להפעלת ממשקי API

    כדי להפעיל ממשקי API, צריך את תפקיד ה-IAM 'אדמין של Service Usage' (roles/serviceusage.serviceUsageAdmin), שכולל את ההרשאה serviceusage.services.enable. איך מקצים תפקידים

    להפעלת ה-API

יצירת תחום ציבורי מנוהל ב-Cloud DNS

  1. במסוף Google Cloud , נכנסים לדף יצירת תחום DNS.

    מעבר אל יצירת תחום DNS

  2. כדי ליצור תחום DNS ציבורי, לוחצים על Create zone (יצירת אזור).

  3. בקטע Zone type, בוחרים באפשרות Public.

  4. בשדה שם האזור, מזינים my-new-zone.

  5. בשדה שם DNS, מזינים את שם הדומיין שרכשתם. מזינים רק את שם הדומיין. לדוגמה:

    example.com
    
  6. ברשימה הנפתחת DNSSEC, בוחרים באפשרות Off.

  7. לוחצים על יצירה.

יוצג הדף פרטי האזור. נוצרו בשבילכם רשומות NS ו-SOA שמוגדרות כברירת מחדל.

כדי לערוך רשומה, בדף פרטי האזור, בסוף השורה של הרשומה שרוצים לערוך, לוחצים על עריכה.

יצירת רשומה להפניית הדומיין לכתובת IP חיצונית

אם כתובת ה-IP שלכם היא בפורמט #.#.#.#, יש לכם כתובת IPv4 ואתם צריכים ליצור רשומת A.

אם כתובת ה-IP שלכם היא בפורמט #:#:#:#:#:#:#:#, יש לכם כתובת IPv6 ואתם צריכים ליצור רשומת AAAA.

  1. נכנסים לדף Cloud DNS במסוף Google Cloud .

    מעבר אל Cloud DNS

  2. לוחצים על האזור שבו רוצים להוסיף קבוצת רשומות.

  3. לוחצים על הוספת תקן.

  4. בשדה סוג רשומה, כדי ליצור רשומת A, בוחרים באפשרות A. כדי ליצור AAAA רשומה, בוחרים באפשרות AAAA.

  5. בקטע IPv4 Address או IPv6 Address, מזינים את כתובת ה-IP שרוצים להשתמש בה בדומיין הזה.

  6. לוחצים על יצירה.

יצירת רשומת CNAME לתת-הדומיין www

  1. נכנסים לדף Cloud DNS במסוף Google Cloud .

    מעבר אל Cloud DNS

  2. לוחצים על האזור שבו רוצים להוסיף קבוצת רשומות.

  3. לוחצים על הוספת תקן.

  4. בשדה DNS Name (שם DNS), מזינים www.

  5. בשדה Resource Record Type, בוחרים באפשרות CNAME.

  6. בשדה Canonical name (שם קנוני), מזינים את שם הדומיין ואחריו נקודה (לדוגמה, example.com.).

  7. לוחצים על יצירה.

עדכון הרשומה לוקח זמן עד שהוא מתפשט, בהתאם לערכי אורך החיים (TTL) של הרשומות. כדי לוודא שרשומות ה-DNS פועלות, אפשר להיכנס לשם הדומיין ולוודא שהדומיין מפנה לכתובת ה-IP שלכם.

עדכון שרתי השמות של הדומיין כדי לפרסם את הדומיין

לבסוף, צריך לעדכן את שרתי השמות של הדומיין לשימוש ב-Cloud DNS כדי לפרסם את הרשומות החדשות באינטרנט.

השתמשתם בהצלחה ב-Cloud DNS כדי להגדיר את רשומות ה-DNS.

הסרת המשאבים

כדי לא לצבור חיובים לחשבון Google Cloud על המשאבים שבהם השתמשתם בדף הזה, פועלים לפי השלבים הבאים:

  1. נכנסים לדף Cloud DNS zones במסוף Google Cloud .

    מעבר לאזורים ב-Cloud DNS

  2. לוחצים על שם האזור (my-new-zone) כדי לעבור לדף פרטי האזור.

  3. בוחרים את רשומות A ו-CNAME שיצרתם.

  4. לוחצים על מחיקת סט הרשומות.

  5. עוברים לדף אזורי Cloud DNS.

    מעבר לאזורים ב-Cloud DNS

  6. כדי למחוק את האזור, מסמנים את תיבת הסימון my-new-zone ואז בסוף השורה לוחצים על מחיקת האזור.

המאמרים הבאים