赞
踩
局域网网络协议,用于管理和分配IP地址,使用UDP协议工作,常用的端口是67(server),68(client)
拓扑图:
1:为sw0,sw1划分vlan,sw0为vlan10,sw1为vlan20.
Switch>en
Switch#config terminal
Enter configuration commands, one per line. End with CNTL/Z.
SW0(config)#vlan 10
SW0(config-vlan)#interface vlan 10
SW0(config-if)#
%LINK-5-CHANGED: Interface Vlan10, changed state to up
SW0(config)#interface f0/1
SW0(config-if)#switchport mode access
SW0(config-if)#switchport access vlan 10
SW0(config-if)#interface g0/1
SW0(config-if)#switchport mode trunk
SW0(config-if)#switchport trunk allowed vlan 10,20
SW0(config-if)#exit
Switch>en
Switch#config terminal
Enter configuration commands, one per line. End with CNTL/Z.
SW1(config)#vlan 20
SW1(config-vlan)#interface vlan 20
SW1(config-if)#
%LINK-5-CHANGED: Interface Vlan10, changed state to up
SW1(config)#interface f0/1
SW1(config-if)#switchport mode access
SW1(config-if)#switchport access vlan 20
SW1(config-if)#interface f0/2
SW1(config-if)#switchport mode trunk
SW1(config-if)#switchport trunk allowed vlan 10,20
SW1(config-if)#exit
//进入特权模式 Switch(config)#vlan 10 Switch(config-vlan)#interface vlan 10 Switch(config-if)#ip address 192.168.1.1 255.255.255.0 Switch(config-if)#exit Switch(config)#vlan 20 Switch(config-vlan)#interface vlan 20 Switch(config-if)#ip address 192.168.2.1 255.255.255.0 Switch(config)#interface g0/1 Switch(config-if)#no shutdown Switch(config-if)#switchport mode trunk Switch(config-if)#switchport trunk allowed vlan 10,20 Switch(config-if)#switchport trunk encapsulation dot1q Switch(config-if)#no shutdown Switch(config-if)#interface f0/2 Switch(config-if)#switchport mode trunk Switch(config-if)#switchport trunk allowed vlan 10,20 Switch(config-if)#switchport trunk encapsulation dot1q Switch(config-if)#no shutdown Switch(config)#ip routing //开启路由功能 Switch(config)#ip dhcp pool wsy //地址池为wsy Switch(dhcp-config)#network 192.168.10.0 255.255.255.0 //宣告网络 Switch(dhcp-config)#default-router 192.168.10.2 //设置默认路由 Switch(dhcp-config)#dns-server 8.8.8.8 //设置一个dns服务IP Switch(dhcp-config)#exit Switch(config)#ip route 192.168.10.0 255.255.255.0 192.168.20.2 //下一跳就去服务器
Router>en
Router#configure terminal
Router(config)#interface gigabitEthernet 0/0/0
Router(config-if)#ip address 192.168.20.2 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#interface g0/0/1
Router(config-if)#ip address 192.168.10.2 255.255.255.0
Router(config-if)#no shutdown
Router(config)#ip route 192.168.1.0 255.255.255.0 192.168.20.1
Router(config)#ip route 192.168.2.0 255.255.255.0 192.168.20.1
为服务器配置好DHCP
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。