我们专注攀枝花网站设计 攀枝花网站制作 攀枝花网站建设
成都网站建设公司服务热线:400-028-6601

网站建设知识

十年网站开发经验 + 多家企业客户 + 靠谱的建站团队

量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决

服务器中如何配置三层交换机

这篇文章将为大家详细讲解有关服务器中如何配置三层交换机,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。

成都创新互联公司坚持“要么做到,要么别承诺”的工作理念,服务领域包括:网站设计制作、成都网站制作、企业官网、英文网站、手机端网站、网站推广等服务,满足客户于互联网时代的安次网站设计、移动媒体设计的需求,帮助企业找到有效的互联网解决方案。努力成为您成熟可靠的网络建设合作伙伴!

实验拓扑:
服务器中如何配置三层交换机
实验目的:pc1、pc2、pc3、pc4、server-pt实现互通

实验需求:        
pc1: ip地址:192.168.10.1
子网掩码:255.255.255.0
网关:192.168.10.254
pc2:  ip地址:192.168.20.1
子网掩码:255.255.255.0
网关:192.168.20.254
pc3:    ip地址:192.168.30.1
子网掩码:255.255.255.0
网关:192.168.30.254
pc4:   ip地址:192.168.40.1
子网掩码:255.255.255.0
网关:  192.168.40.254
server-PT:    ip地址:192.168.60.1
子网掩码:255.255.255.0
网关:192.168.60.254

实验步骤:
1.配置PC机
pc1
服务器中如何配置三层交换机

pc2服务器中如何配置三层交换机
pc3
服务器中如何配置三层交换机
pc4
服务器中如何配置三层交换机
serve-pt
服务器中如何配置三层交换机

2.配置二层交换机
操作内容:
a、sw1和sw2分别创建vlan10、vlan20和vlan30、vlan40,并将端口加入到各自对应的vlan中,与PC机相连的端口设置access模式且允许各自所在vlan通过,其余端口创建trunk模式且允许所有vlan通过
b、sw3和sw4各自创建vlan10、vlan20、vlan30、vlan40,将所有端口创建trunk链路且允许所有vlan通过

sw1:
Switch>enable
Switch#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname sw1
sw1(config)#vlan 10
sw1(config-vlan)#vlan 20
sw1(config-vlan)#exit
sw1(config)#interface fa0/1
sw1(config-if)#switchport mode access
sw1(config-if)#switchport access vlan 10
sw1(config-if)#exit
sw1(config)#interface fa0/2
sw1(config-if)#switchport mode access
sw1(config-if)#switchport access vlan 20
sw1(config-if)#exit
sw1(config)#interface fa0/3
sw1(config-if)#switchport mode trunk
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed
sw1(config-if)#switchport trunk allowed vlan all
sw1(config-if)#exit
sw1(config)#interface fa0/4
sw1(config-if)#switchport mode trunk
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/4, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/4, changed state to up
sw1(config-if)#switchport trunk allowed vlan all
sw1(config-if)#exit
sw1(config)#interface fa0/5
sw1(config-if)#switchport mode trunk
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/5, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/5, changed state to up
sw1(config-if)#switchport trunk allowed vlan all
sw1(config-if)#exit
sw1(config)#exit
sw1#write

sw2:
Switch>enable
Switch#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname sw2
sw2(config)#vlan 30
sw2(config-vlan)#vlan 40
sw2(config-vlan)#exit
sw2(config)#interface fa0/1
sw2(config-if)#switchport mode access
sw2(config-if)#switchport access vlan 30
sw2(config-if)#exit
sw2(config)#interface fa0/2
sw2(config-if)#switchport mode access
sw2(config-if)#switchport access vlan 40
sw2(config-if)#exit
sw2(config)#interface fa0/3
sw2(config-if)#switchport mode trunk
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed
sw2(config-if)#switchport trunk allowed vlan all
sw2(config-if)#exit
sw2(config)#interface fa0/4
sw2(config-if)#switchport mode trunk
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/4, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/4, changed state to up
sw2(config-if)#switchport trunk allowed vlan all
sw2(config-if)#exit
sw2(config)#interface fa0/5
sw2(config-if)#switchport mode trunk
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/5, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/5, changed state to up
sw2(config-if)#switchport trunk allowed vlan all
sw2(config-if)#exit
sw2(config)#exit
sw2#write

sw3:
Switch>enable
Switch#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname sw3

