2017-08-19 10 views
0

私は計算VM上のいくつかのポートを開こうとしています。Google Compute Engineで特定のポートを開きます。 [centos7]

例えば、私はfirewall-rules

$ gcloud compute firewall-rules list 
NAME     NETWORK SRC_RANGES RULES       SRC_TAGS TARGET_TAGS 
default-allow-http  default 0.0.0.0/0  tcp:80         http-server 
default-allow-https  default 0.0.0.0/0  tcp:443         https-server 
default-allow-icmp  default 0.0.0.0/0  icmp 
default-allow-internal default 10.128.0.0/9 tcp:0-65535,udp:0-65535,icmp 
default-allow-rdp  default 0.0.0.0/0  tcp:3389 
default-allow-ssh  default 0.0.0.0/0  tcp:22 
test-24284    default 0.0.0.0/0  tcp:24284        test-tcp-open-24284 

でこれを持って、私は私が私のdevのボックスからチェックしようとすると、これは私が今タグ

$ gcloud compute instances describe test-network-opened 
... 
... 
    items: 
    - http-server 
    - https-server 
    - test-tcp-open-24284 
... 
... 

を添付しているとCentOSの7インスタンスを作成しましたポートが開かれているかどうかを確認するには、パブリックIP上のnmapを使用してコンソールでVMを表示します。

$ nmap -p 24284 35.193.xxx.xxx 

Nmap scan report for 169.110.xxx.xx.bc.googleusercontent.com (35.193.xxx.xxx) 
Host is up (0.25s latency). 

PORT  STATE SERVICE 
24284/tcp closed unknown 

Nmap done: 1 IP address (1 host up) scanned in 1.15 seconds 

今では私がiptables規則を使用してチェックしてみましたが、それは

[[email protected] ~]# iptables -S | grep 24284 
[[email protected] ~]# 

何も示さなかったので、私はfirewalldを有効にして開いてみました169.110.xxx.xx

だろう私のVM用の外部NAT IPを打っていますそれを持つポート

[[email protected] ~]# firewall-cmd --zone=public --add-port=24284/tcp --permanent 
success 
[[email protected] ~]# firewall-cmd --reload 
success 
[[email protected] ~]# iptables -S | grep 24284 
[[email protected] ~]# 

私はこれで間違っているのか分かりません。私はSOこの

+1

VM上のポート「24284」で実行されているサービスはありますか? 'netstat -plnt'コマンドの出力をポストしてください。 – Kamran

答えて

1

についてのポートがファイアウォールによって開かれたが、以来、私は」didnの上でこれらの関連質問に言及しましたすでにポートを使用しているアプリケーションを持っています。nmapは、サーバーに到達でき、ファイアウォールされていないことを意味する閉じたポートを示していました。

私はアプリケーションを実行していないので、これは可能性があるとは知らなかった。私を気にしない。

ありがとうございます。

+1

助けてくれてうれしいです。 – Kamran

関連する問題