The company's intranet does not provide a R&D server. The development server is on the cloud. The Kafka port on the cloud needs to be exposed to the outside world so that Kafka can be accessed from the company. I have been struggling for a long time and read many articles on the Internet. Some articles are very complicated, but the configuration has not been successful. In the end, I found out that it was actually very simple.
1. Configuration
Only three lines of configuration need to be changed
#server.properties
listeners=PLAINTEXT://:9093
advertised.listeners=PLAINTEXT://<外网ip>:9093
advertised.host.name=<内网ip>
2. Firewall
Set the kafka port to only receive access from the company's IP
>firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="公司ip" port port="9093" protocol="tcp" accept"
# 重置生效
>firewall-cmd --reload