版权声明:如果对大家有帮助,大家可以自行转载的。https://blog.csdn.net/qq_37992321/article/details/84932054
1.技术目的
自动获取IP地址
2.拓扑图
3.配置PC
PC0和PC1自动获取IP地址
4.配置路由器各个接口的IP地址
Router0
Router>en
Router#config t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int f0/0
Router(config-if)#ip add 192.168.10.1 255.255.255.0
Router(config-if)#no shuRouter(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to upRouter(config-if)#int s2/0
Router(config-if)#ip add 12.1.1.1 255.255.255.0
Router(config-if)#no shu
Router1
Router>en
Router#config t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int s2/0
Router(config-if)#ip add 12.1.1.2 255.255.255.0
Router(config-if)#no shuRouter(config-if)#Interface f0/0
Router(config-if)#ip add 192.168.11.1 255.255.255.0
Router(config-if)#no shu
5.配置路由器的静态路由使得全网互通
Router0
Router(config)#ip route 192.168.11.0 255.255.255.0 12.1.1.2
Router1
Router(config)#ip route 192.168.10.0 255.255.255.0 12.1.1.1
6.配置DHCP
Router0
Router(config)#ip route 192.168.11.0 255.255.255.0 12.1.1.2
Router(config)#
Router(config)#ip dhcp pool pool1
Router(dhcp-config)#net
Router(dhcp-config)#network 192.168.10.0 255.255.255.0
Router(dhcp-config)#dns-server 218.2.135.1
Router(dhcp-config)#default-router 192.168.10.1
Router(dhcp-config)#exit
Router(config)#ip dhcp pool pool2
Router(dhcp-config)#net
Router(dhcp-config)#network 192.168.11.0 255.255.255.0
Router(dhcp-config)#dns-server 218.2.135.1
Router(dhcp-config)#default-router 192.168.11.1
Router(dhcp-config)#exit
Router(config)#ip dhcp excluded-address 192.168.10.1
Router(config)#no ip dhcp excluded-address 192.168.11.1
Router1(配置DHCP中继)
Router2(config-if)#ip helper-address 12.1.1.1
7.网络测试
如果两台PC自动获得了192.168.10.0/24和192.168.11.0/24的地址那就成功了,要是获得了一个169.254.0.0/16,那就说明哪里出问题了
8.给大家留个问题吧 如果用三层交换机代替路由器应该怎么做呢?