光猫扩展交换机
大约 3 分钟
光猫配合 VLAN 交换机
基于光猫集成的二层交换功能,通过 VLAN 交换机实现链路复用与物理端口扩展。
- 物理层:利用光猫剩余 LAN 口作为接入层交换机。
- 链路层:采用支持 VLAN 的交换机进行流量隔离与汇聚,实现单线复用。
- 逻辑层:路由器作为核心网关,负责 VLAN 间的路由转发及内网寻址。
上海联通宽带
管理网址:http://192.168.1.1/cu.html
管理密码:CUAdmin
拨号用户:02101644433
拨号密码:958361
ZXHN F4600U C容器
2.4G:CU_FPD4
5G:CU_FPD4_5G
光猫DHCP:关闭
光猫复用的端口:VLAN绑定,将业务的VLAN ID跟端口的VLAN ID绑成一样的数字。[1029:1029]| 交换机端口位置 | PVID | VLAN 1(内网) | VLAN 1029(拨号) |
|---|---|---|---|
| 复用口(接光猫) | 1 | Untagged | Tagged |
| WAN 口(接路由 WAN) | 1029 | Off | Untagged |
| LAN 口(接路由 LAN) | 1 | Untagged | Off |
[ 光 猫 ]
|
| (单根网线)
|
[ 交换机 ]
| \_________________________________
| |
| (网线 A) | (网线 B)
| |
[ 路由器 WAN ] [ 路由器 LAN ]光猫配合 Padavan
- Padavan 单线复用实现拨号上网加 IPTV 操作记录 - 路人去甲剩丙丁
- Padavan VLAN 设置及单臂路由使用示例 - jessekool
- Padavan 最简单臂路由组网 VLAN 设置 - xytb | 安云网
小娱 Padavan 各端口对应关系:3.4.3.9-099_24-06-1、MediaTek MT7621 SoC
┌───────────────────┐
│ CPU (Port 5) │
└─────────┬─────────┘
┌─────────────────┴─────────────────┐
│ │
┌──────┴──────┐ ┌──────┴──────┐
│ WAN (Port 4)│ │ br0 (Port 6)│
│ (物理接口) │ │ (逻辑网桥/交换)│
└──────┬──────┘ └──────┬──────┘
│ │
(连接外网) ┌──────────────┼──────────────┬──────────────┐
│ │ │ │
┌──────┴──────┐┌──────┴──────┐┌──────┴──────┐┌──────┴──────┐
│ LAN1 (Port0)││ LAN2 (Port1)││ LAN3 (Port2)││ LAN4 (Port3)│
└─────────────┘└─────────────┘└─────────────┘└─────────────┘不同设备的端口对应关系不同,可通过在管理页面 WAN 中设置不同端口的 IPTV,再通过命令 switch vlan dump 1000 查看进行核实。
[XY-C1 /home/root]# switch vlan dump 1000
vid portmap eg-tag eg-con stag ivl fid
1 1111--1 uuuu--u 0 0 1 -
2 ----11- ----uu- 0 0 1 -
PVID:
port pvid prio matrix
0 1 0 1111--1
1 1 0 1111--1
2 1 0 1111--1
3 1 0 1111--1
4 2 0 ----11-
5 2 0 ----11-
6 1 0 1111--1- portmap:可理解为 Padavan 中通过
vid划分的不同网段中各网口相互连通的情况。 - matrix:可理解为 Padavan 各网口相互连通的所有可能性。
端口和寄存器地址对应表:
| 端口 | matrix | trunk |
|---|---|---|
| 0 | 0x2004 | 0x2010 |
| 1 | 0x2104 | 0x2110 |
| 2 | 0x2204 | 0x2210 |
| 3 | 0x2304 | 0x2310 |
| 4 | 0x2404 | 0x2410 |
| 5 | 0x2504 | 0x2510 |
| 6 | 0x2604 | 0x2610 |
# switch vlan set [vid] [portmap] <stag> <eg_con> <eg_tag> - set vlan id and associated member
# 设置 VLAN 1 的 portmap、eg-tag
switch vlan set 1 0111111 0 0 -uuuuuu
--------------------
# switch reg r [offset] - register read from offset
# switch reg w [offset] [value] - register write value to offset
# matrix 需要取反序转 16 进制运算后才能设置(1111001 - 1001111 - 4f)
# 设置 Port0 的 matrix
switch reg w 0x2004 0x00110003
# 设置 Port4 为 Trunk
switch reg w 0x2410 0x81000000
--------------------
# switch pvid [port] [pvid] - set pvid on port 0~6
# 设置 Port6 的 PVID 为 1
switch pvid 6 1Port VLAN Control:
[XY-C1 /home/root]# switch reg r 0x2010
switch reg read offset=2010, value=810000c2
[XY-C1 /home/root]# switch reg r 0x2110
switch reg read offset=2110, value=810000c2
[XY-C1 /home/root]# switch reg r 0x2210
switch reg read offset=2210, value=810000c2
[XY-C1 /home/root]# switch reg r 0x2310
switch reg read offset=2310, value=810000c2
[XY-C1 /home/root]# switch reg r 0x2410
switch reg read offset=2410, value=810000c2
[XY-C1 /home/root]# switch reg r 0x2510
switch reg read offset=2510, value=810000c0
[XY-C1 /home/root]# switch reg r 0x2610
switch reg read offset=2610, value=810000c0| 数值 | 核心状态 | 应用场景 |
|---|---|---|
| 0x81000000 | 不对进出流量做强制标签限制 | 普通 Trunk |
| 0x810000c0 | 检查包的 VID 是否属于该端口 | 标准 Trunk |
| 0x810000c2 | 丢弃所有不带 VLAN 标签的原始数据包 | 严格 Trunk |
vid portmap eg-tag eg-con stag ivl fid
1 1111111 uuuuuuu 0 0 1 -
2 ------- ------- 0 0 1 -
1029 ----11- ----tt- 0 0 1 -
PVID:
port pvid prio matrix
0 1 0 1111111
1 1 0 1111111
2 1 0 1111111
3 1 0 1111111
4 1 0 1111111
5 1 0 1111111
6 1 0 1111111# 在路由器启动后执行
# 配置 portmap、eg-tag
switch vlan set 1 1111111 0 0 uuuuuuu
switch vlan set 2 0000000 0 0 -------
switch vlan set 1029 0000110 0 0 ----tt-
# 配置 pvid
switch pvid 4 1
switch pvid 5 1
# 配置 matrix
switch reg w 0x2004 0x007f0003
switch reg w 0x2104 0x007f0003
switch reg w 0x2204 0x007f0003
switch reg w 0x2304 0x007f0003
switch reg w 0x2404 0x007f0003
switch reg w 0x2504 0x007f0003
switch reg w 0x2604 0x007f0003