实验内容:
1,vlan10和vlan20内的主机能够从远端的DHCP Server中获取IP地址。
2,vlan10和vlan20之间能够互相通信。
实验拓扑
实验思路:
- 三层交换机中要有去往DHCP Server的路由,要创建三个vlan 10 20 1,其中把vlan1是为了和直连路由器通信。
- DHCP Server要有去往各个vlan的路由
实验配置:
[Switch]vlan batch 10 20
[Switch]dhcp enable
[Switch]inter vlan 10
[Switch-Vlanif10]dhcp select relay
[Switch-Vlanif10]dhcp relay server-ip 4.4.4.2
[Switch-Vlanif10]inter vlan 20
[Switch-Vlanif20]dhcp sel rel
[Switch-Vlanif20]dhcp relay server-ip 4.4.4.2
[Switch-Vlanif20]inter vlan 1
[Switch-Vlanif1]ip add 3.3.3.1 24
[Switch]inter g0/0/1
[Switch-GigabitEthernet0/0/1]port link-type access
[Switch-GigabitEthernet0/0/1]port default vlan 10
[Switch-GigabitEthernet0/0/2]port link-type access
[Switch-GigabitEthernet0/0/2]port default vlan 20
[Switch]ip route-static 4.4.4.0 24 3.3.3.2
[Route2]inter g0/0/0
[Route2-GigabitEthernet0/0/0]ip add 3.3.3.2 24
[Route2-GigabitEthernet0/0/0]inter g0/0/1
[Route2-GigabitEthernet0/0/1]ip add 4.4.4.1 24
[Route2]ip route-static 1.1.1.0 24 3.3.3.1
[Route2]ip route-static 2.2.2.0 24 3.3.3.1
[DHCP Server]dhcp enable
[DHCP Server]inter g0/0/0
[DHCP Server-GigabitEthernet0/0/0]dhcp select global
[DHCP Server]ip pool vlan10
[DHCP Server-ip-pool-vlan10]network 1.1.1.0 mask 24
[DHCP Server-ip-pool-vlan10]gateway-list 1.1.1.1
[DHCP Server-ip-pool-vlan10]lease day 1
[DHCP Server]ip pool vlan20
[DHCP Server-ip-pool-vlan20]network 2.2.2.0 mask 24
[DHCP Server-ip-pool-vlan20]gateway-list 2.2.2.1
[DHCP Server-GigabitEthernet0/0/0]ip add 4.4.4.2 24
[DHCP Server]ip route-static 3.3.3.0 24 4.4.4.1
[DHCP Server]ip route-static 1.1.1.0 24 4.4.4.1
[DHCP Server]ip route-static 2.2.2.0 24 4.4.4.1
验证结果:
转载于:https://blog.51cto.com/ruisir/2045611