一、给路由器安装上模块
路由器0、1、2都接上模块TX
二、端口IP配置
路由器2:
Router>enable
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#interface fa0/1
Router(config-if)#ip address 172.16.10.254 255.255.255.0
Router(config-if)#no shut
路由器1:
Router>enable
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#interface fa0/0
Router(config-if)#ip addr 192.168.10.254 255.255.255.0
Router(config-if)#no shut
Router(config-if)#exit
Router(config)#interface fa0/1
Router(config-if)#ip addr 172.16.10.253 255.255.255.0
Router(config-if)#no shut
路由器0:
Router>enable
Router#config t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#interface fa0/0
Router(config-if)#ip address dhcp(打开dhcp端口)
Router(config-if)#no shut
此时端口绿了
三、配置dhcp服务器
Router(config)#ip dhcp pool pool1(地址池取名为pool1)
Router(dhcp-config)#network 192.168.10.0 255.255.255.0(给192.168.10.1地址段分配IP)
Router(dhcp-config)#default-router 192.168.10.254(网关)
Router(dhcp-config)#dns-server 10.10.10.1(dns服务器随便设一个)
Router(config)#ip dhcp excluded-address 192.168.10.250 192.168.10.254(10.250-254网段不分配IP)
四、配置dhcp助手
路由器1:
Router>enable
Router#configure terminal
Router(config)#interface fa0/0
Router(config-if)#ip helper-address 172.16.10.254(路由器1的0/0对应dhcp服务器的IP地址)
Router(config-if)#exit
Router(config)#ip forward-protocol udp(用udp协议转发)
五、给路由器设置下一跳
路由器2:
Router(config)#ip route 192.168.10.0 255.255.255.0 172.16.10.253
路由器0:
Router(config)#ip route 172.16.10.0 255.255.255.0 192.168.10.254
六、查看是否可以自动获取到IP地址
路由器0:
Router#show ip interface brief
查看获取到了IP地址为192.168.10.4