How to Run Claude Code on a VPS with a Static Residential IP
1. Why Deploy Claude Code on a VPS?
Due to regional availability restrictions associated with Claude, some developers choose to install and run Claude Code on a VPS (Virtual Private Server) to create an independent remote development environment.
Why do developers choose this setup?
1.1 An Independent Development Environment
By installing project files, Python, Node.js, Docker, and other dependencies on a VPS, you can reduce differences between your local operating system and the remote development environment.
You can also configure the server's time zone, system language, and other environment settings according to your requirements.
1.2 Independently Configurable Network Egress
The public IP address provided by a VPS usually belongs to a data center network.
If an application requires a specific regional IP address or a fixed proxy egress, you can configure a static residential IP separately without changing your existing VPS.
Note: A static residential IP is not a mandatory requirement for running Claude Code. Whether you use a proxy should depend on your application's network requirements and the applicable service terms.
2. How Does the Claude + VPS + Static Residential IP Setup Work?
This tutorial uses the following network architecture:
Your Mac Computer
|
Claude Desktop
|
SSH Encrypted Connection
|
Overseas NAT VPS
|
Claude Code
|
HTTP/HTTPS Proxy
|
IPest Static Residential IP
|
Anthropic Cloud API
In this setup, each component has a different responsibility:
- Mac Computer: Provides the graphical interface for interacting with Claude.
- Claude Desktop: Acts as the local graphical client and remote development interface.
- NAT VPS: Provides the remote environment where Claude Code runs.
- HTTP/HTTPS Proxy: Routes configured application traffic through the designated proxy server.
- IPest Static Residential IP: Provides the configured residential IP egress.
- Anthropic Cloud: Handles model inference and AI responses.
Let's go through the complete setup process.
Step 1: Connect to an Overseas VPS
Note: If you encounter difficulties during the configuration process, you can use an AI assistant to help troubleshoot commands and settings.
First, log in to your VPS provider's control panel and locate your server's SSH connection details.
You will typically need:
- SSH public entry address
- SSH mapped port
- Server username
- Login password or SSH private key
For example, suppose your provider assigns the following SSH connection details:
SSH Host: SERVER_HOST
SSH Port: 30022
Username: ubuntu
Note that 30022 is only an example mapped port. Not all VPS providers use this port.
1.1 Open Terminal on Your Mac
Open the Terminal application on your Mac and execute:
ssh ubuntu@SERVER_HOST -p 30022
If you use SSH key authentication, specify your private key in the command:
ssh -i ~/.ssh/id_ed25519 \
ubuntu@SERVER_HOST -p 30022
When connecting to the server for the first time, verify the SSH host fingerprint to make sure you are connecting to your own server.
1.2 Check the VPS System Environment
After successfully logging in, execute the following commands one by one.
Check the Ubuntu version:
cat /etc/os-release
Check the server's memory:
free -h
Check the CPU architecture:
uname -m
These commands help you understand the basic hardware and software environment of your VPS.
1.3 Check Whether the VPS Can Access the Internet
Execute:
curl -4 --noproxy '*' https://api.ipify.org
If an IPv4 address is returned, it means the VPS can directly access this IP lookup service.
The displayed address is usually the shared public egress IP of the NAT gateway, rather than a dedicated public IP assigned exclusively to your VPS.
Next, check whether SFTP is available.
Open another local Terminal window on your Mac and execute:
sftp -P 30022 ubuntu@SERVER_HOST
If you see the sftp> prompt, SFTP is available.
Type bye to exit.
This step is important because Claude Desktop's remote SSH functionality requires the server to provide both SSH and SFTP services.
Step 2: Purchase and Test an IPest Static Residential IP
After completing the basic server checks, the next step is to configure an independent residential proxy egress.
2.1 Obtain Your Proxy Connection Details
Visit the IPest control panel and select a static residential IP product that meets your business requirements.
After purchasing or creating your proxy, retrieve the connection details from the dashboard.
The following information is for demonstration purposes only:
| Parameter | Example |
|---|---|
| Proxy Type | HTTP |
| Proxy Server | proxy.example.com |
| Port | 8080 |
| Username | YOUR_USERNAME |
| Password | YOUR_PASSWORD |
| Target Egress Location | United States |
These are demonstration values and do not represent IPest's actual proxy gateway address or port.
If your product uses username and password authentication, make sure you keep your credentials secure.
2.2 Test the Proxy Connection on Your VPS
Log in to your VPS through SSH and execute:
curl -4 \
--proxy http://proxy.example.com:8080 \
--proxy-user 'YOUR_USERNAME:YOUR_PASSWORD' \
https://api.ipify.org
Replace the example proxy address and test credentials with your actual HTTP proxy information.
For production use, it is recommended to pass credentials through protected environment variables or a secure secrets management solution to avoid leaving plaintext passwords in your terminal history.
If your provider supports a TLS-encrypted HTTPS proxy endpoint, consider using it.
2.3 Compare the Egress IP Addresses
After testing the connection, compare the results from the two IP lookup requests.
| Test | Expected Result |
|---|---|
| Direct VPS Connection | Shared public egress IP of the NAT gateway |
| Connection Through IPest Proxy | Purchased static residential egress IP |
If the second request returns the same IP address displayed in your product dashboard, it indicates that the request has successfully passed through the residential proxy.
It is also recommended to use an independent IP lookup service to verify the following:
- Country and region
- ASN / ISP information
- Whether the egress IP remains stable across multiple tests
Important: This test only confirms that the proxy itself is working. It does not yet prove that Claude Code is using the proxy for its own API requests.
The next step is to configure the application itself.
Step 3: Configure the Claude Code Proxy on Your VPS
This is the most important part of the entire setup.
Claude Code supports proxy configuration through the HTTP_PROXY and HTTPS_PROXY environment variables.
However, when using Claude Desktop's remote SSH mode, the proxy settings should be configured in the remote server's:
~/.claude/settings.json
Simply adding the variables to .bashrc or .profile may not work, because remote sessions launched by the desktop application do not necessarily load these shell configuration files.
3.1 Create the Configuration Directory
Run the following commands in your VPS terminal:
mkdir -p ~/.claude
chmod 700 ~/.claude
This creates the Claude configuration directory and restricts access to it.
3.2 Edit the Claude Code Configuration File
Execute:
nano ~/.claude/settings.json
If the file does not already exist, you can add the following configuration:
{
"env": {
"HTTPS_PROXY": "http://YOUR_USERNAME:YOUR_PASSWORD@proxy.example.com:8080",
"HTTP_PROXY": "http://YOUR_USERNAME:YOUR_PASSWORD@proxy.example.com:8080"
}
}
Replace the following parameters with your actual proxy information:
| Parameter | Description |
|---|---|
| YOUR_USERNAME | Your proxy username |
| YOUR_PASSWORD | Your proxy password |
| proxy.example.com | Your proxy server address |
| 8080 | Your proxy port |
The http:// prefix indicates that an HTTP proxy is being used.
HTTPS destination requests can still be transmitted through an HTTP CONNECT tunnel.
If your proxy provider supports an encrypted HTTPS proxy connection, you can use an https:// proxy address according to the provider's configuration requirements.
If your username or password contains special URL characters such as @, #, or :, you need to URL-encode those characters.
If settings.json already contains other configuration settings, merge the env section into the existing file instead of overwriting the entire configuration.
3.3 Save and Secure the Configuration File
In the nano editor:
- Press
Ctrl + Oto save the file. - Press
Ctrl + Xto exit.
Then execute:
chmod 600 ~/.claude/settings.json
This restricts file access permissions and prevents other regular system users from directly reading the proxy authentication information.
Security recommendations:
- Never commit configuration files containing real passwords to a Git repository.
- Do not share your proxy credentials with other people.
- Avoid exposing authentication information in screenshots or public documentation.
Step 4: Install Claude Desktop and Connect to Your VPS
After completing the proxy configuration on the server, you can use a graphical client to connect to your remote development environment.
4.1 Download Claude Desktop
Visit the official download page:
Download the macOS version, install the application, and sign in with your Anthropic account.
4.2 Open the Code Feature
Launch Claude Desktop and navigate to the Code section.
Make sure you are using the graphical interface for Claude Code rather than the standard Chat interface.
4.3 Add an SSH Server
When creating a new Code session, open the environment selector and navigate through the following options:
New Environment → SSH → Add SSH Connection
In the configuration window, enter your server details:
| Setting | Example |
|---|---|
| Name | My NAT VPS |
| SSH Host | ubuntu@SERVER_HOST |
| SSH Port | 30022 |
| SSH Key | ~/.ssh/id_ed25519 |
| Worktree Folder | Default or Custom Directory |
If you use password authentication, complete the authentication process according to the methods supported by the client.
For remote development, SSH key authentication is generally recommended.

