实验三 三层交换与DHCP中继
一、
实验目的
(1)
实验企业分支局域网二层广播域VLAN隔离和三层全网通
(2)
实现企业分支局域网的PC使用DHCP自动获取IP地址及DNS。
二、
实验拓扑图
三、
实验步骤及结果
1、
基本配置
SW1
的基本配置:
Router>
Router>en
Router#config terminal
Router(config)#hostname SW1
SW1(config)#no ip domain-lookup
SW1(config)#line console 0
SW1(config-line)#logging synchronous
SW1(config-line)#no login
SW1(config-line)#privilege level 15
SW1(config-line)#line vty 0 4
SW1(config-line)#no login
SW1(config-line)#privilege level 15
SW3
的基本配置:
Switch>en
Switch#
Switch#config terminal
Switch(config)#hostname SW3
SW3(config)#no ip domain-lookup
SW3(config)#line console 0
SW3(config-line)# logging synchronous
SW3(config-line)#exec-timeout 0 0
SW3(config-line)#no login
SW3(config-line)#privilege level 15
SW3(config-line)#line vty 0 4
SW3(config-line)#no login
SW3(config-line)#privilege level 15
SW4
的基本配置:
Switch#config terminal
Switch(config)#hostname SW4
SW4(config)#no ip domain-lookup
SW4(config)#line console 0
SW4(config-line)#logging synchronous
SW4(config-line)#no login
SW4(config-line)#privilege level 15
SW4(config-line)#line vty 0 4
SW4(config-line)#no login
SW4(config-line)#privilege level 15
RT5
的基本配置:
Router>enable
Router#config termianl
Router#config terminal
Router(config)#hostname RT5
RT5(config)#no ip domain-lookup
RT5(config)#line console 0
RT5(config-line)#logging synchronous
RT5(config-line)#no login
RT5(config-line)#privilege level 15
RT5(config-line)#line vty 0 4
RT5(config-line)#privilege level 15
2、
三层网络的全网连通
(1)SW1的配置
SW1#vlan database
SW1(vlan)#vlan 8 name wg
VLAN 8 added:
Name: wg
SW1(vlan)#vlan 10 name sc
VLAN 10 added:
Name: sc
SW1(vlan)#vlan 11 name bg
VLAN 11 added:
Name: bg
SW1(vlan)#vlan 12 name fw
VLAN 12 added:
Name: fw
SW1(vlan)#exit
APPLY completed.
Exiting....
SW1#config terminal
SW1(config)#interface fastethernet0/12
SW1(config-if)#switchport mode access
SW1(config-if)#switchport access vlan 12
SW1(config-if)#exit
SW1(config)#interface fastethernet0/1
SW1(config-if)#switchport trunk encapsulation dot1q
SW1(config-if)#switchport mode trunk
SW1(config-if)#switchport trunk allowed vlan all
SW1(config-if)#exit
SW1(config)#interface fastethernet0/2
SW1(config-if)#switchport trunk encapsulation dot1q
SW1(config-if)#switchport mode trunk
SW1(config-if)#switchport trunk allowed vlan all
SW1(config-if)#no shutdown
SW1(config-if)#exit
SW1(config)#int vlan 8
SW1(config-if)#ip address 192.168.8.129 255.255.255.128
SW1(config-if)#exit
SW1(config)#interface vlan 10
SW1(config-if)#ip address 192.168.10.1 255.255.255.0
SW1(config-if)#exit
SW1(config)#interface vlan 11
SW1(config-if)#ip address 192.168.11.1 255.255.255.0
SW1(config-if)#exit
SW1(config)#interface vlan 12
SW1(config-if)#ip
SW1(config-if)#ip address 192.168.12.1 255.255.255.0
SW1(config)#do show interface trunk
Port Mode Encapsulation Status Native vlan
Fa0/1 on 802.1q trunking 1
Fa0/2 on 802.1q trunking 1
Port Vlans allowed on trunk
Fa0/1 1-1005
Fa0/2 1-1005
Port Vlans allowed and active in management domain
Fa0/1 1,8,10-12
Fa0/2 1,8,10-12
Port Vlans in spanning tree forwarding state and not pruned
Fa0/1 1,8,10-12
Fa0/2 1,8,10-12
SW1(config)#do show ip interface brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 unassigned YES unset up down
FastEthernet0/1 unassigned YES unset up up
FastEthernet0/2 unassigned YES unset up up
FastEthernet0/12 unassigned YES unset up up
Vlan8 192.168.8.129 YES manual up up
Vlan10 192.168.10.1 YES manual up up
Vlan11 192.168.11.1 YES manual up up
Vlan12 192.168.12.1 YES manual up up
SW1(config)#do show vlan-s
VLAN Name Status Ports
1 default active Fa0/0, Fa0/3, Fa0/4, Fa0/5
Fa0/6, Fa0/7, Fa0/8, Fa0/9
Fa0/10, Fa0/11, Fa0/13, Fa0/14
Fa0/15
8 wg active
10 sc active
11 bg active
12 fw active Fa0/12
本文出自 “IT入门” 博客,谢绝转载!