问题原文
原帖链接 · Arseni Mourzenko · CC BY-SA 4.0
I'm (still) trying to properly configure VLANs on a level 3 switch (Netgear GS516TP).
Basic scenario: there are three VLANs: VLAN 10, 11, and 12, with respectively three ports, and three machines.
- 10.0.10.5, connected to port g10 and belonging to VLAN 10.
- 10.0.11.5, connected to port g11 and belonging to VLAN 11.
- 10.0.12.5, connected to port g12 and belonging to VLAN 12.
VLAN 10 has untagged ports g10, g11, and g12.
VLAN 11 has untagged ports g10 and g11. Similarly, VLAN 12 has untagged ports g10 and g12.
The goal is to be able for machines belonging to VLAN 11 and VLAN 12 to communicate with the machines in VLAN 10. However, a machine from VLAN 11 should know nothing about machines in VLAN 12 (and the other way around).
While all three machines are using the netmask 255.255.0.0, the routing configuration is set like this:
Now, the problem. When I send a TCP or UDP packet from 10.0.10.5 to 10.0.11.5 (for instance by doing nc -n 10.0.11.5 100), I can see this packet in Wireshark running on the machine which belongs to VLAN 12. It doesn't work the other way around, though, i.e. a packet sent from 10.0.11.5 is not visible in VLAN 12.
What should I do in order for the packets targeting machines from VLAN 11 to never reach the ports belonging to VLAN 12?
已采纳解答
原帖链接 · kubanczyk · CC BY-SA 4.0
By default every port only uses L2 info to decide how to process packets (L2 == MAC == bridge). That decision doesn't respect L3, i.e. it doesn't know IP ranges of VLANs.
If you enable routing for the VLAN, and the MAC DA [destination address] of an inbound unicast packet is that of the internal bridge-router interface, the packet is routed.
The IP address that you assigned to VLANs (visible on your last screenshot) does not "catch" packets by itself. You need to set your servers up to actually send packets there to that "internal bridge-router interface"; normally, this is done by adding a route table entry on a server:
(on 10.0.10.5):
10.0.11.0/24 dev eth0 via 10.0.10.1
Only such packets destined to that "internal bridge-router interface" will move to another VLAN.
In my example, step by step:
- on 10.0.10.5 you do
ping 10.0.11.5 - server asks "who has 10.0.10.1"
- switch says "MAC 10:da:12:34 has 10.0.10.1"
- server sends a packet SOURCE 10.0.10.5 DEST 10.0.11.5 MAC_DEST 10:da:12:34
- switch seeing such MAC_DEST decides to change the VLAN assigned to that packet
- switch also changes MAC_DEST to that belonging to 10.0.11.5
(It's just how any packet forwarding works on Ethernet - nothing specific to Netgear.)
Probably, you don't need a port to be in multiple VLANs (I didn't actually check).
Also, set Routing -> IP -> Routing Mode = Yes
Netgear Support: What is VLAN Routing
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
