初談DHCP中繼原理和配置


DHCP中繼應用場景

                  通常在DHCP分配網段過多的情況下,網關路由器上配置DHCP服務壓力過大,用路由器或第二台DHCP服務器來分擔業務。

以下通過一個實驗詮釋DHCP中繼的配置

      

LSW1

<Huawei>

<Huawei>un te m

Info: Current terminal monitor is off.

<Huawei>sys

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

[Huawei]sys SW1

[SW1]int e0/0/1

[SW1-Ethernet0/0/1]q

[SW1]vlan b 10 20

Info: This operation may take a few seconds. Please wait for a moment...done.

[SW1]int e0/0/1

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

[SW1-Ethernet0/0/1]port default vlan 10

[SW1-Ethernet0/0/1]un sh

Info: Interface Ethernet0/0/1 is not shutdown.

[SW1-Ethernet0/0/1]int e0/0/2

[SW1-Ethernet0/0/2]p l a

[SW1-Ethernet0/0/2]p d v 20

[SW1-Ethernet0/0/2]un sh

Info: Interface Ethernet0/0/2 is not shutdown.

[SW1-Ethernet0/0/2]int e0/0/3

[SW1-Ethernet0/0/3]p l a

[SW1-Ethernet0/0/3]p d v 10

[SW1-Ethernet0/0/3]un sh

Info: Interface Ethernet0/0/3 is not shutdown.

[SW1-Ethernet0/0/3]int e0/0/4

[SW1-Ethernet0/0/4]p l a

[SW1-Ethernet0/0/4]p d v 20

[SW1-Ethernet0/0/4]un sh

Info: Interface Ethernet0/0/4 is not shutdown.

[SW1-Ethernet0/0/4]int g0/0/1

[SW1-GigabitEthernet0/0/1]p l t

[SW1-GigabitEthernet0/0/1]p t a v a

[SW1-GigabitEthernet0/0/1]q

R1

<Huawei>un te m

Info: Current terminal monitor is off.

<Huawei>sys

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

[Huawei]sys R1

[R1]int g0/0/0

[R1-GigabitEthernet0/0/0]ip add 14.0.0.2 24

[R1-GigabitEthernet0/0/0]dhcp se

[R1-GigabitEthernet0/0/0]dhcp select gl

[R1-GigabitEthernet0/0/0]dhcp select global

Error: Please enable DHCP in the global view first.

[R1-GigabitEthernet0/0/0]q

[R1]dhcp en

[R1]dhcp enable ##開啟DHCP服務

Info: The operation may take a few seconds. Please wait for a moment.done.

[R1]in g0/0/0

[R1-GigabitEthernet0/0/0]dhcp select global(請求DHCP服務)

[R1-GigabitEthernet0/0/0]q

[R1]ip pool DHCP(設置地址池)

[R1]ip pool DHCP15.0.0.0

Info: It's successful to create an IP address pool.

[R1-ip-pool-DHCP15.0.0.0]netw

[R1-ip-pool-DHCP15.0.0.0]network 15.0.0.0 m 24(設置網段)

[R1-ip-pool-DHCP15.0.0.0]gate

[R1-ip-pool-DHCP15.0.0.0]gateway-list 15.0.0.1(設置網關)

[R1-ip-pool-DHCP15.0.0.0]dns

[R1-ip-pool-DHCP15.0.0.0]dns-list 8.8.8.8 2.2.2.2(設置dns)

[R1-ip-pool-DHCP15.0.0.0]q

[R1]ip pool DHCPvlan10

Info: It's successful to create an IP address pool.

[R1-ip-pool-DHCPvlan10]netw

[R1-ip-pool-DHCPvlan10]network 192.168.10.0 m 24

[R1-ip-pool-DHCPvlan10]gat

[R1-ip-pool-DHCPvlan10]gateway-list 192.168.10.1

[R1-ip-pool-DHCPvlan10]dns

[R1-ip-pool-DHCPvlan10]dns-list 8.8.8.8 2.2.2.2

[R1-ip-pool-DHCPvlan10]q

[R1]ip pool DHCP

[R1]ip pool DHCPVLAN20

Info: It's successful to create an IP address pool.

[R1-ip-pool-DHCPVLAN20]netw

[R1-ip-pool-DHCPVLAN20]network 192.168.20.0 m 24

[R1-ip-pool-DHCPVLAN20]gat

[R1-ip-pool-DHCPVLAN20]gateway-list 192.168.20.1

[R1-ip-pool-DHCPVLAN20]dns

[R1-ip-pool-DHCPVLAN20]dns-list 8.8.8.8 2.2.2.2

