百度空间 | 百度首页 
 
查看文章
 
交换机和路由器基本配置(四)
2007年06月27日 星期三 下午 07:15

三层交换

单臂路由实现VLAN之间通信

Router(config)#interface fastEthernet 0/0
Router(config-if)#no shutdown
Router(config-if)#exit

Router(config)#interface fastEthernet 0/0.1
Router(config-subif)#encapsulation dot1q 1
Router(config-subif)#ip address 10.1.1.1 255.0.0.0
Router(config-subif)#exit

Router(config)#interface fastEthernet 0/0.2
Router(config-subif)#encapsulation dot1q 2
Router(config-subif)#ip address 20.1.1.1 255.0.0.0
Router(config-subif)#end

单臂路由产生的瓶颈

数据量增大,路由器与交换机之间的路径会成为整个网络的瓶颈

三层交换机的配置

v      在三层交换机上启动路由

Switch(config)#ip routing

v      配置VLAN IP地址

Switch (config)#interface vlan vlan-id

Switch (config-if)#ip address Ip-address Subnet-mask

Switch (config-if)#no shutdown

v      查看FIB

Switch (config)#show ip cef

v      查看邻接关系表

Switch (config)#show adjacency detail

v      在三层交换机上配置路由接口

Switch (config-if)#no switchport

v      配置DHCP中继转发

Switch(config)#interface vlan vlan-id

Switch(config-if)#ip helper-address Dhcpserver-address

三层交换机实现VLAN互通实例

v      2层交换机上配置VLAN

SW-2L(config)#vlan 2

SW-2L(config-vlan)#vlan 3

SW-2L(config-vlan)#exit

SW-2L(config)#interface range f0/11 - 15

SW-2L(config-if-range)#switchport access vlan 2

SW-2L(config-if-range)#switchport mode access

SW-2L(config)#interface range f0/16 - 23

SW-2L(config-if-range)#switchport access vlan 3

SW-2L(config-if-range)#switchport mode access

v      2层交换机上配制Trunk接口

SW-2L(config)#interface f0/24

SW-2L(config-if)#switchport mode trunk

v      3层交换机上配置与2层交换机相同的VLAN(配置步骤与方法相同)

v      3层交换机上启动路由

         SW-3L(config)#ip routing

v      3层交换机上配置各VLAN的IP地址

SW-3L(config)#interface vlan 1

SW-3L(config-if)#ip address 192.168.1.1 255.255.255.0

SW-3L(config-if)#no shut

SW-3L(config)#interface vlan 2

SW-3L(config-if)#ip address 192.168.2.1 255.255.255.0

SW-3L(config-if)#no shut

SW-3L(config)#interface vlan 3

SW-3L(config-if)#ip address 192.168.3.1 255.255.255.0

SW-3L(config-if)#no shut

v      3层交换机上查看路由表

SW-3L#show ip route

Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP

       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP

       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2

       ia - IS-IS inter area, * - candidate default, U - per-user static route

       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

C    192.168.1.0/24 is directly connected, Vlan1

C    192.168.2.0/24 is directly connected, Vlan2

C    192.168.3.0/24 is directly connected, Vlan3

v      在主机192.168.2.156上ping 192.168.3.156

C:\>ping 192.168.3.156

Pinging 192.168.3.156 with 32 bytes of data:

Reply from 192.168.3.156: bytes=32 time<1ms TTL=254

Reply from 192.168.3.156: bytes=32 time<1ms TTL=254

Reply from 192.168.3.156: bytes=32 time<1ms TTL=254

Reply from 192.168.3.156: bytes=32 time<1ms TTL=254

Ping statistics for 192.168.3.156:

        Packets: Sent = 4, Received = 4, Lost = 0(0% loss)

v      查看FIB

SW-3L#show ip cef

Prefix                    Next Hop           Interface

0.0.0.0/32               receive

192.168.1.0/24       attached              Vlan1

192.168.1.0/32        receive

192.168.1.1/32        receive

192.168.1.255/32    receive

192.168.2.0/24        attached             Vlan2

192.168.2.0/32        receive

192.168.2.1/32        receive

192.168.2.156/32    attached              Vlan2

192.168.2.255/32    receive

192.168.3.0/24        attached              Vlan3

192.168.3.0/32        receive

192.168.3.1/32        receive

192.168.3.156/32    attached              Vlan3

192.168.3.255/32     receive

224.0.0.0/4               drop

224.0.0.0/24             receive

255.255.255.255/32  receive

SW-3L#show adjacency detail

Protocol Interface                 Address

IP       Vlan2                     192.168.2.156(6)

                                         0 packets, 0 bytes

                                         epoch 2

                                         sourced in sev-epoch 1

                                         Encap length 14  

                                         00061BE393660016C72EB3800800

                                         ARP

IP       Vlan3                     192.168.3.156(6)

                                         0 packets, 0 bytes

                                         epoch 2

                                         sourced in sev-epoch 1

                                         Encap length 14

                                         0016C72E97000016C72EB3800800

                                         ARP

在三层交换机上配置路由实例

v      在三层交换机上配置路由接口

SW-3L(config)#inter f0/23

SW-3L(config-if)#no switchport

SW-3L(config-if)#ip address 10.1.1.1 255.255.255.252

SW-3L(config)#ip route 0.0.0.0 0.0.0.0 10.1.1.2

v      在路由器上配置路由

Router(config)#ip route 192.168.1.0 255.255.255.0 10.1.1.1

Router(config)#ip route 192.168.2.0 255.255.255.0 10.1.1.1

Router(config)#ip route 192.168.3.0 255.255.255.0 10.1.1.1

v      查看f0/23接口信息

SW-3L#show inter f0/23 switchport

Name: Fa0/23

Switchport: Disabled

v      显示交换机的路由表

SW-3L#show ip route

Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP

       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP

       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2

       ia - IS-IS inter area, * - candidate default, U - per-user static route

       o - ODR, P - periodic downloaded static route

Gateway of last resort is 10.1.1.2 to network 0.0.0.0

     10.0.0.0/30 is subnetted, 1 subnets

C       10.1.1.0 is directly connected, FastEthernet0/23

C    192.168.1.0/24 is directly connected, Vlan1

C    192.168.2.0/24 is directly connected, Vlan2

C    192.168.3.0/24 is directly connected, Vlan3

S*   0.0.0.0/0 [1/0] via 10.1.1.2

v      在各VLAN互通的前提下,配置DHCP中继服务

SW-3L(config)#interface vlan 1

SW-3L(config-if)#ip helper-address 192.168.2.100

SW-3L(config)#interface vlan 3

SW-3L(config-if)#ip helper-address 192.168.2.100


类别:交换&路由 | 添加到搜藏 | 浏览() | 评论 (2)
 
最近读者:
 
网友评论:
1
2007年07月05日 星期四 下午 04:53 | 回复
在配置单臂路由的时候,如果不用三层交换机,可不可以呀.
 
2
2007年07月06日 星期五 上午 07:24 | 回复
当然可以啦!用路由器就行了
 
发表评论:
姓 名:
网址或邮箱: (选填)
内 容:
验证码: 请点击后输入四位验证码,字母不区分大小写
      

     

©2009 Baidu