华为路由器上的 DHCP 配置(详细步骤) 

 

 

 

 

 

 

 华为路由器上的 DHCP 配置步骤:

 

 

1、确保客户端与服务器之间的链路是互通的;

        #SW1

           创建 VLAN 10  

           将端口放入VLAN 10 ;

        #Gateway

           在 Router 上为 VLAN 10 配置一个 网关IP 地址;

 

2、配置 DHCP 客户端;

        # 进入 PC ,选择“自动获取”,点“应用”;

 

3、配置 DHCP 服务器;

        # 创建 IP 地址池;

            ip pool VLAN-10

               network 192.168.10.0 mask 255.255.255.0

               gateway-list  192.168.10.254

               dns-list 8.8.8.8

               lease day 3

               

        # 开启 DHCP 服务 ;

            dhcp enable         

        # 在 接收 DHCP 报文的端口上,配置 DHCP 的选择方式 -  global ;

            interface gi0/0/0

               dhcp select global // 表示的是当端口上收到 DHCP 报文以后

                                      直接去 DHCP 服务器在全局配置的IP

                                      地址池中选择一个可用的IP地址;

                        

一:sw1配置

 

[sw1]vlan batch 10 20 //创建vlan

[sw1]int g0/0/1

[sw1-GigabitEthernet0/0/1]port link-type access //端口加vlan

[sw1-GigabitEthernet0/0/1]port default vlan 10

[sw1-GigabitEthernet0/0/1]q

[sw1]int g0/0/2

[sw1-GigabitEthernet0/0/2]port link-type access

[sw1-GigabitEthernet0/0/2]port default vlan 20

[sw1-GigabitEthernet0/0/2]q

[sw1]int vlan 10

[sw1-Vlanif10]ip add 192.168.10.254 24

[sw1-Vlanif10]int vlan 20

 [sw1-Vlanif20]ip add 192.168.20.1 24

[sw1-Vlanif20]int g0/0/3

[sw1-GigabitEthernet0/0/3]port link-type access

[sw1-GigabitEthernet0/0/3]port default vlan 20

[sw1-GigabitEthernet0/0/3]q

[sw1]rip             //RIP应用

[sw1-rip-1]version 2

[sw1-rip-1]network 192.168.10.0

[sw1-rip-1]network 192.168.20.0

[sw2]dhcp enable  //启用dhcp

[sw1]int vlan 10

[sw1-Vlanif10]dhcp select relay //dhcp中继

[sw1-Vlanif10]dhcp relay server-ip 192.168.100.2

Sw2配置:

[sw2]vlan batch 30 40 50 60

[sw2]int g0/0/2

[sw2-GigabitEthernet0/0/2]port link-type a 

[sw2-GigabitEthernet0/0/2]port link-type access

[sw2-GigabitEthernet0/0/2]port d   

[sw2-GigabitEthernet0/0/2]port def 

[sw2-GigabitEthernet0/0/2]port default vlan 30

[sw2-GigabitEthernet0/0/2]q

[sw2]int eth0/0/3

[sw2-Ethernet0/0/3]port link-type access

[sw2-Ethernet0/0/3]port default vlan 40

[sw2-Ethernet0/0/3]q

[sw2-Ethernet0/0/4]port link-type access

[sw2-Ethernet0/0/4]port default vlan 50

[sw2-Ethernet0/0/4]q

[sw2]int eth0/0/5

[sw2-Ethernet0/0/5]port link-type access

[sw2-Ethernet0/0/5]port default vlan 60

[sw2-Ethernet0/0/5]q

[sw2-Ethernet0/0/1]port link-type access

[sw2-Ethernet0/0/1]port default vlan 50

[sw2-Ethernet0/0/1]int g0/0/6

[sw2-Ethernet0/0/1]q

[sw2]int eth0/0/6

[sw2-Ethernet0/0/6]port link-type access

[sw2-Ethernet0/0/6]port default vlan 60

[sw2-Ethernet0/0/6]q

[sw2]int vlan 30

[sw2-Vlanif30]ip add 192.168.30.254

[sw2-Vlanif30]ip add 192.168.30.254 24

[sw2-Vlanif30]q

[sw2]int vlan 40

[sw2-Vlanif40]ip add 192.168.40.254 24

[sw2]int vlan 50

[sw2-Vlanif50]ip add 192.168.50.1 24

[sw2]int vlan 60

[sw2-Vlanif60]ip add 192.168.60.1 24

[sw2-Vlanif50]q

[sw2]rip

[sw2-rip-1]version 2

[sw2-rip-1]network 192.168.30.0

[sw2-rip-1]network 192.168.40.0

[sw2-rip-1]network 192.168.50.0

[sw2-rip-1]network 192.168.60.0

[sw2-rip-1]q

[sw2]dhcp enable

[sw2]int vlan 30

[sw2-Vlanif30]dhcp select relay

[sw2-Vlanif30]dhcp relay server-ip 192.168.100.2

[sw2-Vlanif30]q

[sw2]int vlan 40

[sw2-Vlanif40]dhcp select relay

