您好,登录后才能下订单哦!
DHCP 的应用实验
实验要求:
Pc 通过dhcp获取IP地址
规划如图
实验步骤:
1.交互机sw1的配置
sw1(config)#vlan 10,20     先创建vlan10和vlan20 ,这边注意,一定要创两个,相连的
sw1(config-vlan)#exit
sw1(config)#int f1/0
sw1(config-if)#switchport mode access 
sw1(config-if)#switchport access vlan 10    添加端口
sw1(config-if)#exit 
sw1(config)#int range f1/14 -15       设置中继口,配置多个端口命令
sw1(config-if-range)#switchport trunk encapsulation dot1q 
sw1(config-if-range)#switchport mode trunk 
2.交互机sw2的配置
sw2(config)#vlan 10,20   这里可以只建一个vlan 20
sw2(config-vlan)#exit
sw2(config)#int f1/0
sw2(config-if)#switchport mode access 
sw2(config-if)#switchport access vlan 20
sw2(config-if)#int f1/14
sw2(config-if)#switchport trunk encapsulation d
sw2(config-if)#switchport mode trunk 
3.路由器R1的配置
R1(config)#int f0/1     得先配IP,即网关地址,运用到单臂路由
R1(config-if)#no shut    一定要先开启端口,
R1(config-if)#int f0/1.10
R1(config-subif)#encapsulation dot1Q 10  后面的数字是表示vlan几的
R1(config-subif)#ip add 192.168.10.1 255.255.255.0
R1(config-subif)#no shut     再次开启子端口
R1(config-subif)#int f0/1.20
R1(config-subif)#encapsulation dot1Q 20
R1(config-subif)#ip add 192.168.20.1 255.255.255.0
R1(config-subif)#no shut
R1(config)#service dhcp        开启dhcp服务
R1(config)#ip dhcp pool vlan 10  (vlan10是没有空格的)
^
% Invalid input detected at '^' marker.
R1(config)#ip dhcp pool vlan10     进入vlan10,给vlan10的pc服务器配dhcp
R1(dhcp-config)#network 192.168.10.0/24
^
% Invalid input detected at '^' marker.
R1(dhcp-config)#network 192.168.10.0 /24  设置地址池,/24和前面的网段有空格)
R1(dhcp-config)#def
R1(dhcp-config)#default-router 192.168.10.1  配网关
R1(dhcp-config)#dns-server 2.2.2.2          配dns
R1(dhcp-config)#exit
R1(config)#ip dhcp pool vlan20        
R1(dhcp-config)#network 192.168.20.0 /24   
R1(dhcp-config)#default-router 192.168.20.1
R1(dhcp-config)#dns-server 2.2.2.2         
R1(dhcp-config)#exit            
4.测试
进入pc端,输入dhcp,其自动获取IP地址。
5.一些查看命令

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。