Updated on 2024-04-16 GMT+08:00

Configuring the Local hosts File

Configure DNS or the local hosts file before you can use the basic functions of OBS.

No matter whether you are using OBS buckets or parallel file systems, configurations in this section are required.

Scenarios

End users usually access OBS in the scenarios listed in Table 1.

Table 1 OBS access scenarios

Access Method

Required Configuration

Operated By

Local network (IDC without a DNS server) outside the cloud

Configuring the local hosts file

End users

Configuration Description

All configurations below are examples under the following scenario assumption. Actual configurations are subject to the actual information.

Scenario Assumption

The global domain name of a cloud service is huaweicloud.com. OBS is deployed in two regions (with the region IDs of region1 and region2).

  • region1 is the default region, and the IP address of its default cluster lz01 is 192.168.0.1.
  • region2 is a non-default region, and the IP address of its default cluster lz01 is 192.168.0.2.

Scenario: Configuring the Local hosts File

To access OBS (without a DNS server) over a local network, you need to add the following information to the local hosts file:

Note: Each time you create a bucket, you need to add two records for the bucket in the hosts file. One is for the domain name with the region information and the other is for the domain name without the region information. For details, see the example below.

192.168.0.1 obs.huaweicloud.com
192.168.0.1 obs.region1.huaweicloud.com
192.168.0.2 obs.region2.huaweicloud.com
192.168.0.1 obsbrowser.obs.region1.huaweicloud.com # This configuration is required before downloading OBS Browser+.
192.168.0.1 bucket1.obs.region1.huaweicloud.com
192.168.0.2 bucket2.obs.region2.huaweicloud.com
192.168.0.1 bucket1.obs.huaweicloud.com
192.168.0.2 bucket2.obs.huaweicloud.com
......

Configure the following items when static website hosting is required:

192.168.0.1 bucket1.obs-website.region1.huaweicloud.com
192.168.0.2 bucket2.obs-website.region2.huaweicloud.com
......
  1. In this example, huaweicloud.com (global domain name), region1 and region2 (region IDs), bucket1 and bucket2 (bucket names), as well as 192.168.0.1 and 192.168.0.2 (IP addresses) are all examples. Replace them with the actual information.
    • The first line is the OBS global domain name, in which the IP address is the OBS global IP address (the IP address of the default cluster lz01 in the default region). To obtain this IP address, log in to CloudAutoDeploy-EDK in the default region, and choose Project Management > Projects. Click Export Deliverable on the right of the desired project. Decompress the exported package, and open the obs_lld file in the obs directory. In this file, find the value of virtual_ip in the OM IP /27 column of the lz01 region's LVS node.
    • The lines after the first line record the domain name of each region, with the IP address of the region's default cluster. To obtain this IP address, log in to CloudAutoDeploy-EDK in each region, and choose Project Management > Projects. Click Export Deliverable on the right of the desired project. Decompress the exported package, and open the obs_lld file in the obs directory. In this file, find the value of virtual_ip in the OM IP /27 column of the lz01 region's LVS node.
  2. Path of the hosts file:
    • Windows: C:\Windows\System32\drivers\etc\hosts
    • Linux: /etc/hosts
  3. In addition to the first three lines for global and regional domain configuration, you also need to add the access domain name of each bucket (like bucket1 or bucket2 in the example) to be accessed to the hosts file. Replace the bucket and region configuration (including the region ID and default cluster IP address) with the actual information. Two records should be configured for each bucket, one for the domain name with region information and the other for the domain name without region information.
  4. The fourth line is the configuration required for downloading OBS Browser+. For a successful download, you need to add the domain name of the bucket that stores the OBS Browser+ software package in the hosts file. In the bucket domain names above, obsbrowser (bucket name) and region1 (region ID) are only examples. Replace them with the actual information in the download link of OBS Browser+ on OBS Console.