[sw2-Vlanif40]dhcp relay server-ip 192.168.100.2

三:R1配置

[r1]int g0/0/0

[r1-GigabitEthernet0/0/0]ip add 192.168.20.254

[r1-GigabitEthernet0/0/0]ip add 192.168.20.254 24

[r1-GigabitEthernet0/0/0]int g0/0/2

[r1-GigabitEthernet0/0/2]ip add 192.168.100.1 24

[r1-GigabitEthernet0/0/2]q

[r1]int g0/0/1

[r1-GigabitEthernet0/0/1]ip add 192.168.70.1 24

[r1]rip

[r1-rip-1]version 2

[r1-rip-1]network  192.168.20.0

[r1-rip-1]network 192.168.100.0

[r1-rip-1]network 192.168.70.0

[r1-rip-1]q

[r1]dhcp enable

[r1]int g0/0/0

[r1-GigabitEthernet0/0/0]dhcp select relay

[r1-GigabitEthernet0/0/0]dhcp relay server-ip 192.168.100.2

四.R2配置

[r2]int g0/0/1

[r2-GigabitEthernet0/0/1]ip add 192.168.70.2 24

[r2-GigabitEthernet0/0/1]q

[r2]int g0/0/0

[r2-GigabitEthernet0/0/0]ip add 192.168.50.254 24

[r2-GigabitEthernet0/0/0]ip add 192.168.60.254

 [r2-GigabitEthernet0/0/0]ip add 192.168.60.254 24

[r2-GigabitEthernet0/0/0]rip

[r2-rip-1]version 2

[r2-rip-1]network 192.168.70.0

[r2-rip-1]network 192.168.50.0

[r2-rip-1]network 192.168.60.0

[r2]dhcp enable

[r2]int g0/0/0

[r2-GigabitEthernet0/0/0]dhcp select relay

[r2-GigabitEthernet0/0/0]dhcp  relay server-ip 192.168.100.2

[r2-GigabitEthernet0/0/0]q

[r2]int g0/0/2

[r2-GigabitEthernet0/0/2]dhcp select relay

[r2-GigabitEthernet0/0/2]dhcp relay server-ip 192.168.100.2

五.Dhcp配置:

[dhcp]int vlan 100

[dhcp]interface g0/0/1

[dhcp-GigabitEthernet0/0/1]port link-type access

[dhcp-GigabitEthernet0/0/1]port default vlan 100

[dhcp-Vlanif100]ip add 192.168.100.2 24

[dhcp-Vlanif100]q

[dhcp]dhcp enable

[dhcp]ip pool vlan10     //建地址池

[dhcp-ip-pool-vlan10]network 192.168.10.0 mask 24

[dhcp-ip-pool-vlan10]gateway-list 192.168.10.254

[dhcp-ip-pool-vlan10]dns-list 8.8.8.8

[dhcp-ip-pool-vlan10]Q

[dhcp]ip pool vlan20

[dhcp-ip-pool-vlan20]network 192.168.20.0 mask 24

[dhcp-ip-pool-vlan20]gateway-list 192.168.20.254

[dhcp-ip-pool-vlan20]dns-list 8.8.8.8

[dhcp-ip-pool-vlan20]q

[dhcp]ip pool vlan30

[dhcp-ip-pool-vlan30]network 192.168.30.0 mask 24

[dhcp-ip-pool-vlan30]gateway-list 192.168.30.254 mask 24

[dhcp-ip-pool-vlan30]gateway-list 192.168.30.254 mask 24

[dhcp-ip-pool-vlan30]gateway-list 192.168.30.254 mask 30

[dhcp-ip-pool-vlan30]gateway-list 192.168.30.254 mask 24

[dhcp-ip-pool-vlan30]gateway-list 192.168.30.254

[dhcp-ip-pool-vlan30]dns-list 8.8.8.8

[dhcp-ip-pool-vlan30]q

[dhcp]ip pool vlan40

[dhcp-ip-pool-vlan40]network 192.168.40.0 mask 24

 [dhcp-ip-pool-vlan40]gateway-list 192.168.40.254

[dhcp-ip-pool-vlan40]dns-list 8.8.8.8

[dhcp]ip pool vlan50

[dhcp-ip-pool-vlan50]network 192.168.50.0 mask 24

[dhcp-ip-pool-vlan50]gateway-list 192.168.50.254

[dhcp-ip-pool-vlan50]dns-list 8.8.8.8

 [dhcp]ip pool vlan60

[dhcp-ip-pool-vlan60]network 192.168.60.0 mask 24

[dhcp-ip-pool-vlan60]gateway-list 192.168.60.254

[dhcp-ip-pool-vlan60]dns-list 8.8.8.8

[dhcp-ip-pool-vlan60]q

[dhcp]int vlan 100

[dhcp-Vlanif100]dhcp select global

[dhcp-Vlanif100]q

[dhcp]ip route-static 0.0.0.0 0.0.0.0 192.168.100.1

六.获得ip并相互ping通

华为路由器上的 DHCP 配置(详细步骤)

华为路由器上的 DHCP 配置(详细步骤)