diff --git "a/\345\224\220\346\200\241\350\275\251/20240422\347\254\224\350\256\260.md" "b/\345\224\220\346\200\241\350\275\251/20240422\347\254\224\350\256\260.md" new file mode 100644 index 0000000000000000000000000000000000000000..b394a1442fa0172b47e5082217c31bb75ea7eab2 --- /dev/null +++ "b/\345\224\220\346\200\241\350\275\251/20240422\347\254\224\350\256\260.md" @@ -0,0 +1 @@ +新建packer tracer拓扑图 当交换机设置两个Vlan时,逻辑上已经成为两个网络,广播被隔离了。两个Vlan的 网络要通信,必须通过路由器,如果接入路由器的一个物理端口,则必须有两个子接 口分别与两个Vlan对应,同时还要求与路由器相连的交换机的端口fa 0/1要设置为 trunk,因为这个接口要通过两个Vlan的数据包。 检查设置情况,应该能够正确的看到Vlan和Trunk信息。 计算机的网关分别指向路由器的子接口。 配置子接口,开启路由器物理接口。 默认封装dot1q协议。 配置路由器子接口IP地址。 实验设备 PC 2台;Router_2811 1台;Switch_2960 1台 PC1配置 IP地址: 192.168.1.2 子网掩码: 255.255.255.0 网关:192.168.1.1 PC2配置 IP地址: 192.168.2.2 子网掩码: 255.255.255.0 网关:192.168.2.1 拓扑图如下图1-1 图1-1 Switch操作指令 en (进入特权模式) conf t (进入全局配置模式) vlan 2 (新建虚拟局域网VLAN2) exit (返回上层配置模式) vlan 3 (新建虚拟局域网VLAN3) exit (返回上层配置模式) int fa 0/2 (进入交换机0模块第2端口) sw acc vlan 2 (将当前端口fa0/2划分到虚拟局域网vlan 2中) exit (返回上层配置模式) int fa 0/3 (进入交换机0模块第3端口) sw acc vlan 3 (将当前端口fa0/3划分到虚拟局域网vlan 3中) exit (返回上层配置模式) int fa 0/1 (进入交换机0模块第1端口) switchport mode trunk (设置端口fa0/1的工作模式为trunk) Router配置 en (进入特权模式) conf t (进入全局配置模式) int fa 0/0 (进入路由器0模块第0端口) no shutdown (开启该端口) exit (返回上层配置模式) interface fast 0/0.1 (进入路由器0模块第0端口第1子接口) encapsulation dot1Q 2 (封装协议设置为dot1q 允许通过的vlan 为2) ip address 192.168.1.1 255.255.255.0 (该子接口配置IP地址为192.168.1.1) exit (返回上层配置模式) int fa 0/0.2 (进入路由器0模块第0端口第2子接口) encapsulation dot1q 3 (封装协议设置为dot1q 允许通过的vlan 为3) ip address 192.168.2.1 255.255.255.0 (该子接口配置IP地址为192.168.2.1) end (退出) show ip route (查看路由表) 实验最终目的 在PC1中打开cmd(命令提示符)输入ping 192.168.2.2(PC2的IP地址)有回复. \ No newline at end of file