实验拓补
实验要求:
全网可达
使用dhcp获取IP地址
实验思路
- 在交换机中建立vlan,根据接口不同更改接口的默认vlan和类型
- 在路由器配置子接口并下发dhcp服务
实验步骤
[sw1]vlan 2
[sw1-vlan2]quit
[sw1]vlan 3
[sw1]int e0/0/2
[sw1-Ethernet0/0/2]port link-type access
[sw1-Ethernet0/0/2]port default vlan 2
[sw1-Ethernet0/0/2]int e0/0/3
[sw1-Ethernet0/0/3]port link-type access
[sw1-Ethernet0/0/3]port default vlan 3
[sw1-Ethernet0/0/3]int e0/0/1
[sw1-Ethernet0/0/1]port link-type trunk
[sw1-Ethernet0/0/1]port trunk allow-pass vlan 2 3
[sw1-Ethernet0/0/1] User interface con0 is available
[sw2]vlan 2
[sw2]vlan 3
[sw2]int e0/0/3
[sw2-Ethernet0/0/3]port link-type access
[sw2-Ethernet0/0/3]port default vlan 2
[sw2-Ethernet0/0/3]int e0/0/4
[sw2-Ethernet0/0/4]port link-type access
[sw2-Ethernet0/0/4]port default vlan 3
[sw2-Ethernet0/0/4]int e0/0/1
[sw2-Ethernet0/0/1]port link-type trunk
[sw2-Ethernet0/0/1]port trunk allow-pass vlan 2 3
[sw2-Ethernet0/0/1]int e0/0/2
[sw2-Ethernet0/0/2]port link-type trunk
[sw2-Ethernet0/0/2]port trunk allow-pass vlan 2 3
[sw3]vlan 2
[sw3-vlan2]quit
[sw3]vlan 3
[sw3-vlan3] User interface con0 is available
[sw3-Ethernet0/0/2]port link-type access
[sw3-Ethernet0/0/2]port default vlan 2
[sw3-Ethernet0/0/2]int e0/0/3
[sw3-Ethernet0/0/3]port link-type access
[sw3-Ethernet0/0/3]port default vlan 3
[sw3-Ethernet0/0/3]int e0/0/1
[sw3-Ethernet0/0/1]port link-type trunk
[sw3-Ethernet0/0/1]port trunk allow-pass vlan 2 3
[R1]int g0/0/0.2
[R1-GigabitEthernet0/0/0.2]ip add 192.168.1.254 24
termination vid 2
[R1-GigabitEthernet0/0/0.2]arp broadcast enable
[R1]int g0/0/0.3
[R1-GigabitEthernet0/0/0.3]ip add 192.168.2.254 24
[R1-GigabitEthernet0/0/0.3]dot1q termination vid 3
[R1-GigabitEthernet0/0/1.3]arp broadcast enable
[R1]dhcp enable
[R1]ip pool 1
[R1-ip-pool-1]network 192.168.1.0 mask 24
[R1-ip-pool-1]gateway-list 192.168.1.254
[R1-ip-pool-1]dns-list 8.8.8.8 114.114.114.114
[R1-ip-pool-1]quit
[R1]int g0/0/0.2
[R1-GigabitEthernet0/0/0.2]dhcp select global
[R1]ip pool 2
[R1-ip-pool-2]network 192.168.2.0 mask 24
[R1-ip-pool-2]gateway-list 192.168.2.254
[R1-ip-pool-2]dns-list 8.8.8.8 114.114.114.114
[R1-ip-pool-2]quit
[R1]int g0/0/0.3
[R1-GigabitEthernet0/0/0.3]dhcp select global
[R1]ip pool 3
[R1-ip-pool-3]network 192.168.3.0 mask 24
[R1-ip-pool-3]gateway-list 192.168.3.254
[R1-ip-pool-3]dns-list 8.8.8.8 114.114.114.114
[R1]int g0/0/1.2
[R1-GigabitEthernet0/0/1.2]dhcp select global
[R1]ip pool 4
[R1-ip-pool-4]network 192.168.4.0 mask 24
[R1-ip-pool-4]gateway-list 192.168.4.254
[R1-ip-pool-4]dns-list 8.8.8.8 114.114.114.114
[R1-ip-pool-4]int g0/0/1.3
[R1-GigabitEthernet0/0/1.3]dhcp select global
全网通测试