DHCP Server为多个vlan分配IP

实验内容:
1,vlan10和vlan20内的主机能够从远端的DHCP Server中获取IP地址。
2,vlan10和vlan20之间能够互相通信。

实验拓扑

DHCP Server为多个vlan分配IP

实验思路:

  1. 三层交换机中要有去往DHCP Server的路由,要创建三个vlan 10 20 1,其中把vlan1是为了和直连路由器通信。
  2. 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

验证结果:
DHCP Server为多个vlan分配IP

DHCP Server为多个vlan分配IP

转载于:https://blog.51cto.com/ruisir/2045611

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值