Cắm dây cho đúng port và đặt hostname các thiết bị như hình vẽ.. Router#configure terminal Routerconfig#hostname R1 2.. Đặt IP thích hợp cho các interface của Router và PC.. Cấu hình trá
Trang 1A DHCP
1 Cắm dây cho đúng port và đặt hostname các thiết bị như hình vẽ
Router#configure terminal
Router(config)#hostname R1
2 Đặt IP thích hợp cho các interface của Router và PC
R1#configure terminal
R1(config)#interface fastEthernet 0/0
R1(config-if)#ip address 192.168.1.1 255.255.255.0
R1(config-if)#no shutdown
3 Cấu hình tránh trôi theo con trỏ chuột khi hiện các thông báo
R1#configure terminal
R1(config)#line console 0
R1(config-line)#logging synchronous
4 Tắt chế độ phân giải tên miền (domain-lookup)
R1#configure terminal
R1(config)#no ip domain-lookup
5 Cài đặt DHCP trên R1 để cấp được IP cho máy tính
Dãy IP: 192.168.1.0 /24
Default Gateway: 192.168.1.1
DNS: 8.8.8.8 và 8.8.4.4
Domain name: vnpro.org
Dãy IP dành riêng, không cấp cho máy tính: 192.168.1.2 192.168.1.10 Thời hạn được sử dụng IP là 1 ngày 7 giờ 20 phút
R1(config)#service dhcp
R1(config)#ip dhcp pool Mang_192.168.1.0
R1(dhcp-config)#network 192.168.1.0 255.255.255.0
R1(dhcp-config)#default-router 192.168.1.1
R1(dhcp-config)#dns-server 8.8.8.8 8.8.4.4
R1(dhcp-config)#domain-name vnpro.org
R1(dhcp-config)#lease 1 7 20
R1(dhcp-config)#exit
R1(config)#ip dhcp excluded-address 192.168.1.2 192.168.1.10
6 Kiểm tra lại thông tin IP được cấp
Trang 2B.DHCP Relay Agent:
1 R2 có IP 2.2.2.2 bao giờ cũng mở Cấu hình để R1 truy cập được đến IP 2.2.2.2
R2# configure terminal
R2(config)#interface loopback 0
R2(config-if)#ip address 2.2.2.2 255.255.255.0
R2(config-if)#exit
R2(config)#interface fa0/0
R2(config-if)#ip add 192.168.12.2 255.255.255.0
R2(config-if)#no shutdown
R1#configure terminal
R1(config)#interface fa0/0
R1(config-if)#ip address 192.168.12.1 255.255.255.0
R1(config-if)#no shutdown
R1(config)#interface fa0/1
R1(config-if)#ip address 192.168.1.1 255.255.255.0
R1(config-if)#no shutdown
R1(config)#router
R1(config)#router rip
Trang 3R1(config-router)#version 2
R1(config-router)#network 192.168.1.0
R1(config-router)#network 192.168.12.0
R2(config)#router rip
R2(config-router)#version 2
R2(config-router)#network 192.168.12.0
R2(config-router)#network 2.0.0.0
R1#show ip route
………
Gateway of last resort is not set
C 192.168.12.0/24 is directly connected, FastEthernet0/0
R 2.0.0.0/8 [120/1] via 192.168.12.2, 00:00:11, FastEthernet0/0
C 192.168.1.0/24 is directly connected, FastEthernet0/1
R1#ping 2.2.2.2
Type escape sequence to abort
Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 28/36/60 ms
2 Cấu hình để R2 cấp IP cho các máy tính bên cổng Fa0/1 của R1
R2(config)#service dhcp
R2(config)#ip dhcp pool Cap_IP_cho_mang_cua_R1
R2(dhcp-config)#network 192.168.1.0 /24
R2(dhcp-config)#default-router 192.168.1.1 255.255.255.0
R2(dhcp-config)#dns-server 203.162.4.190 203.162.4.191
R1(config)#interface fa0/1
R1(config-if)#ip helper-address 2.2.2.2
3 Kiểm tra, chụp bắt các gói tin DHCP
R1#debug ip dhcp server packet
R1#
*Mar 1 00:15:14.583: DHCPD: Finding a relay for client c808.0420.0000 on interface
FastEthernet0/1
*Mar 1 00:15:14.583: DHCPD: setting giaddr to 192.168.1.1
*Mar 1 00:15:14.587: DHCPD: BOOTREQUEST from c808.0420.0000 forwarded to 2.2.2.2
*Mar 1 00:15:17.731: DHCPD: forwarding BOOTREPLY to client c808.0420.0000
*Mar 1 00:15:17.731: DHCPD: creating ARP entry (192.168.1.2, c808.0420.0000)
*Mar 1 00:15:17.731: DHCPD: unicasting BOOTREPLY to client c808.0420.0000 (192.168.1.2) R1#
*Mar 1 00:15:19.747: DHCPD: forwarding BOOTREPLY to client c808.0420.0001
*Mar 1 00:15:19.747: DHCPD: creating ARP entry (192.168.1.3, c808.0420.0001)
*** THE END ***