Skip to content
Back to blog

Proxy Chaining: How It Works, Setup & Use Cases

Table of contents

Key takeaways:

  • Proxy chaining routes internet traffic through two or more proxy servers.
  • Proxy chains can use HTTP, SOCKS5, or a combination of both protocols.
  • Proxy chaining provides more control over traffic routing but can increase latency.
  • Tools like ProxyChains-NG and Squid can be used to configure proxy chains.

Proxy chaining sounds simple: instead of one proxy, you use several in a row. In practice, the order of the hops, the protocols they speak, and where your DNS lookups happen decide whether the chain works and what each server can see.

This guide explains how proxy chains work, how to set one up with ProxyChains, Squid, and Python, and when a single or rotating proxy is the better choice.

What is proxy chaining?

Proxy chaining is a technique for routing your internet traffic through two or more proxy servers to reach its destination. While you would normally use a single proxy server to access a website, with proxy chaining, you use multiple.

Each of these proxies is another ‘hop’ in your connection. For instance, you could connect from your computer to proxy 1, then from that to a second proxy, and finally via that second proxy to a website. The website will generally only see the last hop’s IP address, not your own.

Proxy chaining is often used for privacy-focused browsing, network testing, and web scraping when specific routing configurations are required.

How does proxy chaining work?

A normal proxy chain looks like this: client > proxy 1 > proxy 2 > destination.

The first proxy is called the entry proxy, and the last is called the exit proxy. If there are additional proxies in between, these are called intermediate proxies.

Each of them receives the connection from the previous server and forwards it to the next. Usually, your client or a chaining tool builds this route: it connects to the entry proxy, asks it to open a tunnel to the next proxy with an HTTP CONNECT or SOCKS5 request, and repeats this through each tunnel until the exit proxy connects to the website.

The entry proxy will see your original IP address, while the others will see the IP address of the previous proxy (assuming proper configuration). Each proxy is only asked to connect to the next hop, and with HTTPS, the page content stays encrypted at every hop. Proxy chains can use IPv4 or IPv6 addresses.

Proxy chains can use HTTP or SOCKS5 proxies. HTTP proxies are primarily used for web traffic, while SOCKS5 can be used for a wider variety of applications and types of network traffic, including TCP (and where supported, UDP). Both protocols can be mixed depending on the tools and configuration used.

Types of proxy chaining

There are different types of proxy chaining depending on the protocols used (HTTP, SOCKS5, mixed) and whether the chain is static or dynamic.

An HTTP proxy chain is a sequence of HTTP proxies used to forward web requests made by a user. It’s used mostly for web browsing and other HTTP/HTTPS traffic.

A SOCKS5 proxy chain is a sequence of SOCKS5 proxies used to forward different types of TCP traffic. SOCKS5 also defines UDP relaying, but chaining tools such as ProxyChains carry TCP only.

A mixed proxy chain is a combination of both HTTP and SOCKS5 proxies that can be used on a single connection. You can combine them in any order, as long as the software managing the proxy chain supports both protocols.

Proxy chains may be static or dynamic, too. A static chain uses the same proxy servers in the same order for every connection, so if one hop is down, the connection fails. A dynamic chain skips proxies that don’t respond and builds the route from the ones that do.

ProxyChains calls these modes strict_chain and dynamic_chain, and adds random_chain, which builds each connection from chain_len proxies picked at random. Dynamic chains offer more flexibility when routing traffic through unreliable proxies, but your exit IP can change if a hop drops out.

Benefits and limitations of proxy chaining

The first benefit of using proxy chaining is that you can use different entry and exit IP addresses. The destination website will see the last proxy’s IP address, not your IP address. That can provide an extra layer of privacy, especially if entry and exit proxies are under different providers.

Another benefit of proxy chaining is the control you have over which proxies you route your connection through. That provides more flexibility for routing traffic for specific applications or network needs, which could be useful for network testing or other situations that require routing through certain servers.

One disadvantage of using proxy chaining is that connections through multiple servers are slower than connections through a single server. That’s because each hop takes additional time, and the latency can accumulate if the proxies are located far away from each other.

In a fixed chain, all proxies must be up and responding. If one of the servers is down or not responding, the connection will fail.

DNS leaks are another concern. For example, if DNS settings are not configured correctly, information about the websites you visit could be exposed. There is also a risk of exposing proxy authentication credentials when connections between proxies are not encrypted.

Finally, proxy chaining does not guarantee end-to-end encryption, as this depends on the protocols and encryption used. If you’re concerned about privacy, it’s also worth understanding how safe proxies are in general.

Proxy chaining vs other solutions

Proxy chaining is one way to route your internet traffic, but there are alternatives. The major differences between proxy chaining and other alternatives are in the way traffic is routed, the way IP addresses are handled, and the level of privacy the user can expect.

Proxy chaining vs single proxy

When using a single proxy, your traffic is routed through a single proxy server to the destination website. When you use a proxy chain, your traffic is routed through two or more proxies. This means the destination website will only see the IP address of the final or exit proxy, while the entry proxy receives the initial connection.

