大网数据广告活动
服务器运维问答

Assigning switch as gateway address

· 52CE 我爱测

I've tried researching a solution for this but I keep missing the connecting dots. This is my first question and if I mess up the formatting of my question, forgive me. There is a switch that I am trying to connect to 10 other sw…

问题原文

原帖链接 · Hector Robles · CC BY-SA 3.0

I've tried researching a solution for this but I keep missing the connecting dots. This is my first question and if I mess up the formatting of my question, forgive me.

There is a switch that I am trying to connect to 10 other switches and devices connected to those switches. Is it possible to set the address of the main switch as the gateway address of the secondary switches, so that I can have devices communicating to other devices on different subnets?

Is there a more efficient approach? The devices and secondary switches are on different subnets. The secondary switches are not connected to each other. Only the main switch is connected to the secondary switches.

已采纳解答

原帖链接 · Ron Maupin · CC BY-SA 3.0

If you are using layer-2 switches, they are transparent devices, and they do not look at the layer-3 (IP) addresses on the layer-3 packets. They only look at the layer-2 (MAC) addresses on the frames, so they cannot send traffic from one VLAN to a different VLAN.

A layer-2 switch uses the source address on a frame to populate its MAC address table with the source MAC address and the interface on which it entered the switch. It uses the MAC address table to try to find the destination MAC address interface, and sends the frame to the indicated interface. If it fails to find the destination MAC address in its MAC address table, it floods the frame to all other interfaces.

You must use a layer-3 device (router or layer-3 switch with routing enabled) to forward packets from one VLAN to another VLAN. The router will strip off the layer-2 frame, exposing the layer-3 packet, inspect the destination layer-3 address, look up the layer-3 address in its routing table, create a new layer-2 frame for the new interface to encapsulate the layer-3 packet to which it forwards the layer-3 packet (new layer-2 frame). If it finds no match in its routing table, it drops the layer-3 packet.

Hosts will compare the layer-3 destination address to its own layer-3 address and mask to determine if the destination is on the same network. If it is, the host will use ARP to create a layer-2 frame to directly send the frame to the destination host. If the destination layer-3 address is on a different network, it will use ARP to get the layer-2 address of its configured gateway to build the layer-2 frame, and the frame will be delivered directly to its configured gateway. The layer-2 switches will switch the layer-2 frames using the layer-2 address.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-12-11)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。