三层交换机怎么配置才能使不同网段的PC访问服务器

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了三层交换机怎么配置才能使不同网段的PC访问服务器相关的知识,希望对你有一定的参考价值。

三层交换机接路由再接服务器,但不和路由端口在同一网段的PC无法访问服务器,谁知道怎么配置三层交换机?或者留下Q号帮我解决,思科模拟器而已
连接如下:PC--二层交换机--3层交换机--路由--服务器
|
因特网
能写出配置吗?3层交换机上的!

不同网段的PC访问服务器需要在三层交换机中添加默认路由即可。
具体方法(以华为为例,其它品牌步骤都是一样,命令稍有不同而已):
1、用TELNET或CONSOLE线连接三层交换机。
2、输入用户名密码登陆。
3、使用命令行:
system-view
ip route-static 0.0.0.0 0.0.0.0 192.168.1.1(具体以服务器IP为准)
quit
save
这样不同网段的PC就能访问服务器了。
参考技术A 在三层交换机上做路由表,把不是和路由同一网段的IP都指向路由那个网段。 参考技术B 你把三层上建要通信的网段VLAN,并给VLAN配置上IP,打开三层交换机的三层功能,(ip routing)。和下面二层接的交换机的端口打TRUNK,二层上配置相应的VLAN ,PC也配置相应的网段,网关,这样就行了 参考技术C 3层交换机和路由之间要起路由协议。因为已经是跨网段的了。二层上如果有多个VLAN的话,那在和三层相连的地方要起Trunk。不起也行,但是二层和三层一定要是同一个VLAN,并且你的PC要在这个VLAN 参考技术D 自己查书

华为三层交换机如何实现不同Vlan不同网段之间的互通

