三层交换机和边界路由器怎么连?

2024-11-15 18:26:10
推荐回答(2个)
回答1:

按图从左至右,从上至下:
设备:
路由器:R1 R2 R3
交换机:SW1 SW2 SW3
服务器:S1 S2
主机:PC1 PC2 PC3 PC4
VLAN:
VLAN 2 VLAN 3 VLAN 4
S1 S2 属于vlan2,地址分别是.2.2.11 , 2.2.2.22 掩码/24 网关2.2.2.1
PC1,PC2属于vlan 3地址分别是3.3.3.11 3.3.3.22 掩码/24 网关3.3.3.1
PC3 ,PC4属于vlan4 地址分别是4.4.4.11 4.4.4.22 掩码/24 网关 4.4.4.1

接口:SW1f0/10接口IP:192.168.1.1 /24
R2f0/0接口ip 192.168.1.2 /24

---------------------------------------------------------------------------
R1:interface FastEthernet0/0
ip address 192.168.1.2 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
no ip address
duplex auto
speed auto
shutdown
!
interface Serial0/0/0
ip address 12.1.1.1 255.255.255.0
clock rate 64000
!
interface Serial0/0/1
no ip address
shutdown
!
interface Vlan1
no ip address
shutdown
!
ip classless
ip route 0.0.0.0 0.0.0.0 Serial0/0/0
ip route 2.2.2.0 255.255.255.0 FastEthernet0/0
ip route 3.3.3.0 255.255.255.0 FastEthernet0/0
ip route 4.4.4.0 255.255.255.0 FastEthernet0/0
!

R2:interface Serial0/0/0
ip address 12.1.1.2 255.255.255.0
!
interface Serial0/0/1
ip address 23.1.1.1 255.255.255.0
clock rate 64000
!
interface Vlan1
no ip address
shutdown
!
ip classless
ip route 0.0.0.0 0.0.0.0 Serial0/0/0

R3:
interface Serial0/0/0
ip address 23.1.1.2 255.255.255.0
!
interface Serial0/0/1
no ip address
shutdown
!
interface Vlan1
no ip address
shutdown
!
ip classless
ip route 0.0.0.0 0.0.0.0 Serial0/0/0
!
!
!
!

sw1:ip routing
!
spanning-tree vlan 1 priority 0
interface FastEthernet0/1
switchport access vlan 2
switchport mode access
!
interface FastEthernet0/2
switchport access vlan 2
switchport mode access
interface FastEthernet0/10
no switchport
ip address 192.168.1.1 255.255.255.0
duplex auto
speed auto

interface Vlan2
ip address 2.2.2.1 255.255.255.0
!
interface Vlan3
ip address 3.3.3.1 255.255.255.0
!
interface Vlan4
ip address 4.4.4.1 255.255.255.0
!
ip classless
ip route 0.0.0.0 0.0.0.0 FastEthernet0/10
!
其他省略:
在三层交换上开启路由功能,给F0/10配个地址 做默认路由到R1
起3个svi 为每个vlan配置网关
在路由R1上做静态路由指向每个vlan 和做默认路由,网关是R2
在R2上做默认路由网关为R1
在R3上做默认路由指向R2
全部交换机 建立所有vlan 并以SW1为跟桥 开启交换机之间的TRUNK模式
最后陪主机的IP
测试各主机之间的连通性 以及到23.1.1.2 网络的连通性

回答2:

单臂路由,将VLAN直接
终结在路由器的子接口,用dot1q来对应vlan ID,配置网关即可;