diff --git a/content/post/2026/2026-05-23-openwrt-做纯-ap-模式笔记-cudy-tr3000-中兴-f50/image-1.png b/content/post/2026/2026-05-23-openwrt-做纯-ap-模式笔记-cudy-tr3000-中兴-f50/image-1.png new file mode 100644 index 00000000..0e2a0a2e Binary files /dev/null and b/content/post/2026/2026-05-23-openwrt-做纯-ap-模式笔记-cudy-tr3000-中兴-f50/image-1.png differ diff --git a/content/post/2026/2026-05-23-openwrt-做纯-ap-模式笔记-cudy-tr3000-中兴-f50/image-2.png b/content/post/2026/2026-05-23-openwrt-做纯-ap-模式笔记-cudy-tr3000-中兴-f50/image-2.png new file mode 100644 index 00000000..c69c14b6 Binary files /dev/null and b/content/post/2026/2026-05-23-openwrt-做纯-ap-模式笔记-cudy-tr3000-中兴-f50/image-2.png differ diff --git a/content/post/2026/2026-05-23-openwrt-做纯-ap-模式笔记-cudy-tr3000-中兴-f50/image-3.png b/content/post/2026/2026-05-23-openwrt-做纯-ap-模式笔记-cudy-tr3000-中兴-f50/image-3.png new file mode 100644 index 00000000..daade7ba Binary files /dev/null and b/content/post/2026/2026-05-23-openwrt-做纯-ap-模式笔记-cudy-tr3000-中兴-f50/image-3.png differ diff --git a/content/post/2026/2026-05-23-openwrt-做纯-ap-模式笔记-cudy-tr3000-中兴-f50/image-4.png b/content/post/2026/2026-05-23-openwrt-做纯-ap-模式笔记-cudy-tr3000-中兴-f50/image-4.png new file mode 100644 index 00000000..7f3afbe3 Binary files /dev/null and b/content/post/2026/2026-05-23-openwrt-做纯-ap-模式笔记-cudy-tr3000-中兴-f50/image-4.png differ diff --git a/content/post/2026/2026-05-23-openwrt-做纯-ap-模式笔记-cudy-tr3000-中兴-f50/image-5.png b/content/post/2026/2026-05-23-openwrt-做纯-ap-模式笔记-cudy-tr3000-中兴-f50/image-5.png new file mode 100644 index 00000000..35009183 Binary files /dev/null and b/content/post/2026/2026-05-23-openwrt-做纯-ap-模式笔记-cudy-tr3000-中兴-f50/image-5.png differ diff --git a/content/post/2026/2026-05-23-openwrt-做纯-ap-模式笔记-cudy-tr3000-中兴-f50/image-6.png b/content/post/2026/2026-05-23-openwrt-做纯-ap-模式笔记-cudy-tr3000-中兴-f50/image-6.png new file mode 100644 index 00000000..aafe528a Binary files /dev/null and b/content/post/2026/2026-05-23-openwrt-做纯-ap-模式笔记-cudy-tr3000-中兴-f50/image-6.png differ diff --git a/content/post/2026/2026-05-23-openwrt-做纯-ap-模式笔记-cudy-tr3000-中兴-f50/image-7.png b/content/post/2026/2026-05-23-openwrt-做纯-ap-模式笔记-cudy-tr3000-中兴-f50/image-7.png new file mode 100644 index 00000000..0f0c5fff Binary files /dev/null and b/content/post/2026/2026-05-23-openwrt-做纯-ap-模式笔记-cudy-tr3000-中兴-f50/image-7.png differ diff --git a/content/post/2026/2026-05-23-openwrt-做纯-ap-模式笔记-cudy-tr3000-中兴-f50/image-8.png b/content/post/2026/2026-05-23-openwrt-做纯-ap-模式笔记-cudy-tr3000-中兴-f50/image-8.png new file mode 100644 index 00000000..9e079a87 Binary files /dev/null and b/content/post/2026/2026-05-23-openwrt-做纯-ap-模式笔记-cudy-tr3000-中兴-f50/image-8.png differ diff --git a/content/post/2026/2026-05-23-openwrt-做纯-ap-模式笔记-cudy-tr3000-中兴-f50/image.png b/content/post/2026/2026-05-23-openwrt-做纯-ap-模式笔记-cudy-tr3000-中兴-f50/image.png new file mode 100644 index 00000000..18bfba69 Binary files /dev/null and b/content/post/2026/2026-05-23-openwrt-做纯-ap-模式笔记-cudy-tr3000-中兴-f50/image.png differ diff --git a/content/post/2026/2026-05-23-openwrt-做纯-ap-模式笔记-cudy-tr3000-中兴-f50/index.md b/content/post/2026/2026-05-23-openwrt-做纯-ap-模式笔记-cudy-tr3000-中兴-f50/index.md new file mode 100644 index 00000000..e7b8f3cf --- /dev/null +++ b/content/post/2026/2026-05-23-openwrt-做纯-ap-模式笔记-cudy-tr3000-中兴-f50/index.md @@ -0,0 +1,131 @@ +--- +title: OpenWrt 路由器改纯 AP 模式记录(Cudy TR3000 + 中兴 F50) +date: '2026-05-23T00:00:00.000Z' +slug: '202605231938' +draft: false +categories: + - 技术 +tags: [] +author: 小赵 +layout: post +--- + +## 起因 + +今天打开 Chrome 的时候,发现所有网站都打不开了。起初以为是手机欠费,就续了一个月的月租。 + +重启随身 Wi-Fi 后还是上不了网,查了一圈,最终定位到是 IP 冲突导致的问题。 + +我的设备是中兴 F50 和 Cudy TR3000 路由器。之前写过一篇文章介绍过:[https://usj.cc/202603111244.html] + +我一直用的是二级路由模式:F50 做主路由,TR3000 做下级路由。 + +查了资料之后,决定改成 AP 模式。原因有两个: + +第一,可以减少一次 NAT,延迟更低。二级路由模式是设备到下级路由做一次 NAT,再到主路由做一次 NAT,双重 NAT。 + +AP 模式下设备直接到主路由做一次 NAT 就行。 + +第二,由主路由统一管理 DHCP,这样就不会出现设备撞 IP 导致上不了网的问题。 + +OpenWrt 界面不算友好,折腾一圈总算搞定了。下面记录过程和原理,方便以后自查,也给需要的朋友参考。 + +## 我的设备网络环境 + +主路由是中兴 F50,默认 IP 是 192.168.0.1。Cudy TR3000 刷了 OpenWrt,默认 IP 是 192.168.10.1。 + +两个设备不在同一个网段,直接改 AP 模式会访问不到 TR3000。所以需要先把 TR3000 的 IP 改成和主路由同网段,比如 192.168.0.2。 + +主路由的 DHCP 地址池我也改了一下,范围设为 192.168.0.100 到 192.168.0.200。这样其他设备拿到的 IP 都在这个区间里,不会跟 TR3000 的 192.168.0.2 冲突。 + +## 配置步骤 + +### 第一步:修改主路由 DHCP 地址池 + +进入 F50 后台 192.168.0.1,默认账号密码一般是 admin。找到 DHCP 设置,把 IP 池范围改成 192.168.0.100 - 192.168.0.200。 + +![高级设置](image.png) + +![DHCP设置](image-1.png) + +### 第二步:修改 TR3000 的管理 IP + +进入 TR3000 后台,默认地址是 192.168.10.1。输入你的管理账号和密码。 + +进入接口设置,删除所有 WAN 口,只保留 LAN 口。然后把网线插到 TR3000 的 LAN 口,连接电脑。 + +![接口设置](image-2.png) + +点击 LAN 口的常规设置,修改几个参数: + +![LAN设置](image-3.png) + +把 IPv4 地址改成 192.168.0.2,网关改成 192.168.0.1,DNS 也改成 192.168.0.1。 + +保存之后,需要用 192.168.0.2 重新登录 OpenWrt,这样设置才会生效。 + +### 第三步:关闭 TR3000 的 DHCP + +进入接口设置,找到 LAN 口的 DHCP 服务器选项卡,勾选「忽略此接口」,然后保存应用。 + +![关闭DHCP](image-4.png) + +这一步很关键,不关的话 TR3000 还是会给设备乱发 IP。 + +### 第四步:删除 WAN 口并桥接所有网口 + +删除 WAN:网络 -> 接口,找到 WAN 直接删掉。 + +![](image-6.png) + +桥接 LAN:编辑 LAN 接口,进入物理设置,勾选「桥接接口」,然后把 eth0、eth1 这些以太网适配器全部勾上。 + +![](image-7.png) + +这样所有网口都变成了交换机的 LAN 口,插哪个都能用。 + +### 第五步:接线 + +中兴 F50 的 LAN 口用网线接到 Cudy TR3000 的 LAN 口。不要插 WAN 口。 + +### 第六步:验证 + +重启一下 TR3000,然后用手机连它的 Wi-Fi,看看手机拿到的 IP。 + +![验证结果](image-5.png) + +我的手机拿到的是 192.168.0.172,在 100-200 范围内,说明 DHCP 已经由主路由统一分配,配置成功了。 + +## 为什么要改 AP 模式? + +OpenWrt 默认是路由器模式,直接接到主路由会有两个问题。 + +第一个是 DHCP 冲突。OpenWrt 默认开了 DHCP 服务器,会和主路由抢着发 IP。设备如果拿到 OpenWrt 发的 IP,网关就错了,自然上不了网。 + +第二个是 WAN/LAN 隔离。默认模式下 WAN 口和 LAN 口是分开的,物理连接不对就上不了网。 + +解决思路其实很简单:把 OpenWrt 从路由器模式变成交换机加 AP 的模式。 + +核心就三件事:给 OpenWrt 设一个固定 IP,这个 IP 要在主路由的 DHCP 池之外;关掉它的 DHCP 服务器;删掉 WAN 口,把所有网口桥接到 LAN。 + +## 如果进不去后台了怎么办? + +我也遇到过这种情况,一般是因为电脑和 AP 不在同一个网段。 + +解决方法:拔掉 cudy tr3000 和F50之间的网线,电脑用网线直接插 cudy tr3000 的 LAN 口。 + +然后手动给电脑设一个同网段的 IP,比如 192.168.0.88,子网掩码 255.255.255.0,网关如图所示。 + +![](image-8.png) + +浏览器访问 192.168.0.2 就能进去了。 + +## 几个核心知识点 + +DHCP 就是负责自动分配 IP 的设备,一个网络里只能有一个,就是主路由。AP 必须关掉自己的 DHCP。 + +DHCP 地址池是主路由用来分配 IP 的范围。AP 的静态 IP 必须在这个池子外面,否则会被主路由发给其他设备,造成冲突。 + +桥接就是把多个网口合并成一个交换机组,所有口都能互相通信。AP 模式下所有口都应该桥接到 LAN。 + +WAN 口在路由模式下用来连上一级网络,AP 模式下用不着,删掉省事。 diff --git a/write/src/components/PostEditor.tsx b/write/src/components/PostEditor.tsx index 431215b9..ed9bb50e 100644 --- a/write/src/components/PostEditor.tsx +++ b/write/src/components/PostEditor.tsx @@ -84,6 +84,26 @@ export default function PostEditor({ initialData, isEditing }: PostEditorProps) } }; + const handlePaste = (e: React.ClipboardEvent) => { + const text = e.clipboardData.getData("text/plain"); + if (!text) return; + + e.preventDefault(); + const el = e.currentTarget; + const start = el.selectionStart; + const end = el.selectionEnd; + const nextContent = content.slice(0, start) + text + content.slice(end); + const nextCursor = start + text.length; + + setContent(nextContent); + setSelectedText(""); + requestAnimationFrame(() => { + el.focus(); + el.selectionStart = nextCursor; + el.selectionEnd = nextCursor; + }); + }; + const handleImageUpload = async (e: React.ChangeEvent) => { const file = e.target.files?.[0]; if (!file) return; @@ -305,6 +325,7 @@ export default function PostEditor({ initialData, isEditing }: PostEditorProps) ref={textareaRef} value={content} onChange={(e) => setContent(e.target.value)} + onPaste={handlePaste} onSelect={handleSelectionChange} onKeyUp={handleSelectionChange} onMouseUp={handleSelectionChange}