首先使用[sw1]vlan batch 2 to 5将每个交换机开启
sw2: [sw2]int g 0/0/2 [sw2-GigabitEthernet0/0/2]port link-type access [sw2-GigabitEthernet0/0/2]port default vlan 2 [sw2-Ethernet0/0/3]port link-type access [sw2-Ethernet0/0/3]port default vlan 3 [sw2-Ethernet0/0/1]port link-type trunk [sw2-Ethernet0/0/1]port trunk allow-pass vlan 2 3
sw3: [sw3-Ethernet0/0/2]port link-type access [sw3-Ethernet0/0/2]port default vlan 2 [sw3-Ethernet0/0/1]port link-type trunk [sw3-Ethernet0/0/1]port trunk allow-pass vlan 2
sw5: [sw5-Ethernet0/0/2]port link-type access [sw5-Ethernet0/0/2]port default vlan 4 [sw5-Ethernet0/0/1]port link-type trunk [sw5-Ethernet0/0/1]port trunk allow-pass vlan 4
sw6: [sw6-Ethernet0/0/2]port link-type access [sw6-Ethernet0/0/2]port default vlan 5 [sw6-Ethernet0/0/3]port link-type access [sw6-Ethernet0/0/3]port default vlan 4 [sw6-Ethernet0/0/1]port link-type trunk [sw6-Ethernet0/0/1]port trunk allow-pass vlan 4 5
sw1: [sw1-Ethernet0/0/2]port link-type trunk [sw1-Ethernet0/0/2]port trunk allow-pass vlan 2 3 [sw1-Ethernet0/0/3]port link-type trunk [sw1-Ethernet0/0/3]port trunk allow-pass vlan 2 [sw1-Ethernet0/0/1]port link-type trunk [sw1-Ethernet0/0/1]port trunk allow-pass vlan 114 [sw1]int Vlan 114 [sw1-Vlanif114]ip address 10.1.114.1 24 [sw1-Ethernet0/0/5]port link-type access [sw1-Ethernet0/0/5]port default vlan 11 [sw1-Vlanif11]ip address 10.1.11.2 24 [sw1-Vlanif2]ip address 10.1.2.254 24 [sw1-Vlanif3]ip address 10.1.3.254 24 开启dhcp服务: [sw1]dhcp enable [sw1-Vlanif2]dhcp select interface [sw1-Vlanif3]dhcp select interface [sw1-ospf-1-area-0.0.0.0]network 10.1.114.0 0.0.0.255
sw4: [sw4-Ethernet0/0/2]port link-type trunk [sw4-Ethernet0/0/2]port trunk allow-pass vlan 4 [sw4-Ethernet0/0/3]port link-type trunk [sw4-Ethernet0/0/3]port trunk allow-pass vlan 4 5 [sw4-Ethernet0/0/1]port link-type trunk [sw4-Ethernet0/0/1]port trunk allow-pass vlan 114 [sw4]int Vlanif 114 [sw4-Vlanif114]ip address 10.1.114.2 24 [sw4-Ethernet0/0/5]port link-type access [sw4-Ethernet0/0/5]port default vlan 14 [sw4-Vlanif14]ip address 10.1.14.2 24 [sw4-Vlanif4]ip address 10.1.4.254 24 [sw4-Vlanif5]ip address 10.1.5.254 24 开启dhcp服务: [sw4]dhcp enable [sw4-Vlanif4]dhcp select interface [sw4-Vlanif5]dhcp select interface
sw7 [sw7-Ethernet0/0/6]port link-type access [sw7-Ethernet0/0/6]port default vlan 100 [sw7-Ethernet0/0/4]port link-type access [sw7-Ethernet0/0/4]port default vlan 200 [sw7-Ethernet0/0/2]port trunk allow-pass vlan 100
r1: [r1-Ethernet0/0/0]ip add 10.1.11.1 24 [r1-Ethernet0/0/1] ip address 10.1.14.1 24
做完dhcp后将电脑的dhcp服务都打开,电脑将自动获取IP地址 将交换机vlan以及道路配置完成后,利用ospf协议将整个网络全网可达
|