Using more than one hop can result in higher latency and a more complex connection. Using a single hop or single proxy is generally simpler and faster to set up if you just want to change the IP address that is visible to the destination website.

Proxy chaining vs rotating proxies

Rotating proxies change the IP address your outgoing requests are sent from, often using a proxy pool, either automatically or according to certain rules you define. Proxy chaining involves routing your connection through multiple proxy servers, while a rotating proxy service may use a different exit IP address for each request you make without using multiple hops.

Proxy chaining and rotating proxies can be used in conjunction with each other depending on your provider and configuration. Rotating proxies may be more helpful when you want to send requests from multiple or different IP addresses, like in web scraping.

Proxy chaining vs VPN

When using a VPN, a tunnel of encrypted traffic is established between your computer and the VPN server. Your device’s internet traffic is usually routed through the VPN tunnel, while proxy chaining involves routing traffic through multiple proxy servers.

Proxy chaining does not automatically encrypt traffic between your device and the destination. VPNs are generally easier to set up for everyday privacy, while proxy chaining lets you choose each hop yourself.

Proxy chaining vs Tor

Tor works by routing your connection through a network of multiple servers and uses layered encryption. A typical Tor circuit consists of three relays: an entry guard, a middle relay, and an exit relay.

Typical proxy chaining does not automatically route your connections with the same encryption and anonymity features. Tor was built specifically for anonymous communication, while proxy chaining gives you more flexibility in how you route your connections for testing, custom use, or specific applications.

Build a fast, reliable proxy chain in 2026

Get proxies

How to set up proxy chaining

There are several ways to configure proxy chaining, depending on your operating system, applications, and how much control you need over your connections.

Using ProxyChains on Linux

ProxyChains is a program that enables you to chain multiple HTTP or SOCKS5 proxies for TCP connections on Linux. Its maintained version, ProxyChains-NG, can be installed through your Linux distribution’s package manager. For instance, on Ubuntu or Debian, you can run sudo apt install proxychains4.

Once installed, open the ProxyChains configuration file, typically /etc/proxychains4.conf, and find the [ProxyList] section at the end. Each line in it is one hop, in order: the proxy type, IP address, and port, followed by a username and password if the proxy requires authentication.

Above the list, leave one chain mode uncommented: strict_chain or dynamic_chain, depending on whether you want every proxy in the chain to be required or to skip over unavailable proxies. Keep proxy_dns on, as it is in the default file, so supported DNS lookups go through the chain. For example, this chains a SOCKS5 proxy and an HTTP proxy:

# relevant lines in /etc/proxychains4.conf
strict_chain
proxy_dns
 
[ProxyList]
socks5  203.0.113.10   1080  username  password
http    198.51.100.20  8080  username  password

Remove the default socks4 127.0.0.1 9050 entry, which points to a local Tor service, and replace the placeholder addresses and credentials with your own. Use numeric IP addresses: ProxyChains accepts hostnames only for later hops in a strict chain with proxy_dns on.

Save your configuration, and you can test your connection with a command such as proxychains4 curl https://api.ipify.org. The API will return an IP address, which should reflect the exit proxy and not your actual IP. ProxyChains also prints each hop as it connects, so you can see where a chain breaks.

Note that this method of chaining only covers TCP traffic from dynamically linked programs, so it won’t work for UDP or for statically linked apps.

Using Squid proxy

Squid is another program that can be used for proxy chaining. It supports HTTP traffic and HTTPS connections through tunneling. Rather than chaining within an application, Squid can be used for routing traffic to an upstream or parent proxy.

You can install Squid and open its configuration file, which is typically found at /etc/squid/squid.conf. Use the cache_peer directive to specify which upstream proxy you would like to use, and never_direct to send matching traffic to it instead of directly to the intended destination:

cache_peer proxy.example.com parent 3128 0 no-query default login=username:password
never_direct allow all

The first line sets proxy.example.com as Squid’s parent proxy on port 3128, and login passes the credentials the parent requires. The second line sends all traffic through that parent.

Squid has many options for authentication and access rules, so you can further customize how you would like Squid to operate. You can also chain multiple Squid instances to create more hops.

One default to check: for plain HTTP requests, Squid adds the client’s IP address in an X-Forwarded-For header. If Squid serves other machines and you don’t want that address passed down the chain, add forwarded_for delete.

Proxy chaining with Python

Python can be used for applications that need to make requests through proxies. The Requests library supports HTTP and SOCKS5 proxies, while ProxyChains can be used to chain multiple proxies for compatible Python applications.

You can install Requests with SOCKS5 support using pip install "requests[socks]". You will then specify a SOCKS5 proxy in your Python script. Use the socks5h:// scheme rather than socks5://, so the proxy resolves hostnames and your DNS lookups don’t leak.

However, specifying multiple proxy addresses won’t chain the requests. The Requests library typically uses one configured proxy per connection.

To create hops, you will need to use another chaining program or have a configured upstream proxy that will chain the connection through another proxy. An example setup would be a Python program making requests to a local Squid proxy, which will then chain the traffic through a second proxy server.

