2017-06-21 5 views
-1

現在、私はfirewall-cmdでCentOSのポート転送をセットアップしようとしています。firewall-cmd centosポート転送が機能していないようですか?

現在、私のボックスには2つのインタフェースがあります:eth0、eth1。

eth0の内部ネットワークを表し、パブリック(デフォルト)=ゾーン内にある、

eth1が外部のネットワークを表し、ゾーン内=外部

現在eth1には、ルータを含む別のネットワークに接続されていますインターネット。

私の外部ファイアウォールが以下のようになります。

firewall-cmd --zone=external --add-forward-port=port=22:proto=tcp:toport=22:toaddr=192.168.179.8 

は、しかし、両方のルールが動作しません、どちらも1194年もポートと1:私もポート22のルールを持っていた

external (active) 
    target: default 
    icmp-block-inversion: no 
    interfaces: eth1 
    sources: 192.168.178.0/24 
    services: dhcpv6-client http https ssh 
    ports: 1194/udp 
    protocols: 
    masquerade: yes 
    forward-ports: port=1194:proto=udp:toport=:toaddr=192.168.179.4 
    sourceports: 
    icmp-blocks: 
    rich rules: 

22. ルータからのポートフォワーディングがマシンに動作しているかどうかを実際にテストしました。実際には、他のSSHマシンを指すようにHAPROXYを設定すると

frontend sshd 
    bind 192.168.178.254:22 
    mode tcp 
    default_backend ssh 
    timeout client 1h 

backend ssh 
    mode tcp 
    server static 192.168.179.8:22 check 

ルールを削除してport=22ルールに接続すると、接続できます。 私は実際に許容されるselinuxルールを実行します。

パブリックゾーンは、次のようになります。

public (active) 
    target: default 
    icmp-block-inversion: no 
    interfaces: eth0 
    sources: 192.168.179.0/24 
    services: dhcpv6-client http https ssh 
    ports: 7583/tcp 
    protocols: 
    masquerade: no 
    forward-ports: 
    sourceports: 
    icmp-blocks: 
    rich rules: 

は私が欠けているものはありますか? 私はiptablesでも動作させようとしましたが、動作しませんでした。

sysctl net.ipv4.ip_forward戻りnet.ipv4.ip_forward = 1

のLinuxボックスはどちらもネットワークのデフォルトルータではありません。どちらにも他のルータがあります。

答えて

1

マスカレードは、両方のネットワークのためにオンにする必要がありますように見える:

firewall-cmd --zone=external --permanent --add-masquerade 
firewall-cmd --zone=public --permanent --add-masquerade 
firewall-cmd --reload 
関連する問題