kstm-su / ictsc_2020_kstm

0 stars 0 forks source link

FTPなんも分からん #3

Closed Noiri closed 3 years ago

Noiri commented 3 years ago

概要 あなたが所属している会社で後輩が「FTPなんもわからん」と嘆いています。

NAT配下でのFTPサーバの検証をしているんですが、FileZillaからどうしても接続できないんです。先輩助けてください。

後輩を助けてあげてください。

前提条件 FileZillaがインストールされた後輩の検証環境にはVNCで接続できる FTP ServerはRouterのNAT下におり、踏み台サーバからは直接アクセスできない FTP ServerはRouterを踏み台にしてSSHできる FileZillaで入力するFTPサーバのアクセス情報は下記の通り

初期状態 FileZillaでFTP ServerにFTP接続すると、下記のようにエラーが発生する Error: The data connection could not be established: ENCONNREFUSED - Connection refused by server 終了状態 VNC Server上のFileZillaを用いて、FTP ServerにFTP接続し、ファイルのアップロード及びダウンロードが実行できる 適切な問題の原因と解決法が回答に記載されている

Noiri commented 3 years ago

routerの設定

user@router:~$ show configuration
interfaces {
    ethernet eth0 {
        address 192.168.10.1/24
    }
    ethernet eth1 {
        address 172.16.0.1/24
    }
    loopback lo {
    }
}
nat {
    destination {
        rule 1 {
            destination {
                port 21,1024-1124
            }
            inbound-interface eth0
            protocol tcp
            translation {
                address 172.16.0.2
            }
        }
    }
    source {
        rule 1 {
            outbound-interface eth0
            source {
                address 172.16.0.0/24
            }
            translation {
                address masquerade
            }
        }
    }
}
protocols {
    static {
        route 0.0.0.0/0 {
            next-hop 192.168.10.126 {
            }
        }
    }
}
service {
    ssh {
    }
}
system {
    config-management {
        commit-revisions 100
    }
    console {
        device ttyS0 {
        }
    }
    host-name router
    login {
        user ictsc {
            authentication {
                encrypted-password ****************
                public-keys ictsc2020-final {
                    key ****************
                    type ssh-rsa
                }
            }
        }
        user user {
            authentication {
                encrypted-password ****************
            }
        }
    }
    name-server 8.8.8.8
    ntp {
        server 0.pool.ntp.org {
        }
        server 1.pool.ntp.org {
        }
        server 2.pool.ntp.org {
        }
    }
    syslog {
        global {
            facility all {
                level info
            }
            facility protocols {
                level debug
            }
        }
    }
}
Noiri commented 3 years ago

お世話になっております、チームkstmの入野です。

不具合の理由としましては、ipv6での適切な設定が行われていないのに、vsftpがipv6をリッスンしていたからだと考えられます。つきましては、ftpサーバにある/etc/vsftpd.conf

listen=YES
listen_ipv6=NO

としてから、vsftpを再起動して設定を反映させることで解決できます。

Noiri commented 3 years ago

お世話になっております、チームkstmの入野です。

不具合の理由として、iv6の適切な設定が行われていないのにもかかわらず、vsftpがipv6をリッスンしていたからだと考えられます。 つきましては、ipv4をリッスンするように設定を変更する必要があります。

変更内容としては、/etc/vsftpd.confについて、