title: Kafka Listener is not working! It is isolated in intranet
body: <p>My Kafka node is hosted in Google Cloud Dataproc. However, we realized that the Kafka installed through default initialization script is set up in such a way that it only allows intranet access. It is completely isolated from the outside world. The producer outside the google cloud network can't publish the message to Kafka and the Kafka message can't chain to its extranet subscriber.</p>
  <p><strong>Remark</strong></p>
  <p>I have whitelisted the producer IP</p>
  <p>After read thru the other StackOverflow, blog post and documentation. I think it could due to <code>advertised.listeners</code> parts of <code>Socket Server Settings</code> in <code>/usr/lib/kafka/server.properties</code>.</p>
  <p><strong>First solution</strong></p>
  <blockquote>
  <p>I added <code>advertised.listeners=PLAINTEXT://[External_IP]:19092</code></p>
  <p>then <code>sudo /etc/init.d/kafka-server restart</code></p>
  </blockquote>
  <p><a href="https://i.stack.imgur.com/X8DIq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/X8DIq.png" alt="Kafka Restart Successfully" /></a></p>
  <p><strong>OUTCOME</strong></p>
  <p>However, when I trying to Kafkacat or telnet, it always failed. I also tested advertised.listeners with  various port
  <a href="https://i.stack.imgur.com/4fESx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4fESx.png" alt="Ping Success, telnet and kafkacat failed" /></a></p>
  <p><strong>Second solution</strong> from <a href="https://rmoff.net/2018/08/02/kafka-listeners-explained/" rel="nofollow noreferrer">https://rmoff.net/2018/08/02/kafka-listeners-explained/</a>
  <a href="https://i.stack.imgur.com/7pKBs.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7pKBs.png" alt="enter image description here" /></a></p>
  <pre><code>############################# Server Basics #############################
  
  # The id of the broker. This must be set to a unique integer for each broker.
  broker.id=0
  
  ############################# Socket Server Settings #############################
  
  # The address the socket server listens on. It will get the value returned from
  # java.net.InetAddress.getCanonicalHostName() if not configured.
  #   FORMAT:
  #     listeners = listener_name://host_name:port
  #   EXAMPLE:
  #     listeners = PLAINTEXT://your.host.name:9092
  #
  
  # Hostname and port the broker will advertise to producers and consumers. If not set,
  # it uses the value for &quot;listeners&quot; if configured.  Otherwise, it will use the value
  # returned from java.net.InetAddress.getCanonicalHostName().
  
  
  -&gt;&gt;&gt;&gt;&gt;&gt;&gt; I added below listener config according to https://rmoff.net/2018/08/02/kafka-listeners-explained/
  
  listeners=INTERNAL://0.0.0.0:9092,EXTERNAL://0.0.0.0:19092
  listener.security.protocol.map=INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT
  advertised.listeners=EXTERNAL://[External_IP]:19092,INTERNAL://[Internal_IP]:9092
  inter.broker.listener.name=INTERNAL
  </code></pre>
  <p><strong>OUTCOME</strong></p>
  <p>It's the same result as above, Not Working.</p>
  <p><strong>Firewall Rules</strong> [Updated]</p>
  <p>This is my current firewall rules config. Am I doing a mistake?
  <a href="https://i.stack.imgur.com/RN4FI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RN4FI.png" alt="Firewall Rules" /></a></p>
  <p>Can anyone help me to resolve this?</p>