King Zone - one arm routing
type: channel
link: https://www.kingtam.win/tag/one-arm-routing/
items: Inter-VLAN Routing (Router on a Stick) -單臂路由

Inter-VLAN Routing (Router on a Stick) -單臂路由
type: item
date: 2021-09-18T12:00:00+08:00
description: Inter-VLAN Routing (Router on a Stick)Single arm routing_Cover.png前言: 所有的練習是基於「Cisco Packet Tracer」軟件平台。原理: Inter-VLAN Routing 意思是使原本相互隔離的vlan間互通，而Router on a Stick(也叫單臂路由) 是指在路由器的單口上實現vlan互通。目標: 在路由器的單網口上配置多組vlan，在不同的vlan間相互通信。模擬場景: Diagram_2021-09-18_095748.pngvLanIP(Subnet)vlan1010.10.10.0/24vlan2010.10.20.0/24PC1在vlan10，PC2在vlan20，两部電腦的IP在不同的網段，透過路由器的設定使PC1和PC2可以相互溝通。路由器的設置(Cisco 2901) Router_2021-09-18_092543.pngRouter>enable Router#configure terminal進入Global Configuration Mode模式Router(config)#interface gigabitEthernet 0/1 Router(config-if)#no shutdown Router(config-if)#exit選物理取網口0/1，并啟用Router(config)#interface gigabitEthernet 0/1.10 Router(config-subif)#encapsulation dot1Q 10 Router(config-subif)#ip address 10.10.10.1 255.255.255.0 Router(config-subif)#exit在物理網口0/1上配置子網口配置802.1Q協定，并劃分vlan10設定網口IP地址Router(config)#interface gigabitEthernet 0/1.20 Router(config-subif)#encapsulation dot1Q 20 Router(config-subif)#ip address 10.10.20.1 255.255.255.0 Router(config-subif)#end在物理網口0/1上配置子網口配置802.1Q協定，并劃分vlan20設定網口IP地址Router#write memory存檔路由器的DHCP伺服器設置Router_DHCP_2021-09-18_094946.pngRouter>enable Router#configure terminal進入Global Configuration Mode模式Router(config)#ip dhcp excluded-address 10.10.10.1 10.10.10.50 Router(config)#ip dhcp pool dhcp.vlan10 Router(dhcp-config)#default-router 10.10.10.1 Router(dhcp-config)#network 10.10.10.0 255.255.255.0 Router(dhcp-config)#dns-server 1.1.1.1 Router(dhcp-config)#exit10.10.10.1 - 10.10.10.50為保留IP地址段，不分派到裝置。建立地址分派池名稱為dhcp.vlan10預設路由IP地址 10.10.10.1網段是 10.10.10.0/24DNS伺服器為 1.1.1.1Router(config)#ip dhcp excluded-address 10.10.20.1 10.10.20.50 Router(config)#ip dhcp pool dhcp.vlan20 Router(dhcp-config)#default-router 10.10.20.1 Router(dhcp-config)#network 10.10.20.0 255.255.255.0 Router(dhcp-config)#dns-server 1.1.1.1 Router(dhcp-config)#exit10.10.20.1 - 10.10.20.50為保留IP地址段，不分派到裝置。建立地址分派池名稱為dhcp.vlan20預設路由IP地址 10.10.20.1網段是 10.10.20.0/24DNS伺服器為 1.1.1.1Router(dhcp-config)#end Router#write存檔交換機的設置(Cisco 2960-24T)Switch_2021-09-18_091…