实验目标:如图可以使PC1、PC2、PC3、PC4、PC5、server1、之间可以互相ping通
技术分享图片
实验步骤:1.配置PC1/PC2/PC3/PC4/PC5的IP,子网掩码,网关如图:
技术分享图片技术分享图片技术分享图片技术分享图片技术分享图片
2.配置Switch1如下:
<Huawei>undo terminal monitor
Info: Current terminal monitor is off.
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname SW1
[SW1]vlan 10
[SW1-vlan10]vlan 20
[SW1-vlan20]vlan 30
[SW1-vlan30]q
[SW1-GigabitEthernet0/0/1]port link-type access
[SW1-GigabitEthernet0/0/1]port default vlan 10
[SW1-GigabitEthernet0/0/1]undo shut
[SW1-GigabitEthernet0/0/1]undo shutdown
Info: Interface GigabitEthernet0/0/1 is not shutdown.
[SW1-GigabitEthernet0/0/1]q
[SW1]interface g0/0/2
[SW1-GigabitEthernet0/0/2]port link-type access
[SW1-GigabitEthernet0/0/2]port default vlan 20
[SW1-GigabitEthernet0/0/2]undo shut
Info: Interface GigabitEthernet0/0/2 is not shutdown.
[SW1-GigabitEthernet0/0/2]q
[SW1]interface g0/0/3
[SW1-GigabitEthernet0/0/3]port link-type ac
[SW1-GigabitEthernet0/0/3]port link-type access
[SW1-GigabitEthernet0/0/3]port default vlan 30
[SW1-GigabitEthernet0/0/3]undo shut
Info: Interface GigabitEthernet0/0/3 is not shutdown.
[SW1]interface g0/0/4
[SW1-GigabitEthernet0/0/4]port link-type trunk
[SW1-GigabitEthernet0/0/4]port trunk allow-pass vlan all
[SW1-GigabitEthernet0/0/4]undo shutdown
Info: Interface GigabitEthernet0/0/4 is not shutdown.
3.配置Switch2如下:
<Huawei>undo terminal monitor
<Huawei>system-view
[Huawei]sysname SW2
[SW2]vlan 40
[SW2-vlan40]vlan 50
[SW2-vlan50]q
[SW2]interface g0/0/2
[SW2-GigabitEthernet0/0/2]port link-type access
[SW2-GigabitEthernet0/0/2]port default vlan 40
[SW2-GigabitEthernet0/0/2]undo shutdown
Info: Interface GigabitEthernet0/0/2 is not shutdown.
[SW2-GigabitEthernet0/0/2]q
[SW2]interface g0/0/3
[SW2-GigabitEthernet0/0/3]port link-type access
[SW2-GigabitEthernet0/0/3]port default vlan 50
[SW2-GigabitEthernet0/0/3]undo shutdown
Info: Interface GigabitEthernet0/0/3 is not shutdown.
[SW2-GigabitEthernet0/0/3]q
[SW2]interface g0/0/1
[SW2-GigabitEthernet0/0/1]port link-type trunk
[SW2-GigabitEthernet0/0/1]undo shutdown
[SW2-GigabitEthernet0/0/1]port trunk allow-pass vlan all
Info: Interface GigabitEthernet0/0/1 is not shutdown.
4.配置Switch3如下:
<Huawei>undo terminal monitor
Info: Current terminal monitor is off.
<Huawei>system-view
[Huawei]sysname SW3
[SW3]vlan 10
[SW3-vlan10]vlan 20
[SW3-vlan20]vlan 30
[SW3-vlan30]vlan 40
[SW3-vlan40]vlan 50
[SW3-vlan50]q
[SW3]interface vlan 10
[SW3-Vlanif10]ip address 10.0.0.254 255.0.0.0
[SW3-Vlanif10]undo shutdown
Info: Interface Vlanif10 is not shutdown.
[SW3-Vlanif10]q
[SW3]interface vlan 20
[SW3-Vlanif20]ip address 20.0.0.254 255.0.0.0
[SW3-Vlanif20]undo shutdown
Info: Interface Vlanif20 is not shutdown.
[SW3-Vlanif20]q
[SW3]interface vlan 30
[SW3-Vlanif30]ip address 30.0.0.254 255.0.0.0
[SW3-Vlanif30]undo shutdown
Info: Interface Vlanif30 is not shutdown.
[SW3-Vlanif30]q
[SW3]interface vlan 40
[SW3-Vlanif40]ip address 40.0.0.254 255.0.0.0
[SW3-Vlanif40]undo shutdown
Info: Interface Vlanif40 is not shutdown.
[SW3-Vlanif40]q
[SW3]interface vlan 50
[SW3-Vlanif50]ip address 50.0.0.254 255.0.0.0
[SW3-Vlanif50]undo shutdown
Info: Interface Vlanif50 is not shutdown.
[SW3-Vlanif50]q
[SW3]interface g0/0/1
[SW3-GigabitEthernet0/0/1]port link-type trunk
[SW3-GigabitEthernet0/0/1]port trunk allow-pass vlan all
[SW3-GigabitEthernet0/0/1]undo shutdown
Info: Interface GigabitEthernet0/0/1 is not shutdown.
[SW3-GigabitEthernet0/0/1]q
[SW3]interface g0/0/2
[SW3-GigabitEthernet0/0/2]port link-type trunk
[SW3-GigabitEthernet0/0/2]undo shutdown
[SW3-GigabitEthernet0/0/2]port link-type trunk
[SW3-GigabitEthernet0/0/2]port trunk allow-pass vlan all
Info: Interface GigabitEthernet0/0/2 is not shutdown.
[SW3]vlan 60
[SW3-vlan60]q
[SW3]interface g0/0/3
[SW3-GigabitEthernet0/0/3]port link-type access
[SW3-GigabitEthernet0/0/3]port default vlan 60
[SW3-GigabitEthernet0/0/3]undo shutdown
[SW3]interface vlan 60
[SW3-Vlanif60]ip address 60.0.0.1 255.0.0.0
5.配置R1如下
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R1
[R1-GigabitEthernet0/0/0]ip address 60.0.0.2 255.0.0.0
[R1-GigabitEthernet0/0/0]undo shut
Info: Interface GigabitEthernet0/0/0 is not shutdown.
[R1-GigabitEthernet0/0/0]q
[R1]interface g0/0/1
[R1-GigabitEthernet0/0/1]ip address 70.0.0.254 255.0.0.0
[R1-GigabitEthernet0/0/1]undo shut
Info: Interface GigabitEthernet0/0/1 is not shutdown.
6.配置server1如图:
技术分享图片
7.在R1配置默认路由:
技术分享图片
8.在SW3上配置静态路由:
技术分享图片
结果验证如图:
技术分享图片技术分享图片技术分享图片技术分享图片

以上是关于三层交换机怎么配置才能使不同网段的PC访问服务器的主要内容,如果未能解决你的问题,请参考以下文章

华为三层交换机实现不同vlan,不同网段的互通

华为三层交换机vlan间怎么通信?

思科三层交换机如何进入虚端口

H3C怎么配置静态路由和OSPF使不同vlan不同网段的PC互通,求解

思科三层交换机配置

华为三层路由器dhcp的架设