6.9. Configuring TCP fallback for an IPsec VPN connection


Standard IPsec VPNs can fail on restrictive networks that block the UDP and Encapsulating Security Payload (ESP) protocols. To ensure connectivity in such environments, Libreswan can encapsulate all VPN traffic within a TCP connection.

重要

Encapsulating VPN packets within TCP can reduce throughput and increase latency. For this reason, use TCP encapsulation only as a fallback option or if UDP-based connections are consistently blocked in your environment.

Prerequisites

  • The IPsec connection is configured.

Procedure

  1. Edit the /etc/ipsec.conf file, and make the following changes in the config setup section:

    1. Configure Libreswan to listen on a TCP port:

      listen-tcp=yes
    2. By default, Libreswan listens on port 4500. If you want to use a different port, enter:

      tcp-remoteport=<port_number>
    3. Decide whether TCP should be used as a fallback option if UDP is not available or permanent:

      • As a fallback option, enter:

        enable-tcp=fallback
        retransmit-timeout=5s

        By default, Libreswan waits 60 seconds after a failed attempt to connect by using UDP before retrying the connection over TCP. Lowering the retransmit-timeout value shortens the delay, enabling the fallback protocol to initiate more quickly.

      • As a permanent replacement for UDP, enter:

        enable-tcp=yes
  2. Restart the ipsec service:

    # systemctl restart ipsec
  3. If you configured a TCP port other than the default 4500, open the port in the firewall:

    # firewall-cmd --permanent --add-port=<tcp_port>/tcp
    # firewall-cmd --reload
  4. Repeat the procedure on the peers that use this gateway.
Red Hat logoGithubredditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

Red Hat ドキュメントについて

Red Hat をお使いのお客様が、信頼できるコンテンツが含まれている製品やサービスを活用することで、イノベーションを行い、目標を達成できるようにします。 最新の更新を見る.

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

Theme

© 2026 Red Hat
トップに戻る