现在5700下面有个Nvlan,分别从DHCP服务器上获的IP地址。DHCP服务器是2008 R2ip分别是192.168.2.2,192.168.2.4

配置之前,我们要值的注意的地方,不同的vlanDHCP服务器上获的IP,我们要在交换机上使用DHCP relay 也就是中继。

再者就是要开启DHCP snooping trusted 端口信任,否你的DHCP包会被交换机丢弃,丢弃的意思懂吗?就是不会被交换机广播,说白了你就等于白配,一切空谈。

 

首先我们要确定思路,以vlan20为例:

全局开启DHCP,创建DHCP服务器组,为DHCP服务器指定IP,分别是192.168.2.2,192.168.2.4

<5700>system-view

Enter system view, return user view with Ctrl+Z.

[5700]dhcp enable

[5700]dhcp server group czy

[5700-dhcp-server-group-czy] dhcp-server 192.168.2.2

[5700-dhcp-server-group-czy] dhcp-server 192.168.2.4

[5700-dhcp-server-group-czy]quit

进入要配置的vlan 20,开启dhcp中继,为中继指定dhcp服务器组。

[5700]int vlan20

[5700-Vlanif20]dhcp select relay

[5700-Vlanif20]dhcp relay server-select czy

[5700-Vlanif20]quit

最后一步开端口信任,在这里讲一下我的环境,GIG0/0/1口连接是一台物理服务器,物理机上跑着DHCP服务器虚拟机。实际这样是不合理的啊,如果物理机损坏你的两台DHCP服务器是起不到冗余的啊!这里因为只是实验,现实切不可这样布局。

[5700]dhcp snooping en

[5700]int gig 0/0/1

[5700-GigabitEthernet0/0/1]dhcp snooping trusted

[5700-GigabitEthernet0/0/1]quit

最后查看下是否生效,从交换机是生效了。

[5700]dis cur

#

interface Vlanif20

 ip address 192.168.20.1 255.255.254.0

 dhcp select relay

 dhcp relay server-select czy

 

接上机器试一下呗,测试结果让人高兴啊!

PC>ipconfig

IPv4 address......................: 192.168.20.10

Subnet mask.......................: 255.255.254.0

Gateway...........................: 192.168.20.1

Physical address..................: 00-0B-09-CF-2E-2D

DNS server........................: 192.168.2.2

                                    192.168.2.4

 

PC>ping 192.168.2.2

 

Ping 192.168.2.2: 32 data bytes, Press Ctrl_C to break

From 192.168.2.2: bytes=32 seq=1 ttl=127 time=47 ms

From 192.168.2.2: bytes=32 seq=2 ttl=127 time=15 ms

From 192.168.2.2: bytes=32 seq=3 ttl=127 time=47 ms

From 192.168.2.2: bytes=32 seq=4 ttl=127 time=46 ms

From 192.168.2.2: bytes=32 seq=5 ttl=127 time=16 ms

 

--- 192.168.2.2 ping statistics ---

  5 packet(s) transmitted

  5 packet(s) received

  0.00% packet loss

  round-trip min/avg/max = 15/34/47 ms