[R1-ip-pool-DHCPVLAN20]q

[R1]ip route-s

[R1]ip route-static 0.0.0.0 0.0.0.0 14.0.0.1

R2

<Huawei>sys

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

[Huawei]sys R2

[R2]q

<R2>un te m

Info: Current terminal monitor is off.

<R2>sys

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

[R2]int g0/0/2

[R2-GigabitEthernet0/0/2]ip add 14.0.0.1 24

[R2]int g0/0/0

[R2-GigabitEthernet0/0/0]ip add 12.0.0.1 24

[R2]int g0/0/1

[R2-GigabitEthernet0/0/1]un sh

Info: Interface GigabitEthernet0/0/1 is not shutdown.

[R2-GigabitEthernet0/0/1]int g0/0/1.10

[R2-GigabitEthernet0/0/1.10]dot1q termination vid 10(該接口屬於vlan10)

[R2-GigabitEthernet0/0/1.10]ip add 192.168.10.1 24

[R2-GigabitEthernet0/0/1.10]arp broadcast enable(開啟arp廣播

[R2-GigabitEthernet0/0/1.10]un sh

Info: Interface GigabitEthernet0/0/1.10 is not shutdown.

[R2-GigabitEthernet0/0/1.10]int g0/0/1.20

[R2-GigabitEthernet0/0/1.20]d t v 20

[R2-GigabitEthernet0/0/1.20]ip add 192.168.20.1 24

[R2-GigabitEthernet0/0/1.20]a b e

[R2-GigabitEthernet0/0/1.20]un sh

Info: Interface GigabitEthernet0/0/1.20 is not shutdown.

[R2-GigabitEthernet0/0/1.20]q

[R2]dhcp en

[R2]dhcp enable

Info: The operation may take a few seconds. Please wait for a moment.done.

[R2]int g0/0/1.10(子接口下宣告DHCP中繼)

[R2-GigabitEthernet0/0/1.10]dhcp se

[R2-GigabitEthernet0/0/1.10]dhcp select ?

  global     Local server

  interface  Interface server pool

  relay      DHCP relay(選擇relay)

[R2-GigabitEthernet0/0/1.10]dhcp select relay(基於DHCP中繼)

[R2-GigabitEthernet0/0/1.10]dhcp re

[R2-GigabitEthernet0/0/1.10]dhcp relay se

[R2-GigabitEthernet0/0/1.10]dhcp relay server-ip 14.0.0.2

[R2-GigabitEthernet0/0/1.10]int g0/0/1.20

[R2-GigabitEthernet0/0/1.20]dhcp sel

[R2-GigabitEthernet0/0/1.20]dhcp select re

[R2-GigabitEthernet0/0/1.20]dhcp select relay

[R2-GigabitEthernet0/0/1.20]d r s 14.0.0.2

[R2-GigabitEthernet0/0/1.20]un sh

Info: Interface GigabitEthernet0/0/1.20 is not shutdown.

[R2-GigabitEthernet0/0/1.20]q

[R2]ip route-s

[R2]ip route-static 15.0.0.1 24 12.0.0.2(設置靜態路由)

R3

<R3>sys

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

[R3]int g0/0/0

[R3-GigabitEthernet0/0/0]ip add 12.0.0.2 24

[R3-GigabitEthernet0/0/0]un sh

Info: Interface GigabitEthernet0/0/0 is not shutdown.

[R3-GigabitEthernet0/0/0]q

[R3]int g0/0/1

[R3-GigabitEthernet0/0/1]q

[R3]dhcp en

[R3]dhcp enable

Info: The operation may take a few seconds. Please wait for a moment.done.

[R3]int g0/0/1

[R3-GigabitEthernet0/0/1]ip add 15.0.0.1 24

[R3-GigabitEthernet0/0/1]dhcp sel

[R3-GigabitEthernet0/0/1]dhcp select re

[R3-GigabitEthernet0/0/1]dhcp select relay

[R3-GigabitEthernet0/0/1]dhcp re

[R3-GigabitEthernet0/0/1]dhcp relay se

[R3-GigabitEthernet0/0/1]dhcp relay server-ip 14.0.0.2

[R3-GigabitEthernet0/0/1]un sh

Info: Interface GigabitEthernet0/0/1 is not shutdown.

[R3-GigabitEthernet0/0/1]q

[R3]ip ro

[R3]ip route-static 0.0.0.0 0.0.0.0 12.0.0.1(設置默認路由)

設置結束后,打開PC5,設置獲取ip檢驗

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM