h3c-DHCP

dhcp分配给不同的vlan不同的IP

<H3C>system-view

[H3C]dhcp enable

[H3C]vlan 2
[H3C-vlan2]port GigabitEthernet 1/0/2   添加接口
[H3C-vlan2]quit
[H3C]interface Vlan-interface 1      给vlan添加地址
[H3C-Vlan-interface1]ip add 168.168.1.1 255.255.255.0
[H3C-Vlan-interface1]quit

[H3C]interface Vlan-interface 2      给vlan添加地址
[H3C-Vlan-interface2]ip add 168.168.2.1 255.255.255.0
[H3C-Vlan-interface2]quit


[H3C]dhcp server forbidden-ip 168.168.1.2     添加要排除的地址
[H3C]dhcp server forbidden-ip 168.168.2.2

[H3C]dhcp server ip-pool 1         创建ip地址池1
[H3C-dhcp-pool-1]network 168.168.1.0 mask 255.255.255.0
[H3C-dhcp-pool-1]dns-list 8.8.8.8
[H3C-dhcp-pool-1]gateway-list 168.168.1.1
[H3C-dhcp-pool-1]quit

[H3C]dhcp server ip-pool 2        创建ip地址池2
[H3C-dhcp-pool-2]network 168.168.2.0 mask 255.255.255.0
[H3C-dhcp-pool-2]dns-list 8.8.8.8
[H3C-dhcp-pool-2]gateway-list 168.168.2.1
[H3C-dhcp-pool-2]quit

[H3C]display dhcp server ip-in-use            查看ip分配情况
IP address       Client identifier/    Lease expiration      Type
                 Hardware address
168.168.1.3      0032-3839-392e-6164-  Dec  8 09:40:31 2021  Auto(C)
                 6134-2e30-3230-362d-
                 4745-302f-302f-31
168.168.2.3      0032-3839-392e-6232-  Dec  8 09:43:12 2021  Auto(C)
                 3539-2e30-3330-362d-
                 4745-302f-302f-31

dhcp中继

 

dhcp enable

# 配置VLAN接口5工作在DHCP中继模式。

interface vlan-interface 5

dhcp select relay

# 配置DHCP服务器的地址。

dhcp relay server-address 192.168.7.100

 

# 配置VLAN接口6工作在DHCP中继模式。

interface vlan-interface 6

dhcp select relay

# 配置DHCP服务器的地址。

dhcp relay server-address 192.168.7.100

 

posted @ 2021-12-07 11:32  TMD网络  阅读(256)  评论(0编辑  收藏  举报