AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / computer / 问题 / 1594242
Accepted
Alex
Alex
Asked: 2020-10-15 05:15:23 +0800 CST2020-10-15 05:15:23 +0800 CST 2020-10-15 05:15:23 +0800 CST

如何在不使用积极模式的情况下在 FritzBox 和 pfsense 之间创建 IPsec 隧道?

  • 772

我已经成功地在我的本地 FritzBox 7590 和我的办公室之间创建了一个 IPSEC 隧道,它正在运行一个带有 pfsense 2.4.5-RELEASE-p1 和 coreboot 固件 v4.11.0.6 的 pfsense 硬件防火墙 (APU2)。

但是,隧道仅在启用积极模式的情况下工作,这会产生以下 pfsense 日志条目:

/rc.newipsecdns:警告:设置 i_dont_care_about_security_and_use_aggressive_mode_psk 选项,因为第 1 阶段是使用具有预共享密钥的激进模式配置的。这不是一个安全的配置。

如何在这些位置之间创建安全隧道?

security tunnel
  • 1 1 个回答
  • 1311 Views

1 个回答

  • Voted
  1. Best Answer
    Alex
    2020-10-15T05:15:23+08:002020-10-15T05:15:23+08:00

    这已经困扰了我 2 年,我最近才发现如何在没有积极模式的情况下进行连接。我在这里发布我的答案,以防其他人有同样的问题。我发现的几乎所有指南都使用积极模式,如果配置正确,则没有必要。

    以下参数适用:

    • FritzBox 有一个动态的 ip 地址并注册到 myFritz.net。您将获得使用最新 IP 地址更新的 DynDNS 名称。
    • pfsense 有一个静态的公共 IP 地址。如果不是这种情况,您将需要使用另一个 DynDNS 服务来广播 pfsense IP
    • 我建议将 pfsense 和 FritzBox 更新到最新的固件,作为支持现代密码散列的一种手段
    • 为了简化使用两个远程位置测试 IPSEC 隧道,首先使用 OpenVPN 配置您的 pfsense,这样您就可以从其他位置配置 pfsense
    • FritzBox LAN 配置为192.168.178.0,pfsense LAN 配置为192.168.10.0. 这可以更改,但两个 LAN 不能相同。

    禁用积极模式的关键是通过导入加载 VPN 配置。FritzBox 界面隐藏了大部分重要的东西,这就是为什么只有在使用导入功能时才能禁用积极模式。

    FritzBox 配置

    这是我的ipsec-fritzbox.cfg,我将在下面解释参数和 pfsense 配置:

    vpncfg {
    connections {
      enabled = yes;
      conn_type = conntype_lan;
      name = "FritzBox-pfsense IPSEC"; // Name of Connection
      always_renew = yes; // Always connect
      reject_not_encrypted = no;
      dont_filter_netbios = yes;
      localip = 0.0.0.0;
      local_virtualip = 0.0.0.0;
      remoteip = xxx.xxx.xxx.xxx; // Static IP of pfsense
      remote_virtualip = 0.0.0.0;
      localid {
        fqdn = "xxx.myfritz.net"; // dyndns name of FritzBox
        }
      remoteid {
        ipaddr = xxx.xxx.xxx.xxx; // Static IP of pfsense
        }
      mode = phase1_mode_idp;
      phase1ss = "dh14/aes/sha"; //phase one hashing algorithms to use
      keytype = connkeytype_pre_shared;
      key = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; //strong pre-shared key
      cert_do_server_auth = no;
      use_nat_t = no;
      use_xauth = no;
      use_cfgmode = no;
      phase2localid {
        ipnet {
          ipaddr = 192.168.178.0; //Local network of FritzBox
          mask = 255.255.255.0; //Local subnet FritzBox
          }
        }
      phase2remoteid {
        ipnet {
          ipaddr = 192.168.10.0; //Remote network of Pfsense
          mask = 255.255.255.0; //Remote subnet Pfsense
          }
        }
      phase2ss = "esp-aes256-3des-sha/ah-no/comp-lzs-no/pfs"; //phase two hashing algorithms to use
      accesslist = "permit ip any 192.168.10.0 255.255.255.0"; //firewall settings for pfsense lan
      }
      ike_forward_rules = "udp 0.0.0.0:500 0.0.0.0:500",
                          "udp 0.0.0.0:4500 0.0.0.0:4500";
    }
    

    pfsense 配置

    在 pfsense Web 界面中,转到 VPN > IPsec 并单击添加

    阶段1

    一般信息

    远程网关:输入 FritzBox 的 DynDNS 名称

    在此处输入图像描述

    第一阶段提案(认证)

    对等标识符:输入 FritzBox 预共享密钥的 DynDNS 名称:输入强静态密钥。协商模式:主要(非攻击性)我的标识符:在 DynDNS 的情况下,使用专有名称;否则为 pfsense 的静态公共 IP

    在此处输入图像描述

    第一阶段提案(加密算法)

    您将需要使用现代加密算法。下面我使用了 256 位的 AES 和 SHA1(哈希)和 DH Group 14(2048 位)。DH14 只为我工作,寿命为 3600(不是 28800)。

    这将导致以下 phase2ss 条目ipsec-fritzbox.cfg:

    mode = phase1_mode_idp;
    phase1ss = "dh14/aes/sha";
    

    在此处输入图像描述

    高级选项

    我在这里没有改变任何东西。

    在此处输入图像描述

    阶段2

    保存设置并使用以下配置添加第 2 阶段条目。

    一般信息

    在此处输入图像描述

    第 2 阶段提案(SA/密钥交换)

    我使用 ESP 与 AES(256 位)和 3DES(加密)和 SHA1(哈希),生命周期为 3600 秒。这将导致以下 phase2ss 条目ipsec-fritzbox.cfg:

    phase2ss = "esp-aes256-3des-sha/ah-no/comp-lzs-no/pfs";
    

    在此处输入图像描述

    高级配置

    在此处添加 FritzBox 的本地 IP。

    在此处输入图像描述

    检查连接

    配置完成后,您将在 pfsense 中的 Status > IPsec 下看到状态:

    在此处输入图像描述

    在 FritzBox 中,查看 System 下的 Log Enties。由于 FritzBox 重新连接到新 IP,初始连接可能会失败,该新 IP 需要广播到 DynDNS 服务。几分钟后,主仪表板中的连接状态应变为绿色。

    这对我有用了一段时间。任何意见或改进表示赞赏!

    问题:

    对于任何问题,请检查Status > System Logs > IPsec,它为您提供来自 pfsense ipsec 的实时日志记录。

    For example, I had problems with getting dh14 to work (instead of dh1 or dh2). I could solve this by using Sha1 as hashing (instead of sha512), checking 3des (in addition to aes) and reducing the lifetime to 3600 (instead of 28800).

    Also note that this setup gets increasingly complicated if both sites work on DynDNS. In fact, mode = phase1_mode_idp; entry is only possible with a static remote site.

    Caveats:

    If anyone gets dh14 to work with Sha512 hashing (instead of sha1), and without 3des, please add a comment. According to the FritzBox docs, Sha512 or Sha256 should be possible, but no combination for using a sha other than sha1 in phase 1 or 2 worked for me. Also, I had to leave 3des for encryption enabled (proposal 2), otherwise I would not be able to use dh14 (without 3des worked only when using dh1 or dh2).

    据我所知,FritzBox 仍然只支持 IKEv1。

    阅读文档:

    以下两个文档条目应该提供一些额外的知识:

    • FritzBox IPsec
    • Pfsense IPsec 故障排除
    • 0

相关问题

  • VirtualBox 下载被阻止并显示安全警告

  • 查找通过网络上的“c$”访问我的文件夹的日志会话

  • Wifi IDS——监控模式与混杂模式——查看东西方流量

  • 删除子块

  • 校验和失败——Fedora 29 或旋转 KDE Plasma

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何减少“vmmem”进程的消耗?

    • 11 个回答
  • Marko Smith

    从 Microsoft Stream 下载视频

    • 4 个回答
  • Marko Smith

    Google Chrome DevTools 无法解析 SourceMap:chrome-extension

    • 6 个回答
  • Marko Smith

    Windows 照片查看器因为内存不足而无法运行?

    • 5 个回答
  • Marko Smith

    支持结束后如何激活 WindowsXP?

    • 6 个回答
  • Marko Smith

    远程桌面间歇性冻结

    • 7 个回答
  • Marko Smith

    子网掩码 /32 是什么意思?

    • 6 个回答
  • Marko Smith

    鼠标指针在 Windows 中按下的箭头键上移动?

    • 1 个回答
  • Marko Smith

    VirtualBox 无法以 VERR_NEM_VM_CREATE_FAILED 启动

    • 8 个回答
  • Marko Smith

    应用程序不会出现在 MacBook 的摄像头和麦克风隐私设置中

    • 5 个回答
  • Martin Hope
    CiaranWelsh 如何减少“vmmem”进程的消耗? 2020-06-10 02:06:58 +0800 CST
  • Martin Hope
    Jim Windows 10 搜索未加载,显示空白窗口 2020-02-06 03:28:26 +0800 CST
  • Martin Hope
    v15 为什么通过电缆(同轴电缆)的千兆位/秒 Internet 连接不能像光纤一样提供对称速度? 2020-01-25 08:53:31 +0800 CST
  • Martin Hope
    fixer1234 “HTTPS Everywhere”仍然相关吗? 2019-10-27 18:06:25 +0800 CST
  • Martin Hope
    andre_ss6 远程桌面间歇性冻结 2019-09-11 12:56:40 +0800 CST
  • Martin Hope
    Riley Carney 为什么在 URL 后面加一个点会删除登录信息? 2019-08-06 10:59:24 +0800 CST
  • Martin Hope
    zdimension 鼠标指针在 Windows 中按下的箭头键上移动? 2019-08-04 06:39:57 +0800 CST
  • Martin Hope
    jonsca 我所有的 Firefox 附加组件突然被禁用了,我该如何重新启用它们? 2019-05-04 17:58:52 +0800 CST
  • Martin Hope
    MCK 是否可以使用文本创建二维码? 2019-04-02 06:32:14 +0800 CST
  • Martin Hope
    SoniEx2 更改 git init 默认分支名称 2019-04-01 06:16:56 +0800 CST

热门标签

windows-10 linux windows microsoft-excel networking ubuntu worksheet-function bash command-line hard-drive

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve