一.拓扑图
二.需求分析
1.交换的配置----VLAN
2.实现设备的IP配置---路由器,PC等
3.补全路由器的路由表
4.全网可达---单一网络
三.配置过程
1.交换的配置----VLAN
LSW1
[SW1]vlan batch 2 3
Info: This operation may take a few seconds. Please wait for a moment...done.
[SW1]int g 0/0/3
[SW1-GigabitEthernet0/0/3]port link-type access
[SW1-GigabitEthernet0/0/3]port default vlan 2
[SW1-GigabitEthernet0/0/3]int g 0/0/4
[SW1-GigabitEthernet0/0/4]port li ac
[SW1-GigabitEthernet0/0/4]po de v 3
[SW1-GigabitEthernet0/0/4]int g 0/0/2
[SW1-GigabitEthernet0/0/2]port link-type trunk
[SW1-GigabitEthernet0/0/2]port trunk allow-pass vlan 2 3
[SW1-GigabitEthernet0/0/2]int g 0/0/1
[SW1-GigabitEthernet0/0/1]port link-type trunk
[SW1-GigabitEthernet0/0/1]port trunk allow-pass vlan 2 3
[SW1-GigabitEthernet0/0/1]
LSW2
[SW2]vlan batch 2 3
Info: This operation may take a few seconds. Please wait for a moment...done.
[SW2]int g 0/0/2
[SW2-GigabitEthernet0/0/2]port link-type access
[SW2-GigabitEthernet0/0/2]port default vlan 2
[SW2-GigabitEthernet0/0/2]int g 0/0/3
[SW2-GigabitEthernet0/0/3]po li ac
[SW2-GigabitEthernet0/0/3]po de v 3
[SW2-GigabitEthernet0/0/3]int g 0/0/1
[SW2-GigabitEthernet0/0/1]port link-type trunk
[SW2-GigabitEthernet0/0/1]
Jul 29 2024 09:51:37-08:00 SW2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 11, the
change loop count is 0, and the maximum number of records is 4095.
[SW2-GigabitEthernet0/0/1]port trunk allow-pass vlan 2 3
2.实现设备的IP配置---路由器,PC等3.补全路由器的路由表
R1
[p1]dhcp enable
Info: The operation may take a few seconds. Please wait for a moment.done.
[p1]ip pool vlan2
Info: It's successful to create an IP address pool.
[p1-ip-pool-vlan2]network 192.168.2.0 mask 24
[p1-ip-pool-vlan2]gateway-list 192.168.2.254
[p1-ip-pool-vlan2]dns-list 8.8.8.8
[p1-ip-pool-vlan2]ip pool vlan3
Info: It's successful to create an IP address pool.
[p1-ip-pool-vlan3]network 192.168.3.0 mask 24
[p1-ip-pool-vlan3]gateway-list 192.168.3.254
[p1-ip-pool-vlan3]dns-list 8.8.8.8
[p1-ip-pool-vlan3]
[p1]int g 0/0/0.1
[p1-GigabitEthernet0/0/0.1]ip add 192.168.2.254 24
[p1-GigabitEthernet0/0/0.1]dot1q termination vid 2
Jul 29 2024 09:43:33-08:00 p1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0.1 has entered the UP state.
[p1-GigabitEthernet0/0/0.1]arp broadcast enable
[p1-GigabitEthernet0/0/0.1]dhcp select global
[p1-GigabitEthernet0/0/0.1]int g 0/0/0.2
[p1-GigabitEthernet0/0/0.2]ip add 192.168.3.254 24
[p1-GigabitEthernet0/0/0.2]dot1q termination vid 3
Jul 29 2024 09:44:43-08:00 p1 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/0.2 has entered the UP state.
[p1-GigabitEthernet0/0/0.2]arp broadcast enable
[p1-GigabitEthernet0/0/0.2]dhcp select global
[p1-GigabitEthernet0/0/0.2]
PC1
PC2
PC3
PC4