Switch>enable
Switch#configure
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
sw3(config)#vlan 10
sw3(config-vlan)#vlan 20
sw3(config-vlan)#vlan 30
sw3(config-vlan)#vlan 40
sw3(config-vlan)#exit
sw3(config)#interface fa0/1
sw3(config-if)#switchport mode trunk
sw3(config-if)#switchport trunk allowed vlan all
sw3(config-if)#exit
sw3(config)#int fa0/2
sw3(config-if)#switchport mode trunk
sw3(config-if)#switchport trunk allowed vlan all
sw3(config-if)#exit
sw3(config)#interface fa0/3
sw3(config-if)#switchport mode trunk
sw3(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed
sw3(config-if)#switchport trunk allowed vlan all
sw3(config-if)#exit
sw3#write

sw4:
Switch>enable
Switch#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname sw4
sw4(config)#vlan 10
sw4(config-vlan)#vlan 20
sw4(config-vlan)#vlan 30
sw4(config-vlan)#vlan 40
sw4(config-vlan)#exit
sw4(config)#interface fa0/1
sw4(config-if)#switchport mode trunk
sw4(config-if)#switchport trunk allowed vlan all
sw4(config-if)#exit
sw4(config)#int fa0/2
sw4(config-if)#switchport mode trunk
sw4(config-if)#switchport trunk allowed vlan all
sw4(config-if)#exit
sw4(config)#interface fa0/3
sw4(config-if)#switchport mode trunk
sw4(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed
sw4(config-if)#switchport trunk allowed vlan all
sw4(config-if)#exit
sw4#write

3.配置三层交换机
操作内容:
创建vlan10、vlan20、vlan30、vlan40,创建虚拟端口并设置网关,fa0/3设置ip地址及子网掩码,开启路由功能,配置下一跳到192.168.60.0网段

Switch>en
Switch#configure
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#ip routing
Switch(config)#vlan 10
Switch(config-vlan)#vlan 20
Switch(config-vlan)#vlan 30
Switch(config-vlan)#vlan 40
Switch(config-vlan)#exit
Switch(config)#int vlan 10
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan10, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan10, changed state to up
Switch(config-if)#no shutdown
Switch(config-if)#ip address 192.168.10.254 255.255.255.0
Switch(config-if)#exit
Switch(config)#int vlan 20
%LINK-5-CHANGED: Interface Vlan20, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan20, changed state to up
Switch(config-if)#no shutdown
Switch(config-if)#ip address 192.168.20.254 255.255.255.0
Switch(config-if)#exit
Switch(config)#int vlan 30
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan30, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan30, changed state to up
Switch(config-if)#no shutdown
Switch(config-if)#ip address 192.168.30.254 255.255.255.0
Switch(config-if)#exit
Switch(config)#int vlan 40
%LINK-5-CHANGED: Interface Vlan40, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan40, changed state to up
Switch(config-if)#no shutdown
Switch(config-if)#ip address 192.168.40.254 255.255.255.0
Switch(config-if)#exit
Switch(config)#interface fa0/3
Switch(config-if)#no switchport
Switch(config-if)#no shutdown
Switch(config-if)#ip address 192.168.50.1 255.255.255.0
Switch(config-if)#exit
Switch(config)#ip route 192.168.60.0 255.255.255.0 192.168.50.2
Switch(config)#exit
Switch#
%SYS-5-CONFIG_I: Configured from console by console
Switch#write

4.配置路由器
操作内容:配置端口的IP及子网掩码,配置默认路由

Router>en
Router#configure
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#interface fastEthernet 0/1
%Invalid interface type and number
Router(config)#interface gigabitEthernet 0/0
Router(config-if)#no shutdown
%LINK-5-CHANGED: Interface GigabitEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to up
Router(config-if)#ip address 192.168.50.2 255.255.255.0
Router(config)#interface gigabitEthernet 0/1
Router(config-if)#no shutdown
%LINK-5-CHANGED: Interface GigabitEthernet0/1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/1, changed state to up
Router(config-if)#ip address 192.168.60.254 255.255.255.0
Router(config-if)#exit
Router(config)#ip route 0.0.0.0 0.0.0.0 192.168.50.1
Router(config)#exit
%SYS-5-CONFIG_I: Configured from console by console
Router#write

验证与测试:
服务器中如何配置三层交换机
服务器中如何配置三层交换机

关于“服务器中如何配置三层交换机”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。


文章标题:服务器中如何配置三层交换机
文章URL:http://shouzuofang.com/article/jphjpd.html

其他资讯