單臂路由+dhcp服務器+dhcp中繼代理服務器
阿新 • • 發佈:2019-05-08
靜態 arp 自動 inf server ipconfig out 啟用 ima 創建拓撲:
基本思路:
1)啟用dhcp服務
2)創建三個地址池
3)設置子接口
4) 設置物理接口
5)設置靜態路由
6) 配置中繼代理服務器
具體操作如下:
1)啟用dhcp服務
[dhcp]dhcp enable
2)創建三個地址池
[dhcp]ip pool xixi
[dhcp-ip-pool-v1]network 192.168.10.0 mask 24
[dhcp-ip-pool-v1]gateway-list 192.168.10.1
[dhcp]ip pool hehe
[dhcp-ip-pool-v2]network 192.168.20.0 mask 24
[dhcp-ip-pool-v2]gateway-list 192.168.20.1
[dhcp]ip pool haha
[dhcp-ip-pool-haha]network 192.168.2.0 mask 24
[dhcp-ip-pool-haha]gateway-list 192.168.2.1
3)設置子接口
[dhcp]int g0/0/0.1
[dhcp-GigabitEthernet0/0/0.1]dot1q termination vid 10
[dhcp-GigabitEthernet0/0/0.1]ip add 192.168.10.1 24
[dhcp-GigabitEthernet0/0/0.1]arp broadcast enable
[dhcp-GigabitEthernet0/0/0.1]dhcp select global
[dhcp-GigabitEthernet0/0/0.1]int g0/0/0.2
[dhcp-GigabitEthernet0/0/0.2]dot1q termination vid 20
[dhcp-GigabitEthernet0/0/0.2]ip add 192.168.20.1 24
[dhcp-GigabitEthernet0/0/0.2]arp broadcast enable
[dhcp-GigabitEthernet0/0/0.2]dhcp select global
4)設置物理接口
[dhcp]int g0/0/1
[dhcp-GigabitEthernet0/0/1]ip add 192.168.1.1 24
[dhcp-GigabitEthernet0/0/1]dhcp select global
5)設置靜態路由
[dhcp]ip route-static 192.168.2.0 24 192.168.1.2
6)配置中繼代理服務器
[relay]dhcp enable //啟動dhcp服務
基本思路:
1)啟用dhcp服務
2)創建三個地址池
3)設置子接口
4) 設置物理接口
5)設置靜態路由
6) 配置中繼代理服務器
具體操作如下:
1)啟用dhcp服務
[dhcp]dhcp enable
2)創建三個地址池
[dhcp]ip pool xixi
[dhcp-ip-pool-v1]network 192.168.10.0 mask 24
[dhcp-ip-pool-v1]gateway-list 192.168.10.1
[dhcp]ip pool hehe
[dhcp-ip-pool-v2]network 192.168.20.0 mask 24
[dhcp-ip-pool-v2]gateway-list 192.168.20.1
[dhcp-ip-pool-haha]network 192.168.2.0 mask 24
[dhcp-ip-pool-haha]gateway-list 192.168.2.1
3)設置子接口
[dhcp]int g0/0/0.1
[dhcp-GigabitEthernet0/0/0.1]dot1q termination vid 10
[dhcp-GigabitEthernet0/0/0.1]ip add 192.168.10.1 24
[dhcp-GigabitEthernet0/0/0.1]arp broadcast enable
[dhcp-GigabitEthernet0/0/0.1]dhcp select global
[dhcp-GigabitEthernet0/0/0.2]dot1q termination vid 20
[dhcp-GigabitEthernet0/0/0.2]ip add 192.168.20.1 24
[dhcp-GigabitEthernet0/0/0.2]arp broadcast enable
[dhcp-GigabitEthernet0/0/0.2]dhcp select global
4)設置物理接口
[dhcp]int g0/0/1
[dhcp-GigabitEthernet0/0/1]ip add 192.168.1.1 24
[dhcp-GigabitEthernet0/0/1]dhcp select global
[dhcp]ip route-static 192.168.2.0 24 192.168.1.2
6)配置中繼代理服務器
[relay]dhcp enable //啟動dhcp服務
[relay]int g0/0/0
[relay-GigabitEthernet0/0/0]ip add 192.168.2.1 24
[relay-GigabitEthernet0/0/0]int g0/0/1
[relay-GigabitEthernet0/0/1]ip add 192.168.1.2 24
[relay]ip route-static 0.0.0.0 0.0.0.0 192.168.1.1 //設置默認路由
[relay]int g0/0/0
[relay-GigabitEthernet0/0/0]dhcp select relay //啟用dhcp中繼代理模式
[relay-GigabitEthernet0/0/0]dhcp relay server-ip 192.168.1.1 //指定dhcp服務器ip地址
全部配置完之後在PC機的基礎配置裏ipv4配置dhcp自動獲取IP地址選中,點擊應用
在命令行裏輸入“ipconfig”自動獲取IP地址
自動獲取IP地址的時候也可以抓包看一下“首次接入”的過程
自動獲取IP地址後,三臺PC機互ping,查看連通性
實驗完成
單臂路由+dhcp服務器+dhcp中繼代理服務器