4.4 Create a Remote Session
After clicking Add SSH Connection, select a project directory on your server.
For example:
/home/ubuntu/my-ai-project
Then create a remote environment and start a new Claude Code session.
Claude Desktop will attempt to automatically install the required Claude Code components on the remote server.
Therefore, when using the official desktop SSH functionality, you generally do not need to install Claude Code manually in advance.

If you prefer to use the standalone terminal version, you can also execute the official installation command directly on your VPS:
curl -fsSL https://claude.ai/install.sh | bash
Then execute:
claude --version
This allows you to check whether the installation was successful.
4.5 Start Interacting with Claude Through the Graphical Interface
Once the remote session has been created successfully, you can enter natural language instructions directly into Claude Desktop.
For example:
Please check the current server operating system and Python version.
Then create a simple Python example program in the current project directory.
Claude Code will execute authorized operations on your VPS and return the results through the desktop application.
At this point, the responsibilities of each component are as follows:
- Mac: Handles graphical interaction.
- NAT VPS: Runs Claude Code and manages the remote project environment.
- IPest Proxy: Handles configured outbound application requests.
- Anthropic Cloud: Performs model inference.
For your first session, it is recommended to use a permission mode that requires manual confirmation before executing sensitive operations. This helps prevent AI tools from accidentally running high-risk commands on your server.
Step 5: Verify That the Deployment Is Working
You can verify the deployment from three different perspectives.
5.1 Confirm That Claude Code Is Running on the VPS
In your remote Code session in Claude Desktop, ask Claude to execute:
hostname
pwd
uname -a
Check the returned hostname, working directory, and system information.
Make sure the execution environment belongs to your VPS rather than your local Mac.
5.2 Confirm That the Proxy Is Working
Use the previously introduced cURL proxy test to confirm that the expected static residential egress IP can be obtained.
If the IPest dashboard provides proxy request logs or connection records, you can also compare the test timestamps to verify whether the requests passed through the designated proxy.
Important: Running a cURL proxy test in the terminal does not automatically prove that Claude Code's actual API requests are using the proxy.
Claude Code's proxy configuration must be applied as described in Step 3. You should also use connection logs and actual application behavior to troubleshoot the setup.
5.3 Test the Actual Claude Code Functionality
Try asking Claude to perform the following tasks:
- Create a new Python file.
- Modify the file contents.
- Execute a simple test script.
- Return the test results.
Confirm that remote file operations, command execution, and model interactions all work correctly.
If all these operations succeed, your basic remote development environment is ready to use.
Frequently Asked Questions (FAQ)
Q1: Can I Run Claude Code on a NAT VPS Without a Public IPv4 Address?
Yes.
As long as your NAT VPS has a working outbound internet connection and provides accessible SSH/SFTP remote access, you can run Claude Code on it.
You can connect to the server through port forwarding. A dedicated public IPv4 address is not required.
Q2: Will SSH Traffic Also Go Through the Residential IP After Configuration?
No.
This tutorial uses an application-level proxy configuration.
SSH connections still use the server entry point provided by your VPS provider.
The static residential IP mainly handles application requests that have been explicitly configured to use the proxy.
Q3: Why Does Claude Desktop Still Fail to Connect Even After Proxy Configuration?
There are several possible reasons:
- The NAT VPS cannot reach the proxy server.
- The proxy address, port, or authentication credentials are incorrect.
- The proxy only supports SOCKS5, while Claude Code requires an HTTP/HTTPS proxy for this configuration.
- The SSH/SFTP service is not working properly.
- The configuration file was not saved correctly.
- Other environment variables are overriding the proxy settings.
- The VPS does not have sufficient memory or disk space.
- The Anthropic account, regional availability, or API access permissions do not meet the applicable requirements.
It is recommended to troubleshoot the setup in the following order:
- VPS network connectivity.
- Proxy connection.
- SSH/SFTP connectivity.
- Claude Code configuration.
Checking each component separately makes it easier to identify the problem.
Q4: Will Claude Code Continue Running After I Turn Off My Mac?
The VPS itself can continue running even after you turn off your Mac.
However, ordinary interactive SSH sessions may terminate when the connection is disconnected.
If you need to keep a program running for an extended period, you can use process management tools such as systemd.
Whether Claude Code background tasks continue running depends on the session mode and task management method being used.
Q5: Can I Run Multiple AI Tools on One VPS?
Yes.
For example, you can deploy the following tools on the same server:
- Claude Code
- OpenCode
- Python automation scripts
- Other AI development tools
However, different applications may support different proxy protocols and environment variables.
You should configure and test the proxy settings for each application separately.
Q6: Does Purchasing a Residential IP Guarantee Claude Account Security?
No.
A residential IP only provides specific network egress characteristics. It cannot guarantee that an account will never trigger additional verification, restrictions, or suspension.
When using Claude and its related APIs, you must still comply with Anthropic's supported-region policies, account requirements, and Terms of Service.
A proxy does not replace account eligibility or authorization.
6. Conclusion
A VPS and a static residential IP serve different purposes and are not alternatives to each other.
A VPS provides the application runtime environment, while a static residential proxy provides a configurable network egress.
By combining the two, developers can configure a fixed egress IP for different applications without having to replace their existing server infrastructure.
If your overseas applications require a consistent IP address from a specific region, you can explore IPest's Static Residential IP services.
After obtaining your proxy connection details from the IPest dashboard, follow the steps in this guide to complete the configuration.
Disclaimer: This tutorial is intended for legitimate and authorized network access and development purposes. Always comply with the usage policies and terms of service of the platforms you access.