With Squid listening on its default port, 3128, and set up with a parent proxy as shown above, the Python side is a regular proxied request:

import requests
 
# Hop 1 is a local Squid that forwards everything to its parent proxy (hop 2)
proxies = {
    "http": "http://127.0.0.1:3128",
    "https": "http://127.0.0.1:3128",
}
 
response = requests.get("https://api.ipify.org?format=json", proxies=proxies, timeout=30)
print(response.json())  # should show the exit proxy's IP address, not yours

Compare the result with the same request sent without the proxies argument. If the chain works, the IP printed through it belongs to your exit proxy, not your own connection.

You will also want to confirm where your DNS lookups are occurring to ensure they aren’t being exposed outside your intended chain. Through an HTTP proxy such as Squid, Requests sends the hostname in its CONNECT request, so the proxy does the lookup. With SOCKS5, that only happens with socks5h://.

Proxy chaining for web scraping

Proxy chaining can be useful for web scraping because it gives you more control over traffic routing. You can also separate your original IP address from your exit IP address.

You can use either residential or datacenter proxies in a proxy chain. Residential proxies use IP addresses that are assigned by internet providers to residential customers. Datacenter proxies use IP addresses hosted in data centers. Some sites may treat these two connections differently.

Datacenter proxies are typically faster and cheaper. You can use residential proxies, datacenter proxies, or a mixture of the two for web scraping.

Proxy chaining is not the same thing as IP rotation. A chain changes the route your requests take, while rotation changes the exit IP between requests or sessions, which is often what a scraping job needs.

Keep latency and reliability in mind, too. Every hop adds a round trip to each request and is one more proxy that can time out, so a chain makes a large scraping job slower and more likely to fail than a single rotating proxy. Use a chain only when the job needs a specific route, and set timeouts and retries.

Common proxy chaining problems

Connection timeouts are one of the most common issues when using proxy chaining. Since your traffic passes through multiple proxy servers, one slow server can cause the whole connection to time out. If one of the proxy hops fails completely, the request may not reach its destination at all.

Another issue is authentication errors. These can occur if the proxy requires authentication but you do not provide the required username and password. In a chain, each hop checks its own credentials, and a proxy that uses IP allowlisting sees the previous proxy’s IP, not yours, so use username and password authentication for that hop.

A DNS leak is another potential problem. This may occur if your DNS queries are not routed through your proxy chain, exposing information about what you are attempting to access.

The order of proxies in a chain also matters. Some proxies, including Squid with its default settings, only open tunnels to port 443, the standard HTTPS port. Put a proxy like that at the end of the chain, since it will refuse to connect to a next hop on a port such as 8080 or 1080.

The last potential issue is protocol incompatibility. In a tunneled chain, the chaining tool has to speak each hop’s protocol, which ProxyChains does for HTTP, SOCKS4, and SOCKS5. Forwarding setups are stricter: Squid’s cache_peer has no SOCKS option, so a SOCKS5 proxy can’t be Squid’s parent.

When should you use proxy chaining?

There are situations where you might need more control over how you’re routing traffic. For instance, you may be doing some privacy-sensitive work and need to separate your actual IP address from the IP address of the exit proxy. It won’t give you complete anonymity, but it can help.

Proxy chaining can also help with network testing. Sometimes you might need to test how applications work when using multiple servers.

On the other hand, a simple single-proxy setup might be all you need. If all you want to do is change the IP address a website sees, then you don’t need a proxy chain. If you want to switch your IP address between requests, you could rotate your proxies. These alternatives are generally much simpler than using a proxy chain.

Conclusion

Proxy chaining sends your traffic through two or more proxies, so the website normally sees only the exit proxy’s IP, and no single proxy handles the whole route. That separation is useful for privacy-sensitive routing, network testing, and setups that need traffic to leave from a specific place.

The trade-off is speed and reliability: every hop adds latency and another point of failure, and the chain doesn’t encrypt your traffic on its own. Start with a single or rotating proxy, and add hops only when your use case needs them.

FAQ

What is the difference between proxy chaining and proxy rotation?

Proxy chaining routes traffic through multiple proxies in a sequence, while proxy rotation changes the outgoing IP address between requests or sessions.

Does proxy chaining increase anonymity?

Proxy chaining can provide an additional layer of privacy by separating your original IP address from the exit IP. However, it does not guarantee complete anonymity.

Does proxy chaining slow down your connection?

Yes, proxy chaining can slow down your connection because traffic must pass through multiple servers, increasing latency.

Can proxy chaining be used for web scraping?

Yes, proxy chaining can be used for web scraping when you need specific routing configurations. However, rotating proxies may be sufficient for many scraping tasks.

How many proxies can you chain together?

There is no universal limit. The number depends on the software and configuration used, but in general, the more proxies you add, the higher the latency and the greater the chance of connection failures.

What are the best tools for proxy chaining?

ProxyChains-NG is a popular option for Linux, while Squid supports upstream proxy configurations. Python can also be used with proxy-aware libraries and additional chaining tools.

Learn more

Related articles