服务器中如何配置三层交换机-创新互联

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

桃源ssl适用于网站、小程序/APP、API接口等需要进行数据传输应用场景,ssl证书未来市场广阔!成为成都创新互联的ssl证书销售渠道,可以享受市场价格4-6折优惠!如果有意向欢迎电话联系或者加微信:18980820575(备注:SSL证书合作)期待与您的合作!

实验拓扑:
服务器中如何配置三层交换机
实验目的: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

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


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

另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


分享题目:服务器中如何配置三层交换机-创新互联
文章链接:http://cdiso.cn/article/dopecj.html

其他资讯