R0 F0/1------------SW0 F0/1
SW0 F0/24----------SW1 F0/24
SW0 F0/11----------PC0
F0/12----------PC1
F0/13----------PC2
SW1 F0/11----------PC3
F0/12----------PC4
F0/13----------PC5
实验目的
R0作为单臂路由使vlan11-13的PC机能互相访问,
并且作为DHCP服务器为VLAN11-13服务
R0: en
Conf t
Lin con 0
No exec-t #登陆不超时#
Logg sync #输入同步#
R0(config)#int f0/1.1
R0(config-subif)#encapsulation dot1Q 11(对vlan11进行802.1q封装,如此类推)
R0(config-subif)#ip add 192.168.11.1 255.255.255.0
R0(config-subif)#int f0/1.2
R0(config-subif)#en do 12
R0(config-subif)#ip add 192.168.12.1 255.255.255.0
R0(config-subif)#int f0/1.3
R0(config-subif)#en do 13
R0(config-subif)#ip add 192.168.13.1 255.255.255.0
R0(config-subif)#exit
R0(config)#ip dhcp po vlan11(为11.0网段建立DHCP地址池,如此类推)
R0(dhcp-config)#network 192.168.11.0 255.255.255.0
R0(dhcp-config)#def 192.168.11.1
R0(dhcp-config)#dns-server 192.168.11.1
R0(config)#ip dhcp po vlan12
R0(dhcp-config)#network 192.168.12.0 255.255.255.0
R0(dhcp-config)#def 192.168.12.1
R0(dhcp-config)#dns-server 192.168.12.1
R0(config)#ip dhcp po vlan13
R0(dhcp-config)#network 192.168.13.0 255.255.255.0
R0(dhcp-config)#def 192.168.13.1
R0(dhcp-config)#dns-server 192.168.13.1
R0(config)#ip dhcp excluded-address 192.168.11.1(地址池为网关保留IP地址)
R0(config)#ip dh ex 192.168.12.1
R0(config)#ip dh ex 192.168.13.1
R0操作到此结束
SW0
省略常规命令
SW0(vlan)#vtp server (思科独有,简历管理域,方便域之间vlan修改管理)
Device mode already VTP SERVER.
SW0(vlan)#vtp domain softbar.com
Changing VTP domain name from NULL to softbar.com
SW0(vlan)#vlan 11
VLAN 11 added:
Name: VLAN0011
SW0(vlan)#vlan 12
VLAN 12 added:
Name: VLAN0012
SW0(vlan)#vlan 13
VLAN 13 added:
Name: VLAN0013
SW0(vlan)#exit
APPLY completed.
Exiting....
SW0(config)#int f0/11
SW0(config-if)#sw ac vla 11
SW0(config-if)#sw mo ac
SW0(config-if)#int f0/12
SW0(config-if)#sw ac vl 12
SW0(config-if)#sw mo ac
SW0(config-if)#int f0/13
SW0(config-if)#sw ac vl 13
SW0(config-if)#sw mo ac
SW0(config-if)#int f0/1(f0/1和f0/24启用中继trunk,使各vlan能互通)
SW0(config-if)#sw mo tr
SW0(config-if)#int f0/24
SW0(config-if)#sw mo tr
SW1
SW1(vlan)#vtp server
SW1(vlan)#vtp domain softbar.com
加入VTP以后,vlan11-13自动生成,无需手动建立
SW1(config)#int f0/11
SW1(config-if)#sw ac vla 11
SW1(config-if)#sw mo ac
SW1(config-if)#int f0/12
SW1(config-if)#sw ac vl 12
SW1(config-if)#sw mo ac
SW1(config-if)#int f0/13
SW1(config-if)#sw ac vl 13
SW1(config-if)#sw mo ac
SW1(config-if)#int f0/24
SW1(config-if)#sw mo tr
PC0~PC2都能通过DHCP自动获取到IP,网关和dns
PC0(vlan11,192.168.11.2)能ping通PC2(vlan13,192.168.13.8)
本文出自 “叮叮����” 博客,谢绝转载!