1: pc基础配置
2:交换机的配置
首先创建vlan 10 20 [Huawei]vlan batch 10 20 交换机端口类型的更改 [Huawei-Ethernet0/0/2]port link-type access [Huawei-Ethernet0/0/2]port default vlan 10 [Huawei-Ethernet0/0/3]port link-type access [Huawei-Ethernet0/0/3]port default vlan20 vlanif的引入 [Huawei]int Vlanif 10 [Huawei-Vlanif10]ip ad 192.168.1.254 24 [Huawei]int Vlanif 20 [Huawei-Vlanif20]ip ad 192.168.2.254 24
接着是交换机和路由器接口的配置 [Huawei]valn batch 30 [Huawei]int Vlanif 30 [Huawei-Vlanif30]ip ad 12.1.1.1 8 [Huawei-Ethernet0/0/1]port link-type access [Huawei-Ethernet0/0/1]port default vlan 30
3:路由器的接口配置
1. [Huawei-Ethernet0/0/0]ip ad 12.1.1.2 8 2. 3. [Huawei-Ethernet0/0/1]ip ad 192.168.3.254 24
4:实现不同网段之间的通信需要用到ospf
交换机 [Huawei-ospf-1-area-0.0.0.0]network 12.0.0.0 0.255.255.255 [Huawei-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255 [Huawei-ospf-1-area-0.0.0.0]network 192.168.2.0 0.0.0.255 路由器 [Huawei-ospf-1-area-0.0.0.0]network 12.0.0.0 0.255.255.255 [Huawei-ospf-1-area-0.0.0.0]network 192.168.3.0 0.0.0.255
5:测试主机通信结果