日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 综合教程 >内容正文

综合教程

如何配置DHCP中继服务

發布時間:2024/8/26 综合教程 29 生活家
生活随笔 收集整理的這篇文章主要介紹了 如何配置DHCP中继服务 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

通過本實驗掌握如何給不同網段配置DHCP,掌握DHCP中繼配置,了解ip help-address 作用,了解Cisco 路由器的DHCP的配置。也許你會配置DHCP,可是可能遇到的情況是很順利,有時你的DHCP服務器,和你DHCP 客戶端,并不是在同一個網段,而是需要DHCP 給不同的網段主機分配地址。




實驗拓撲:


實驗過程:

第一步:對路由器R1進行預配置

Router(config)#no ip do lo
Router(config)#line con 0
Router(config-line)#no exec-t
Router(config-line)#logg syn
Router(config-line)#host R1
R1(config)#do sh ip int bri
Interface IP-Address OK? Method Status Protocol
Ethernet0/0 unassigned YES unset administratively down down
Serial0/0 unassigned YES unset administratively down down
Ethernet1/0 unassigned YES unset administratively down down
Serial1/0 unassigned YES unset administratively down down
R1(config)#int e0/0
//配置接口的下描述信息
R1(config-if)#description Connection to R2_E0/0
R1(config-if)#ip add 12.0.0.1 255.255.255.0
R1(config-if)#no sh
R1(config-if)#end
R1(config)#int e1/0
R1(config-if)#description Connection to PC1
R1(config-if)#ip address 192.168.1.1 255.255.255.0
R1(config-if)#no sh
R1(config-if)#
*Mar 1 00:32:04.807: %LINK-3-UPDOWN: Interface Ethernet1/0, changed state to up
*Mar 1 00:32:05.807: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet1/0, changed state to up
R1(config-if)#*Mar 1 00:09:16.631: %SYS-5-CONFIG_I: Configured from console by console
R1#conf t
*Mar 1 00:09:17.499: %LINK-3-UPDOWN: Interface Ethernet0/0, changed state to up
R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
//配置遠程登錄的用戶名和密碼,如果用戶的級別為15,遠程登錄之后可以直接進入特權模式下
R1(config)#username admin privilege 15 password admin
R1(config)#line vty 0 4
R1(config-line)#login local
R1(config-line)#end
R1#
R1#

第二步:對路由器R2進行預配置

Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#host R2
R2(config)#no ip do lo
R2(config)#line con 0
R2(config-line)#no exec-t
R2(config-line)#logg syn
R2(config-line)#int e0/0
R1(config-if)#description Connection to R1_E0/0
R2(config-if)#ip add 12.0.0.2 255.255.255.0
R2(config-if)#no sh
R2(config-if)#exit
*Mar 1 00:10:09.331: %LINK-3-UPDOWN: Interface Ethernet0/0, changed state to up
*Mar 1 00:10:10.331: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0, changed state to up
R2(config)#username admin privilege 15 password admin
R2(config)#line vty 0 15
R2(config-line)#login local
R2(config-line)#end
*Mar 1 00:10:21.363: %SYS-5-CONFIG_I: Configured from console by console
R2#ping 12.0.0.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 12.0.0.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/4/4 ms
R2#

第三步:在R1運行動態路由協議,配置DHCP

R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
//配置動態路由協議,保證兩個不同的網段可以相互通信
R1(config)#router rip
R1(config-router)#ver 2
R1(config-router)#no au
R1(config-router)#net 12.0.0.1
R1(config-router)#net 192.168.1.1
R1(config-router)#exit
//開啟DCHP服務
R1(config)#service dhcp
R1(config)#no ip dhcp conflict logging
R1(config)#ip dhcp pool PC1_Subnet
R1(dhcp-config)#network 192.168.1.0 /24
R1(dhcp-config)#default-router 192.168.1.1
R1(dhcp-config)#domain-name cisco.com
R1(dhcp-config)#dns-server 218.30.19.40 61.134.1.4
R1(dhcp-config)#option 150 ip 192.168.1.10
R1(dhcp-config)#lease 7
R1(dhcp-config)#exit
R1(config)#ip dhcp excluded-address 192.168.1.1
R1(config)#ip dhcp excluded-address 192.168.1.10
R1(config)#ip dhcp pool PC2_Subnet
R1(dhcp-config)#network 172.16.1.0 /24
R1(dhcp-config)#default-router 172.16.1.1
R1(dhcp-config)#domain-name norvel.com
R1(dhcp-config)#dns-server 218.30.19.40 61.134.1.4
R1(dhcp-config)#option 150 ip 172.16.1.10
R1(dhcp-config)#lease 7
R1(dhcp-config)#exit
R1(config)#ip dhcp excluded-address 172.16.1.1
R1(config)#ip dhcp excluded-address 172.16.1.10
R1#show run | b ip dhcp
no ip dhcp conflict logging
ip dhcp excluded-address 192.168.1.1
ip dhcp excluded-address 192.168.1.10
ip dhcp excluded-address 172.16.1.1
ip dhcp excluded-address 172.16.1.10

ip dhcp pool PC1_Subnet
network 192.168.1.0 255.255.255.0
default-router 192.168.1.1
domain-name cisco.com
dns-server 218.30.19.40 61.134.1.4
option 150 ip 192.168.1.10
lease 7

