DHCP中繼鏈路實驗

2021-10-07 14:56:14 字數 3883 閱讀 5898

dhcp中繼鏈路實驗

中繼鏈路的應用場景:

通常在dhcp分配網段過多的情況下,閘道器路由器上配置dhcp服務,壓力過大,一般我們用第二路由器,或則第二台dhcp伺服器來分擔業務

交換機配置命令:

sys[huawei]sys sw1

[sw1]v b 10 20

[sw1]inte***ce e0/0/01

[sw1-ethernet0/0/1]p l a

[sw1-ethernet0/0/1]p d v 10

[sw1-ethernet0/0/1]un sh

[sw1-ethernet0/0/1]p d v 10

[sw1-ethernet0/0/1]inte***ce e0/0/2

[sw1-ethernet0/0/2]p l a

[sw1-ethernet0/0/2]p d v 20

[sw1-ethernet0/0/2]un sh

[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

[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

[sw1-ethernet0/0/4]int g0/0/1

[sw1-gigabitethernet0/0/1]p l t

[sw1-gigabitethernet0/0/1]p t a v 10 20

[sw1-gigabitethernet0/0/1]un sh

交換機的命令就很簡單,就是配置介面,然後g介面配置了trunk鏈路

路由器配置命令:

sys[huawei]sys r1

[r1]dhcp enable

[r1]int g0/0/1.10 配置子介面位址

[r1-gigabitethernet0/0/1.10]dot1q termination vid 10

[r1-gigabitethernet0/0/1.10]ip add 192.168.10.1 24

[r1-gigabitethernet0/0/1.10]arp broadcast enable

[r1-gigabitethernet0/0/1.10]dhcp select relay 基於dhcp中繼

[r1-gigabitethernet0/0/1.10]dhcp relay server-ip 14.0.0.2 去14.0.0.2請求dhcp服務

[r1-gigabitethernet0/0/1.10]q

[r1]int g0/0/1.20

[r1-gigabitethernet0/0/1.20]dot1q termination vid 20

[r1-gigabitethernet0/0/1.20]ip add 192.168.20.1 24

[r1-gigabitethernet0/0/1.20]arp broadcast enable

[r1-gigabitethernet0/0/1.20]dhcp select relay

[r1-gigabitethernet0/0/1.20]dhcp relay server-ip 14.0.0.2

[r1-gigabitethernet0/0/1.20]q

[r1]int g0/0/1

[r1-gigabitethernet0/0/1]un sh

[r1-gigabitethernet0/0/1]q

[r1]int g0/0/0

[r1-gigabitethernet0/0/0]ip add 12.0.0.1 24

[r1-gigabitethernet0/0/0]un sh

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

[r1-gigabitethernet0/0/2]ip add 14.0.0.1 24

[r1-gigabitethernet0/0/2]un sh

[r1-gigabitethernet0/0/2]q

[r1]ip route-static 15.0.0.0 24 12.0.0.2

sys[huawei]sys r2

[r2]dhcp enable

[r2]int g0/0/0

[r2-gigabitethernet0/0/0]ip add 14.0.0.2 24

[r2-gigabitethernet0/0/0]dhcp select global

[r2-gigabitethernet0/0/0]q

[r2]ip pool dhcp15 這裡的15並非是乙個定值,可以隨意輸入

[r2-ip-pool-dhcp15]network 15.0.0.0 mask 24

[r2-ip-pool-dhcp15]gateway-list 15.0.0.1

[r2-ip-pool-dhcp15]dns-list 8.8.8.8 2.2.2.2

[r2-ip-pool-dhcp15]excluded-ip-address 15.0.0.100 15.0.0.200 配置位址池的範圍

[r2-ip-pool-dhcp15]static-bind ip-address 15.0.0.88 mac-address 5489-98ff-79ce 這裡繫結的mac位址,如無必要,可以不用繫結

[r2-ip-pool-dhcp15]q

[r2]ip pool dhcpv10

[r2-ip-pool-dhcpv10]network 192.168.10.0 mask 24

[r2-ip-pool-dhcpv10]gateway-list 192.168.10.1

[r2-ip-pool-dhcpv10]dns-list 8.8.8.8

[r2-ip-pool-dhcpv10]q

[r2]ip pool dhcpv20

[r2-ip-pool-dhcpv20]network 192.168.20.0 mask 24

[r2-ip-pool-dhcpv20]gateway-list 192.168.20.1

[r2-ip-pool-dhcpv20]dns-list 8.8.8.8 dns的解析位址,為了做實驗,也可以隨意配置,不過8.8.8.8和114.114.114.114是國際上都可以用的位址,生產環境中也可以使用

[r2-ip-pool-dhcpv20]q

[r2]ip route-static 0.0.0.0 0.0.0.0 14.0.0.1 這裡為了方便(其實就是為了偷懶),配置了預設路由

sys[huawei]sys r3

[r3]int g0/0/0

[r3-gigabitethernet0/0/0]ip add 12.0.0.2 24

[r3-gigabitethernet0/0/0]un sh

[r3-gigabitethernet0/0/0]q

[r3]dhcp enable

[r3]int g0/0/1

[r3-gigabitethernet0/0/1]ip add 15.0.0.1 24

[r3-gigabitethernet0/0/1]dhcp select relay

[r3-gigabitethernet0/0/1]d r s 14.0.0.2

[r3-gigabitethernet0/0/1]q

[r3]ip route-static 0.0.0.0 0.0.0.0 12.0.0.1

DHCP中繼實驗

1.按圖配置r1和r2的介面ip位址 2.在r2路由器配置dhcp伺服器,dhcp位址池192.168.1.0 24,閘道器位址192.168.1.254 24,dns位址114.114.114.114 3.在r1路由器開啟dhcp中繼 4.在r2路由器配置預設路由 5.測試是否成功 1.配置r1 ...

DHCP中繼實驗配置

了解了dhcp中繼的原理,但是對配置卻一竅不通。於是我在網上找了一些關於dhcp配置的文件學習如何配置,並做了乙個小的實驗。pc0和pc2劃分在vlan2 pc1和pc3劃分在vlan3 通過dhcp 伺服器給vlan2分配10.1.1.0 24的路由,vlan3分配10.1.2.0 24的路由。交...

DHCP中繼 單臂路由實驗

使各vlan中的pc能自動獲取ip位址 配置單臂路由和ospf全網互通。1 配置ip位址略 l3 sw1 config if no switchport 在三層交換機配置ip位址需要在介面關閉二層埠2 在sw1 3 上建立vlan並劃分給各個埠,並在相應的埠設定trunk埠sw1 config vl...