ROS软路由论坛 ROSABC.com 网络方案网络工程交流

 找回密码
 会员注册

QQ登录

只需一步,快速开始

CCNP知识:三层交换在vlan间路由

2014-9-1 21:53| 发布者: admin| 查看: 479| 评论: 0

摘要: 对VLAN的划分和VLAN间路由也是CCNP认证考试中常见的内容,需要各位学员熟悉掌握在使用路由器来组网时候的这些要点知识。 划分vlan的好处在于能够分割广播域,但是划分vlan后不同vlan间是不能相互通信的,要在vlan间 ...

对VLAN的划分和VLAN间路由也是CCNP认证考试中常见的内容,需要各位学员熟悉掌握在使用路由器来组网时候的这些要点知识。
划分vlan的好处在于能够分割广播域,但是划分vlan后不同vlan间是不能相互通信的,要在vlan间通信,必须要借助路由器或者三层交换机。在na中我们学习过用单臂路由在vlan间通信,今天我们学习用三层交换在vlan间路由。
 


r4和r5模拟pc机,r3为三层交换机,r1为路由器。
r4:
no ip routing
in e0/1
ip add 192.168.2.2 255.255.255.0
duplx full
no sh
ip default-gateway 192.168.2.1
r5:
no ip routing
in e0/1
ip add 192.168.3.2 255.255.255.0
duplx full
no sh
ip default-gateway 192.168.3.1
r3:
vlan database
vlan 3
vlan 2
exit
ip routing
in f0/1
switchport mode acc
switchport acc vlan 2
in f0/2
switchport mode acc
switchport acc vlan 3
in vlan 2
ip add 192.168.2.1 255.255.255.0
no sh
in vlan 3
ip add 192.168.3.1 255.255.255.0
no sh
in f0/3
no switchport  这条命令将端口作为三层端口使用,二层端口是不能够配ip地址的。
ip add 192.168.1.1 255.255.255.0
no sh
ip route 0.0.0.0 0.0.0.0 192.168.1.2
r1:
in e0/1
ip add 192.168.1.2 255.255.255.0
no sh
ip nat inside
in e0/2
ip add 118.122.119.1 255.255.255.0
no sh
ip nat outside
access-list 1 permit 192.168.2.0 0.0.0.255
access-list 2 permit 192.168.3.0 0.0.0.255
ip nat inside source list 1 inter e0/2 overload
ip route 0.0.0.0 0.0.0.0 118.122.119.2
r2:
in e0/1
ip add 118.122.119.2 255.255.255.0
no sh
in loop 1
ip add 2.2.2.2 255.0.0.0
no sh

switch#show ip ro
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


       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 192.168.1.2 to network 0.0.0.0

C    192.168.1.0/24 is directly connected, FastEthernet0/3
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 192.168.1.2
http://www.luyouqiwang.com/14438/
R4#ping 2.2.2.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 96/117/136 ms

不良信息举报Q:2000617
新用户7天后可回帖!

软路由

不良信息举报Q:2000617|Archiver|ROS软路由论坛 ROSABC.com 网络方案网络工程交流

GMT+8, 2025-11-4 21:08 , Processed in 0.033118 second(s), 16 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部