Let me try to rephrase the whole question as it was not very clear the first time.
I need to understand and workout port forwarding. I have an ec2 instance running behind a proxy server. I need to telnet from my ec2 instance to a server outside, 'in internet' through port (let's say) 1919 . In security groups I have allowed tcp
traffic on port 1919 from my ec2
instance to the proxy and back and from proxy to the remote server.
To be able to telnet from my ec2 instance to remote server, i think i will have to port forward 1919 in proxy to be able to get to the remote server. I tried it with
iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 9093 -j DNAT --to *ipaddofEC2*:1919
iptables -A FORWARD -p tcp -d --dport 1919 -j ACCEPT
In my squid I have :
acl servicebus_port_9093 port 1919
and
http_access allow allowed_source_hosts allowed_messaging_sites servicebus_port_9093
and
acl allowed_messaging_sites dstdomain .servicebus.windows.net
(remote host's url finishes with windows.net)
Still I have not been able to telnet from my ec2
to remote server.
Ps. ip forwarding is on in proxy and I tried to tcpdump in proxy while trying to telnet from my ec2 instance to remote server but I get nothing. (I dont know much about tcpdump)
I get timeout error.
-
not completely clear to me, by the way it looks more a firewall issue than a proxy one. i would suggest tcpdump on your "xyz port" to better understand what's going on.– realpclaudioCommented Feb 11, 2020 at 22:50
-
in short, i want to telnet from my ec2 to a remote host but i cannot, as every traffic has to pass from the proxy. I can telnet proxy and proxy can telnet the remote host.– RizCommented Feb 11, 2020 at 23:12
-
is that proxy in transparent or forwarding mode? you had to explicitly configure that client to use it?– realpclaudioCommented Feb 11, 2020 at 23:14
-
its a transparent proxy. yes ,it was configured by us for the client– RizCommented Feb 11, 2020 at 23:19
-
so you got a firewall onboard, or at gateway side (can't tell about your network), that is redirecting web ports to squid. this mean that if you telnet ports not related to web (pick one) it succeeds, right?– realpclaudioCommented Feb 11, 2020 at 23:22
|
Show 7 more comments
1 Answer
The protocol used was not tcp but a 'special' protocol that's why I was not able to tunnel the traffic through. The port was used by Kafka and it's their own protocol as far as I know, which is not supported by squid.