实验内容:
远端DHCP Server分别为vlan10和20分配IP
实验拓扑:
实验分析:
1,三层交换机和DHCP Server要有分别去往各自的路由
2,要创建一个vlan和交换机直连的路由器通信,注意直连的物理接口要加入这个 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/xwxhvip/2045615