局域网三台电脑通过三层交换机+路由上网,三台电脑分别属于3个vlan,并且通过手动配置的固定IP。大家帮我看看我配置的对不对啊?另外有一个问题,交换机的vlan100,我把1/0/9划到了vlan100里面,这个接口是设置成access模式还是其他模式呢?
设置列表
对齐方式
三层交换机配置如下:
[H3C]int g1/0/1
[H3C-GigabitEthernet1/0/1]port link-type hybrid
[H3C-GigabitEthernet1/0/1]quit
[H3C]int g1/0/2
[H3C-GigabitEthernet1/0/2]port link-type hybrid
[H3C-GigabitEthernet1/0/2]quit
[H3C]int g1/0/3
[H3C-GigabitEthernet1/0/3]port link-type hybrid
[H3C-GigabitEthernet1/0/3]quit
---------------------------------------------
[H3C]vlan 101
[H3C-vlan101]ip-subnet-vlan ip 192.168.101.1 255.255.255.0
[H3C-vlan101]quit
[H3C]vlan 102
[H3C-vlan102]ip-subnet-vlan ip 192.168.102.1 255.255.255.0
[H3C-vlan102]quit
[H3C]vlan 103
[H3C-vlan103]ip-subnet-vlan ip 192.168.103.1 255.255.255.0
[H3C-vlan103]quit
------------------------------------------------
[H3C]int g1/0/1
[H3C-GigabitEthernet1/0/1]port hybrid vlan 101 102 103 untagged
[H3C-GigabitEthernet1/0/1]port hybrid ip-subnet-vlan vlan 101
[H3C-GigabitEthernet1/0/1]port hybrid ip-subnet-vlan vlan 102
[H3C-GigabitEthernet1/0/1]port hybrid ip-subnet-vlan vlan 103
[H3C-GigabitEthernet1/0/1]quit
[H3C]int g1/0/2
[H3C-GigabitEthernet1/0/2]port hybrid vlan 101 102 103 untagged
[H3C-GigabitEthernet1/0/2]port hybrid ip-subnet-vlan vlan 101
[H3C-GigabitEthernet1/0/2]port hybrid ip-subnet-vlan vlan 102
[H3C-GigabitEthernet1/0/2]port hybrid ip-subnet-vlan vlan 103
[H3C-GigabitEthernet1/0/2]quit
[H3C]int g1/0/3
[H3C-GigabitEthernet1/0/3]port hybrid vlan 101 102 103 untagged
[H3C-GigabitEthernet1/0/3]port hybrid ip-subnet-vlan vlan 101
[H3C-GigabitEthernet1/0/3]port hybrid ip-subnet-vlan vlan 102
[H3C-GigabitEthernet1/0/3]port hybrid ip-subnet-vlan vlan 103
[H3C-GigabitEthernet1/0/3]quit
---------------------------------------------------
[H3C]vlan 100
[H3C-vlan100]port g1/0/9
[H3C-vlan100]quit
[H3C]int vlan 100
[H3C-Vlan-interface100]ip add 192.168.100.1 24
[H3C-Vlan-interface100]quit
[H3C]int g1/0/9
[H3C-GigabitEthernet1/0/9]port link-type access
[H3C-GigabitEthernet1/0/9]quit
------------------------------------------------
[H3C]ip route-static 0.0.0.0 0.0.0.0 192.168.100.2
[H3C]quit
----------------------------------------------------------------------------------------------------------------
路由器配置如下:
[H3C]int g0/1
[H3C-GigabitEthernet0/1]ip add 192.168.100.2 24
[H3C-GigabitEthernet0/1]quit
[H3C]int g0/2
[H3C-GigabitEthernet0/2]ip add 200.0.0.1 24
[H3C-GigabitEthernet0/2]quit
-------------------------------------------------------
[H3C]ip route-static 0.0.0.0 0.0.0.0 200.0.0.254
[H3C]ip route-static 192.168.101.0 255.255.255.0 192.168.100.1
[H3C]ip route-static 192.168.102.0 255.255.255.0 192.168.100.1
[H3C]ip route-static 192.168.103.0 255.255.255.0 192.168.100.1
-------------------------------------------------------------------------
[H3C]acl basic 2001
[H3C-acl-ipv4-basic-2001]rule 0 permit source 192.168.101.0 0.0.0.255
[H3C-acl-ipv4-basic-2001]rule 1 permit source 192.168.102.0 0.0.0.255
[H3C-acl-ipv4-basic-2001]rule 2 permit source 192.168.103.0 0.0.0.255
[H3C-acl-ipv4-basic-2001]quit
----------------------------------------
[H3C]int g0/2
[H3C-GigabitEthernet0/2]nat outbound 2001
[H3C-GigabitEthernet0/2]quit
(0)
最佳答案
您好:
交换机配置和路由器配置没有问题,交换机和路由器互连口设为access口,加入互连vlan即可;关于基于IP子网的vlan可参考官网对应章节说明:https://www.h3c.com/cn/d_201908/1221886_30005_0.htm#_Toc17464726
(0)
您好,对着呢,也可再对比下配置,参考
如下图所示,办公区的主机属于不同的网段192.168.5.0/24和192.168.50.0/24,Device C在收到来自办公区主机的报文时,根据报文的源IP地址,使来自不同网段主机的报文分别在指定的VLAN中传输,其中,来自网段192.168.5.0/24的报文在VLAN 100中传输,来自网段192.168.50.0/24的报文在VLAN 200中传输。
图1-6 基于IP子网的VLAN组网图
(1) 配置Device C
# 配置子网192.168.5.0/24与VLAN 100关联。
<DeviceC> system-view
[DeviceC] vlan 100
[DeviceC-vlan100] ip-subnet-vlan ip 192.168.5.0 255.255.255.0
[DeviceC-vlan100] quit
# 配置子网192.168.50.0/24与VLAN 200关联。
[DeviceC] vlan 200
[DeviceC-vlan200] ip-subnet-vlan ip 192.168.50.0 255.255.255.0
[DeviceC-vlan200] quit
# 配置端口GigabitEthernet1/0/2为Hybrid端口,允许VLAN 100通过,并且在发送VLAN 100的报文时携带VLAN Tag。
[DeviceC] interface gigabitethernet 1/0/2
[DeviceC-GigabitEthernet1/0/2] port link-type hybrid
[DeviceC-GigabitEthernet1/0/2] port hybrid vlan 100 tagged
[DeviceC-GigabitEthernet1/0/2] quit
# 配置端口GigabitEthernet1/0/3为Hybrid端口,允许VLAN 200通过,并且在发送VLAN 200的报文时携带VLAN Tag。
[DeviceC] interface gigabitethernet 1/0/3
[DeviceC-GigabitEthernet1/0/3] port link-type hybrid
[DeviceC-GigabitEthernet1/0/3] port hybrid vlan 200 tagged
[DeviceC-GigabitEthernet1/0/3] quit
# 配置端口GigabitEthernet1/0/1为Hybrid端口,允许VLAN 100、200通过,并且在发送VLAN 100、200的报文时不携带VLAN Tag。
[DeviceC] interface gigabitethernet 1/0/1
[DeviceC-GigabitEthernet1/0/1] port link-type hybrid
[DeviceC-GigabitEthernet1/0/1] port hybrid vlan 100 200 untagged
# 配置端口GigabitEthernet1/0/1和基于IP子网的VLAN 100、200关联。
[DeviceC-GigabitEthernet1/0/1] port hybrid ip-subnet-vlan vlan 100
[DeviceC-GigabitEthernet1/0/1] port hybrid ip-subnet-vlan vlan 200
[DeviceC-GigabitEthernet1/0/1] quit
(2) 配置Device A和Device B
配置Device A和Device B允许对应VLAN通过,配置过程略。
# 查看所有子网VLAN的信息。
[DeviceC] display ip-subnet-vlan vlan all
VLAN ID: 100
Subnet index IP address Subnet mask
0 192.168.5.0 255.255.255.0
VLAN ID: 200
Subnet index IP address Subnet mask
0 192.168.50.0 255.255.255.0
# 查看端口GigabitEthernet1/0/1关联的子网VLAN的信息。
[DeviceC] display ip-subnet-vlan interface gigabitethernet 1/0/1
Interface: GigabitEthernet1/0/1
VLAN ID Subnet index IP address Subnet mask Status
100 0 192.168.5.0 255.255.255.0 Active
200 0 192.168.50.0 255.255.255.0 Active
(0)
暂无评论
亲~登录后才可以操作哦!
确定你的邮箱还未认证,请认证邮箱或绑定手机后进行当前操作
举报
×
侵犯我的权益
×
侵犯了我企业的权益
×
抄袭了我的内容
×
原文链接或出处
诽谤我
×
对根叔社区有害的内容
×
不规范转载
×
举报说明
暂无评论