Is there any way I can set up squid3 to reroute traffic through multiple other servers in order to get a random ip address for each request?
Related
I have a Go service, deployed on Heroku, which pulls the IPv4 address from the request header successfully.
ip := net.ParseIP(strings.Split(r.Header.Get("X-Forwarded-For"), ",")[0]).String()
I have deployed the identical code as a service to Google Cloud, and the IP addresses are frequently IPv6 in about 25% of the time. After examining the full Request Header, there is no IPv4 address available anywhere, only IPv6.
Heroku's Request Header X-Forwarded-For ALWAYS contains the IPv4 address, yet Google Cloud doesn't. Does anyone know a way to force the IPv4 format for Request Headers in Google Cloud?
Clients can connect via IPv4 or IPv6 but not both. Only one address family will be used by the client and only one IP address will be recorded by the proxy.
Additional information:
Heroku does not support IPv6 so clients are forced to connect using IPv4. reference
If you only want IPv4 connections, do not enable the IPv6 frontends. However, I recommend using IPv6 where possible.
As I understand, the max number of TCP connections to a server from a single client IP Address is ~64k connections.
However, what I am not clear about is max number of connections that a server can handle, behind a single load balancer considering that the connections terminate on the Load balancer. Is it ~64k only because there is only one IP from which the server can receive requests?
Indeed, upstream server can handle only 64k connections from the same client due to limitation of ephemeral port range at client side.
But you can assign several IP addresses to the same private interface of your load balancer and force server to use them in a round-robin fashion.
You can define several networks on the same interface of load balancer, for example:
192.168.1.1,
192.168.2.1,
192.168.3.1
And define corresponding extra IP addresses at upstream server:
192.168.1.2,
192.168.2.2,
192.168.3.2 .
With following upstream configuration load balancer will pass requests to the same upstream server while using different IP addresses:
upstream ipproxy {
server 192.168.1.2:some-port;
server 192.168.2.2:some-port;
server 192.168.3.2:some-port;
}
Load balancer will be forced to use different IP addresses thus allowing you to bypass 64k connection limitation and achieve 192k connections.
I have a server with 4 ip addresses and four clients that each register their ip address with a service. Each client runs the same ruby script that connects via a TCP socket to the service.
The problem I have is all four scripts are connecting via the same IP address so three are receiving authorisation errors because they have the wrong ip address.
Is it possible to tell the TCP client to use a specific ip address?
I set different DNS servers on my wireless router from 192.168.1.1 but when I check for which DNS servers are being used, it returns 192.168.1.1. Why does it not return the DNS addresses I set on the router?
Thanks
Those are the DNS servers the router uses. It publishes itself as a DNS server into your LAN.
Although most of the hosts have ipv6 address now, there are still some hosts that only have ipv4. In my LAN, connections using ipv4 will cost money, while connections using ipv6 is free. I want to implement a proxy to convert ipv4 and ipv6 request, so that I can connect to ipv4 host free.
Is it possible to implement that? And is there any available software?
This largely depends on the devices, services/protocols and the direction you want to connect in.
NAT64/DNS64
With NAT64/DNS64 you can let IPv6-only clients connect to IPv4-only servers. The system looks up the name of the server it wants to connect to using the DNS64 server. If the DNS64 server sees that only an IPv4 address is available it will replace the IPv4 address of the server with a special IPv6 address in which it has encoded the original IPv4 address. When the IPv6-only system connects to that IPv6 address the NAT64 router knows that the intention is to connect to the IPv4 address encoded in the IPv6 address and it will set up a NAT session to that IPv4 address. The NAT64 box needs to have both an IPv4 and IPv6 address to be able to do this.
HTTP Proxy
If you only want to support HTTP and similar protocols then you might be able to use an HTTP proxy server. It will need to have both an IPv4 and IPv6 address, and your applications/devices need to support using a proxy server. It will work both for IPv4-only clients and IPv6-only servers and vice-versa.
SOCKS5
A SOCKS5 proxy server can also be used in the same way that an HTTP proxy server can be used, but with a wider variety of protocols. Your clients need to support it though.
Other
There are other more application-specific ways to proxy between IPv4 and IPv6. The few mentioned above are just to give you an idea of common ones.