实验要求:
1.PC1/2/5 在vlan2,PC3/4/6在vlan3.
2.SW1、SW2之间,SW1、R1之间 为trunk干道,
3.PC不配地址,通过DHCP获取地址
实验思路:
1.在SW上创建vlan,在对应接口划分vlan
2.SW1、SW2,SW1、R1之间创建trunk干道
3.R1上创建两个虚拟子接口,每个字接口划分vlan,并创建DHCP池塘
SW1
[Huawei]sysname sw1
[sw1]vlan 2
[sw1-vlan2]
[sw1-vlan2]q
[sw1]vlan 3
[sw1-vlan3]
[sw1]interface e0/0/2
[sw1-Ethernet0/0/2]port link-type access
[sw1-Ethernet0/0/2]port default vlan 2
[sw1-Ethernet0/0/2]q
[sw1]interface e0/0/3
[sw1-Ethernet0/0/3]port link-type access
[sw1-Ethernet0/0/3]port default vlan 2
[sw1-Ethernet0/0/3]q
[sw1]port-group group-member e0/0/4 to e0/0/5
[sw1-port-group]port link-type access
[sw1-Ethernet0/0/4]port link-type access
[sw1-Ethernet0/0/5]port link-type access
[sw1-Ethernet0/0/5]port default vlan 3
[sw1-port-group]
[sw1]interface e0/0/6
[sw1-Ethernet0/0/6]port link-type trunk
[sw1-Ethernet0/0/6]port trunk allow-pass vlan 2 to 3
[sw1-Ethernet0/0/6]q
[sw1]interface e0/0/1
[sw1-Ethernet0/0/1]port link-type trunk
[sw1-Ethernet0/0/1]port trunk allow-pass vlan 2 to 3
[sw1-Ethernet0/0/1]
SW2
[Huawei]sysname sw2
[sw2]
[sw2]vlan batch 2 to 3
[sw2]interface e0/0/1
[sw2-Ethernet0/0/1]port link-type trunk
[sw2-Ethernet0/0/1]port trunk allow-pass vlan 2 to 3
[sw2-Ethernet0/0/1]
[sw2]interface e0/0/2
[sw2-Ethernet0/0/2]port link-type access
[sw2-Ethernet0/0/2]port default vlan 2
[sw2-Ethernet0/0/2]q
[sw2]inter
[sw2]interface e0/0/3
[sw2-Ethernet0/0/3]port link-type access
[sw2-Ethernet0/0/3]port default vlan 3
[sw2-Ethernet0/0/3]
R1
[Huawei]sysname r1
[r1]
[r1]interface g0/0/0.1
[r1-GigabitEthernet0/0/0.1]dot1q termination vid 2
[r1-GigabitEthernet0/0/0.1]ip address 192.168.1.250 24
[r1-GigabitEthernet0/0/0.1]arp broadcast enable
[r1-GigabitEthernet0/0/0.1]q
[r1]interface g0/0/0.2
[r1-GigabitEthernet0/0/0.2]dot1q termination vid 3
[r1-GigabitEthernet0/0/0.2]ip address 192.168.2.250 24
[r1-GigabitEthernet0/0/0.2]arp broadcast enable
[r1-GigabitEthernet0/0/0.2]q
[r1]dhcp enable
[r1]ip pool a
[r1-ip-pool-a]network 192.168.1.0 mask 24
[r1-ip-pool-a]gateway-list 192.168.1.250
[r1-ip-pool-a]q
[r1]ip pool b
[r1-ip-pool-b]network 192.168.2.0 mask 24
[r1-ip-pool-b]gateway-list 192.168.2.250
[r1-ip-pool-b]q
[r1]interface g0/0/0.1
[r1-GigabitEthernet0/0/0.1]dhcp select global
[r1-GigabitEthernet0/0/0.1]q
[r1]interface g0/0/0.2
[r1-GigabitEthernet0/0/0.2]dhcp select global
[r1-GigabitEthernet0/0/0.2]
PC1
PC>IPCONFIG
Link local IPv6 address...........: fe80::5689:98ff:fe69:3ff8
IPv6 address......................: :: / 128
IPv6 gateway......................: ::
IPv4 address......................: 192.168.1.254
Subnet mask.......................: 255.255.255.0
Gateway...........................: 192.168.1.250
Physical address..................: 54-89-98-69-3F-F8
DNS server........................:
PC>
PC6
PC>IPCONFIG
Link local IPv6 address...........: fe80::5689:98ff:fe9e:1b7f
IPv6 address......................: :: / 128
IPv6 gateway......................: ::
IPv4 address......................: 192.168.2.254
Subnet mask.......................: 255.255.255.0
Gateway...........................: 192.168.2.250
Physical address..................: 54-89-98-9E-1B-7F
DNS server........................:
PC6 PING PC1
PC>PING 192.168.1.254
Ping 192.168.1.254: 32 data bytes, Press Ctrl_C to break
Request timeout!
From 192.168.1.254: bytes=32 seq=2 ttl=127 time=110 ms
From 192.168.1.254: bytes=32 seq=3 ttl=127 time=109 ms
From 192.168.1.254: bytes=32 seq=4 ttl=127 time=94 ms
From 192.168.1.254: bytes=32 seq=5 ttl=127 time=94 ms
--- 192.168.1.254 ping statistics ---
5 packet(s) transmitted
4 packet(s) received
20.00% packet loss
round-trip min/avg/max = 0/101/110 ms
PC>