ip dhcp pool PC2_Subnet
network 172.16.1.0 255.255.255.0
default-router 172.16.1.1
domain-name norvel.com
dns-server 218.30.19.40 61.134.1.4
option 150 ip 172.16.1.10
lease 7
R1(config)#

第四步:在R2運行動態路由協議,配置輔助地址

R1#telnet 12.0.0.2
Trying 12.0.0.2 ... Open
User Access Verification
Username:admin
Password:
R2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#int e1/0
R2(config-if)#ip ad 172.16.1.1 255.255.255.0
R2(config-if)#no sh
R2(config-if)#router rip
R2(config-router)#ver 2
R2(config-router)#no au
R2(config-router)#net 12.0.0.2
R2(config-router)#net 172.16.1.1
R2(config-router)#exit
R2(config)#int e1/0
//配置DHCP中繼地址
R2(config-if)#ip helper-address 12.0.0.1
R2(config-if)#
R1#sh ip int bri
Interface IP-Address OK? Method Status Protocol
Ethernet0/0 12.0.0.1 YES manual up up
Serial0/0 unassigned YES unset administratively down down
Ethernet1/0 192.168.1.1 YES manual up up
Serial1/0 unassigned YES unset administratively down down

第五步:在PC1PC2上查看獲得IP地址信息
開始-運行-cmd-ipconfig /all

如圖:PC2

如圖:PC1

第六步:查看交換機IP地址池和動態綁定信息

R1#show ip dhcp binding
Bindings from all pools not associated with VRF:
IP address Client-ID/ Lease expiration Type
Hardware address/
User name
172.16.1.2 0100.8045.2984.f2 Mar 08 1993 12:52 AM Automatic
192.168.1.2 0100.16d3.249f.fd Mar 08 1993 12:51 AM Automatic
R1#
R1#show ip dhcp pool
Pool PC1_Subnet :
Utilization mark (high/low) : 100 / 0
Subnet size (first/next) : 0 / 0
Total addresses 254
Leased addresses 1
Pending event none
1 subnet is currently in the pool :
Current index IP address range Leased addresses
192.168.1.3 192.168.1.1 - 192.168.1.254 1
Pool PC2_Subnet :
Utilization mark (high/low) : 100 / 0
Subnet size (first/next) : 0 / 0
Total addresses : 254
Leased addresses : 1
Pending event : none
1 subnet is currently in the pool :
Current index IP address range Leased addresses
172.16.1.3 172.16.1.1 - 172.16.1.254 1
R1#
R1#sh ip ro
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
172.16.0.0/24 is subnetted, 1 subnets
R 172.16.1.0 [120/1] via 12.0.0.2, 00:00:24, Ethernet0/0
12.0.0.0/24 is subnetted, 1 subnets
C 12.0.0.0 is directly connected, Ethernet0/0
C 192.168.1.0/24 is directly connected, Ethernet1/0
R1#debug ip dhcp server events
R1#
*Mar 1 01:12:33.367: DHCPD: assigned IP address 172.16.1.2 to client 0100.8045.2984.f2.
R1#telnet 12.0.0.2
Trying 12.0.0.2 ... Open
User Access Verification
Username:admin
Password:
R2#sh run int e1/0
interface Ethernet1/0
ip address 172.16.1.1 255.255.255.0
ip helper-address 12.0.0.1
half-duplex

第七步:測試全網互聯互通

C:\ping 172.16.1.1
Pinging 172.16.1.1 with 32 bytes of data:

Reply from 172.16.1.1: bytes=32 time=2ms TTL=255
Reply from 172.16.1.1: bytes=32 time=2ms TTL=255
Ping statistics for 172.16.1.1:
Packets: Sent = 2, Received = 2, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 2ms, Maximum = 2ms, Average = 2ms
Control-C
^C
C:\ping 12.0.0.2
Pinging 12.0.0.2 with 32 bytes of data:

Reply from 12.0.0.2: bytes=32 time=2ms TTL=255

Ping statistics for 12.0.0.2:
Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 2ms, Maximum = 2ms, Average = 2ms
Control-C
^C
C:\ping 12.0.0.1

Pinging 12.0.0.1 with 32 bytes of data:

Reply from 12.0.0.1: bytes=32 time=2ms TTL=254
Reply from 12.0.0.1: bytes=32 time=2ms TTL=254

Ping statistics for 12.0.0.1:
Packets: Sent = 2, Received = 2, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 2ms, Maximum = 2ms, Average = 2ms
Control-C
^C
C:\ping 192.168.1.1

Pinging 192.168.1.1 with 32 bytes of data:

Reply from 192.168.1.1: bytes=32 time=3ms TTL=254
Ping statistics for 192.168.1.1:
Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 3ms, Maximum = 3ms, Average = 3ms
Control-C
^C
C:\ping 192.168.1.2

Pinging 192.168.1.2 with 32 bytes of data:

Reply from 192.168.1.2: bytes=32 time=5ms TTL=126

Ping statistics for 192.168.1.2:
Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 5ms, Maximum = 5ms, Average = 5ms
Control-C
^C

總結

以上是生活随笔為你收集整理的如何配置DHCP中继服务的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。