Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
Help Center/ CodeArts Deploy/ Best Practices/ Deploying an Application on an Intranet Host Using a Proxy Host

Deploying an Application on an Intranet Host Using a Proxy Host

Updated on 2024-11-19 GMT+08:00

Application Scenario

Deploy applications on the intranet through proxy hosts to effectively control intranet and extranet communication, enhance data security and network performance, and meet compliance requirements. This policy is widely used in various key scenarios, such as resource access control, secure communication between data centers, content cache acceleration, environment isolation, security audit, and sensitive data processing.

Solution Architecture

The Internet forward proxy function of Squid is used to specify the IP address and port of the target host on the proxy, enabling the target host to access the public network.

For more information about Squid, go to Squid official website. The following procedure uses a Linux host as an example.

Prerequisites

  • A host (Proxy-B) bound to a public IP address is available. If no proxy host is available, see Applying for an ECS.
  • A host (Host-A) not bound to a public IP address is available.
  • Proxy-B and Host-A can access each other through the intranet.

Process

This section describes how to deploy an application on an intranet host or server using a proxy host.

Figure 1 Process flowchart

  1. Install Squid.

    Access the command line tool of Proxy-B and run the following command:

    yum install squid -y

    If Complete is displayed, run the following command:

    yum install iptables-services 

    Enter Y. If Complete is displayed, the installation is complete.

  2. Edit the Squid configuration file.

    1. Access the command line tool of Proxy-B and run the following command:
      vim /etc/squid/squid.conf

    2. Add the following command to the position marked in the red box in the preceding figure:
      acl local src Internal IP address of the host/24
    3. Press Esc and enter :wq to save the file and exit.

  3. Configure the firewall of Proxy-B.

    Access the command line tool of Proxy-B and run the following commands in sequence:

    systemctl stop firewalld.service 
    systemctl disable firewalld.service
    yum install iptables-services iptables-devel -y
    systemctl enable iptables.service
    systemctl start iptables.service
    iptables -I INPUT 1 -s Internal IP address of the host/24 -p tcp --dport 3128 -j ACCEPT
    iptables -I INPUT 2 -p tcp --dport 3128 -j DROP 
    NOTE:

    The IP address in the last but one line must be set to the internal IP address segment or IP address of Host-A. 3128 is the proxy port of Squid.

  4. Install OpenSSL.

    Access the command line tool of Proxy-B and run the following command:

    yum install openssl 

    If Complete is displayed, the installation is complete.

  5. Start Squid.

    Access the command line tool of Proxy-B and run the following command:

    systemctl start squid     //Start Squid.
    systemctl status squid    //Check the status of Squid.

  6. Configure the forward proxy.

    Access the command line tool of Host-A and run the following command:

    echo "export http_proxy=http://Internal IP address of the proxy host:3128" >>/etc/profile
    echo "export https_proxy=http://Internal IP address of the proxy host:3128" >>/etc/profile
    echo "export http_proxy=http://Internal IP address of the proxy host:3128" >>~/.bashrc
    echo "export https_proxy=http://Internal IP address of the proxy host:3128" >>~/.bashrc
    echo "export http_proxy=http://Internal IP address of the proxy host:3128" >>~/.bash_profile
    echo "export https_proxy=http://Internal IP address of the proxy host:3128" >>~/.bash_profile
    source /etc/profile
    source ~/.bashrc
    source ~/.bash_profile

  7. Create basic resources.

    1. Click Homepage to view all created projects, and then go to the target project.
    2. Choose Settings > General > Basic Resources. The Host Clusters page is displayed by default.
      NOTE:

      Choose CICD > Deploy. Click Basic Resources. The Host Clusters page is displayed by default.

    3. Click Create Host Cluster, enter the following information, and click Save.

      Parameter

      Mandatory

      Description

      Cluster Name

      Yes

      Enter a custom name.

      OS

      Yes

      Select Linux based on the OS of the host to be added.

      Host Connection Mode

      Yes

      Select Proxy.

      Execution Resource Pool

      Yes

      A resource pool is a collection of physical environments where commands are executed during software package deployment. In this scenario, select official.

      Description

      No

      Enter a description.

    4. Click Add Host, select Adding IP for Add hosts by, enter the following information, and click OK. The proxy host is created.
      Table 1 Parameters of a Linux proxy host

      Parameter

      Mandatory

      Description

      Host Name

      Yes

      Enter a custom name, for example, Proxy-B.

      IP

      Yes

      Enter the public IP address bound to Proxy-B.

      OS

      Yes

      Keep the default value because it is the OS of your host cluster.

      Authorization

      Yes

      In this scenario, the Password is used for authentication. Enter the username and password of Proxy-B.

      SSH Port

      Yes

      Port 22 is recommended.

    5. Click Add Host, select Adding IP for Add hosts by, enter the following information, and click OK. The target host is created.
      Table 2 Parameters of a Linux target host

      Parameter

      Mandatory

      Description

      Host Name

      Yes

      Enter a custom name, for example, Host-A.

      Proxy Host

      Yes

      Select Proxy-B as the network proxy for the target host that cannot connect to the public network.

      IP

      Yes

      Enter the private IP address of Host-A.

      OS

      Yes

      Keep the default value because it is the OS of your host cluster.

      Authorization

      Yes

      In this scenario, the Password is used for authentication. Enter the username and password of Host-A.

      SSH Port

      Yes

      Port 22 is recommended.

    6. Click in the Operation column of a host to start the host for connectivity verification.

  8. Create an application.

    1. Log in to the CodeArts homepage and click the target project name to access the project.
    2. Choose CICD > Deploy.
    3. Click Create Application. On the Set Basic Information page, modify the basic information such as Name, Description, and Execution Host as required.
    4. After editing the basic application information, click Next. On the deployment template selection page, select Blank Template and click OK.
    5. On the Deployment Actions tab page, find the action list on the right, click Add to add an action to the orchestration area on the left.
    6. On the Environment Management page, click Create Environment, enter the basic information, and click Save.
    7. Click Import Host. The system automatically filters all clusters that meet the requirements of the current environment. In the dialog box that is displayed, select the target host cluster and import Proxy-B and Host-A to the environment.

  9. Deploy the application. For details, see Deploying an Application and Viewing the Result.

    1. Select the target application in the application list and click .
    2. After the deployment is complete, click the application name and click the target deployment record. The application status bar changes to green and the message Successful is displayed, indicating that the application is successfully deployed.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback