跳转到内容
搜索文档

Yamaha RTX 路由器

最后更新 查看 MarkdownAgent 设置

本教程介绍了如何配置 Yamaha RTX840 和 RTX1300 系列路由器,以通过 IPsec 隧道连接到 Cloudflare WAN(前称 Magic WAN)。

测试环境

这些配置在具有以下固件版本的 Yamaha RTX840 和 RTX1300 系列上进行了测试:

  • RTX840 系列:23.02.02
  • RTX1300 系列:23.00.17

Cloudflare WAN 配置

您需要通过 Cloudflare 仪表板向您的 Cloudflare 账户添加 IPsec 隧道和静态路由。

在继续之前,请确保分配给您的账户具有 anycast IP。您可以在 Cloudflare 仪表板中的 Address Space(地址空间) > 租用的 IP 下找到它们。

IPsec 隧道

  1. 按照添加隧道说明创建所需的 IPsec 隧道。创建 IPsec 隧道时,请确保定义以下设置:

    • Tunnel name(隧道名称):输入您的隧道名称。在本例中,它是 RTX840-vpn01
    • Interface address(接口地址):输入 IPsec 隧道 Cloudflare 侧的内部隧道 IP。在本例中,它是 172.30.223.2/31
    • Customer endpoint(客户端点):输入 RTX 路由器的 WAN IP 地址。在我们的示例中,它是 194.xx.xx.xx。这是您从 ISP 获取的用于互联网服务的固定公网 IPv4 地址。
    • Cloudflare endpoint(Cloudflare 端点):分配给您的账户的 Cloudflare anycast IP 地址之一。
    • Health check rate(健康检查频率)Medium
    • Health check type(运行状况检查类型)Request
    • Health check direction(健康检查方向)Bidirectional
    • Health check target(运行状况检查目标)Default
    • Pre-shared key(预共享密钥):选择 Use my own pre-shared key(使用我自己的预共享密钥) 并粘贴您自己的安全密钥。
    • Replay protection(重放保护):不要勾选该复选框,以保持其禁用状态。
  2. 创建隧道后,Cloudflare 仪表板将加载为您的账户设置的隧道列表。选择您刚刚创建 the IPsec 隧道,然后检查以下设置:

    • FQDN ID(FQDN ID):复制并保存此 ID。在 RTX 路由器上配置 IPsec 隧道时,您将需要它。

静态路由

通过 IPsec 隧道到达的任何网络都需要静态路由。在我们的示例中,有一个网络:172.16.2.0/24

按照配置静态路由说明创建静态路由(此处未提及的设置可以保留其默认值):

  • Description(描述)RTX840-lan01
  • Prefix(前缀)172.16.2.0/24
  • Tunnel/Next hop(隧道/下一跳)RTX840-vpn01

RTX 路由器配置

使用 CLI 配置这些设置。

路由设置

ip route default gateway tunnel 1

ip route <Cloudflare Anycast IP> gateway <ISP provided Gateway IP>

ip route < ISP's DNS server IP > gateway <ISP provided Gateway IP>

LAN 设置

ip lan1 address 172.16.2.254/24

有线 WAN 设置

ip lan2 address 194.xx.xx.xx/29

ip lan2 nat descriptor 1000

IPsec VPN 主要端设置

tunnel select 1

ipsec tunnel 1

ipsec sa policy 1 1 esp aes256-cbc sha256-hmac anti-replay-check=off

ipsec ike version 1 2

ipsec ike duration ipsec-sa 1 3600

ipsec ike duration isakmp-sa 1 28800

ipsec ike encryption 1 aes256-cbc

ipsec ike group 1 modp2048

ipsec ike hash 1 sha256

ipsec ike keepalive log 1 off

ipsec ike keepalive use 1 on rfc4306 10 6

ipsec ike local address 1 194.xx.xx.xx

ipsec ike log 1 key-info message-info payload-info

ipsec ike local name 1 <Cloudflare Magic IPsec Tunnel FQDN IP> fqdn

ipsec ike pfs 1 on

ipsec ike proposal-limitation 1 on

ipsec ike pre-shared-key 1 text <Pre-shared key>

ipsec ike remote address 1 <Cloudflare Anycast IP>

ipsec ike remote name 1 <Cloudflare Anycast IP> ipv4-addr

ip tunnel address 172.30.223.3/31

ip tunnel tcp mss limit auto

tunnel enable 1

ipsec auto refresh on

! Note: 172.30.223.3/31 is internal tunnel IP on the RTX side.

NAT 设置

nat descriptor type 1000 masquerade

nat descriptor address outer 1000 primary

nat descriptor masquerade static 1000 1 194.xx.xx.xx udp 500

nat descriptor masquerade static 1000 2 194.xx.xx.xx esp

DHCP 设置

dhcp service server

dhcp server rfc2131 compliant except remain-silent

dhcp scope 1 172.16.2.2-172.16.2.191/24

DNS 设置

dns host lan1

dns server select 1 <ISP's DNS server IP> any .

dns private address spoof on

连接测试

在 Yamaha RTX 路由器 CLI 中,您可以运行 show ipsec sashow status tunnel 来检查 IPsec VPN 的状态。

show ipsec sa

Total: isakmp:1 send:1 recv:1

sa    sgw   isakmp        connection    	dir 	 life[s] 	           remote-id

------------------------------------------------------------------------------------------

1     1    	     -     		ike         	  -   	 27384         (Cloudflare Anycast IP)

2     1         1    		 tun[0001]esp  send 	 2185           (Cloudflare Anycast IP)

3     1         1    		 tun[0001]esp  recv 	 2185           (Cloudflare Anycast IP)

show status tunnel 1

TUNNEL[1]:

Description:

Interface type: IPsec

Current status is Online.

from 2025/12/08 13:14:20.

20 minutes 56 seconds  connection.

Maximum Transmission Unit(MTU):

IPv4: 1280 octets

IPv6: 1280 octets

Received:    (IPv4) 171847 packets [58823472 octets]

(IPv6) 0 packet [0 octet]

Transmitted: (IPv4) 154224 packets [19191955 octets]

(IPv6) 0 packet [0 octet]

IKE keepalive:

[Type]: rfc4306

[Status]: OK

[Next send]: 1 sec after

这篇文档对您有帮助吗?