路由器以太网端口单臂路由配置实例路由器以太网端口单臂路由配置实例
将交换机和路由器连接起来如下图:
PC0----SW0----fa0/1 (192.168.10.10/24)
PC0----SW0----fa0/11 (192.168.20.10/24)
SW0(Gi1/1)----RO0(Fa0/0)
我们首先来配置交换机:
Switch>
Switch>en
Switch>enable
Switch#config
Configuring from terminal, memory, or network [termin...
路由器以太网端口单臂路由配置实例
将交换机和路由器连接起来如下图:
PC0----SW0----fa0/1 (192.168.10.10/24)
PC0----SW0----fa0/11 (192.168.20.10/24)
SW0(Gi1/1)----RO0(Fa0/0)
我们首先来配置交换机:
Switch>
Switch>en
Switch>enable
Switch#config
Configuring from terminal, memory, or network [terminal]? Enter configuration commands, one per line. End with CNTL/Z. Switch(config)#inRA
Switch(config)#in ra
Switch(config)#in range fa
Switch(config)#in range fastEthernet 0/1-10
Switch(config-if-range)#sw
Switch(config-if-range)#switchport ?
access Set access mode characteristics of the interface
mode Set trunking mode of the interface
native Set trunking native characteristics when interface is in
trunking mode
nonegotiate Device will not engage in negotiation protocol on this
interface
port-security Security related command
trunk Set trunking characteristics of the interface
voice Voice appliance attributes
Switch(config-if-range)#switchport ac
Switch(config-if-range)#switchport access ?
vlan Set VLAN when interface is in access mode
Switch(config-if-range)#switchport access vl
Switch(config-if-range)#switchport access vlan 10
% Access VLAN does not exist. Creating vlan 10
Switch(config-if-range)#in range fastEthernet 0/11-20 Switch(config-if-range)#switchport access vlan 20
% Access VLAN does not exist. Creating vlan 20
Switch(config-if-range)#^Z
%SYS-5-CONFIG_I: Configured from console by console Switch(config)#in
Switch(config)#interface gi
Switch(config)#interface gigabitEthernet 1/1
Switch(config-if)#sw
Switch(config-if)#switchport ?
access Set access mode characteristics of the interface
mode Set trunking mode of the interface
native Set trunking native characteristics when interface is in
trunking mode
nonegotiate Device will not engage in negotiation protocol on this
interface
port-security Security related command
trunk Set trunking characteristics of the interface
voice Voice appliance attributes
Switch(config-if)#switchport ac
Switch(config-if)#switchport access ?
vlan Set VLAN when interface is in access mode
Switch(config-if)#switchport mo
Switch(config-if)#switchport mode ?
access Set trunking mode to ACCESS unconditionally
dynamic Set trunking mode to dynamically negotiate access or trunk mode
trunk Set trunking mode to TRUNK unconditionally Switch(config-if)#switchport mode tr
Switch(config-if)#switchport mode trunk ?
Switch(config-if)#switchport mode trunk
Switch(config-if)#sw
Switch(config-if)#switchport ?
access Set access mode characteristics of the interface
mode Set trunking mode of the interface
native Set trunking native characteristics when interface is in
trunking mode
nonegotiate Device will not engage in negotiation protocol on this
interface
port-security Security related command
trunk Set trunking characteristics of the interface
voice Voice appliance attributes
Switch(config-if)#switchport tr
Switch(config-if)#switchport trunk ?
allowed Set allowed VLAN characteristics when interface is in trunking mode
native Set trunking native characteristics when interface is in trunking
mode
Switch(config-if)#switchport trunk al
Switch(config-if)#switchport trunk allowed ?
vlan Set allowed VLANs when interface is in trunking mode
Switch(config-if)#switchport trunk allowed vl Switch(config-if)#switchport trunk allowed vlan ?
WORD VLAN IDs of the allowed VLANs when this port is in trunking mode
add add VLANs to the current list
all all VLANs
except all VLANs except the following
none no VLANs
remove remove VLANs from the current list Switch(config-if)#switchport trunk allowed vlan al Switch(config-if)#switchport trunk allowed vlan all ?
Switch(config-if)#switchport trunk allowed vlan all Switch(config-if)#
下面我们来看下配置:
Switch#show running-config
Building configuration...
Current configuration : 1488 bytes
!
version 12.2
no service password-encryption
!
hostname Switch
!
!
!
interface FastEthernet0/1
switchport access vlan 10
!
interface FastEthernet0/2
switchport access vlan 10
!
interface FastEthernet0/3
switchport access vlan 10
!
interface FastEthernet0/4
switchport access vlan 10
!
interface FastEthernet0/5
switchport access vlan 10
!
interface FastEthernet0/6
switchport access vlan 10
!
interface FastEthernet0/7
switchport access vlan 10 !
interface FastEthernet0/8
switchport access vlan 10 !
interface FastEthernet0/9
switchport access vlan 10 !
interface FastEthernet0/10
switchport access vlan 10 !
interface FastEthernet0/11
switchport access vlan 20 !
interface FastEthernet0/12
switchport access vlan 20 !
interface FastEthernet0/13
switchport access vlan 20 !
interface FastEthernet0/14
switchport access vlan 20 !
interface FastEthernet0/15
switchport access vlan 20 !
interface FastEthernet0/16
switchport access vlan 20 !
interface FastEthernet0/17
switchport access vlan 20 !
interface FastEthernet0/18
switchport access vlan 20 !
interface FastEthernet0/19
switchport access vlan 20 !
interface FastEthernet0/20
switchport access vlan 20 !
interface FastEthernet0/21 !
interface FastEthernet0/22 !
interface FastEthernet0/23 !
interface FastEthernet0/24
!
interface GigabitEthernet1/1
switchport mode trunk
!
interface GigabitEthernet1/2
!
interface Vlan1
no ip address
shutdown
!
line con 0
!
line vty 0 4
login
line vty 5 15
login
!
!
end
接下来我们开始配置路由器:
Router>en
Router#config
Configuring from terminal, memory, or network [terminal]? Enter configuration commands, one per line. End with CNTL/Z. Router(config)#in
Router(config)#interface fa
Router(config)#interface fastEthernet 0/0.1 Router(config-subif)#?
arp Set arp type (arpa, probe, snap) or timeout
bandwidth Set bandwidth informational parameter
delay Specify interface throughput delay
description Interface specific description
encapsulation Set encapsulation type for an interface
exit Exit from interface configuration mode
ip Interface Internet Protocol config commands
ipv6 IPv6 interface subcommands
no Negate a command or set its defaults
shutdown Shutdown the selected interface Router(config-subif)#en
Router(config-subif)#encapsulation ?
dot1Q IEEE 802.1Q Virtual LAN
Router(config-subif)#encapsulation dot
Router(config-subif)#encapsulation dot1Q ?
<1-1005> IEEE 802.1Q VLAN ID
Router(config-subif)#encapsulation dot1Q 10 Router(config-subif)#ip ad
Router(config-subif)#ip address 192.168.10.1 255.255.255.0 Router(config-subif)#no sh
Router(config-subif)#no shutdown
Router(config-subif)#interface fastEthernet 0/0.2
Router(config-subif)#encapsulation dot1Q 20
Router(config-subif)#ip address 192.168.20.1 255.255.255.0
Router(config-subif)#no shutdown Router(config-subif)#^Z %SYS-5-CONFIG_I: Configured from console by console
Router#sh
Router#show ru
Building configuration...
Current configuration : 543 bytes !
version 12.4
no service password-encryption !
hostname Router
!
!
!
!
!
ip ssh version 1
!
!
interface FastEthernet0/0
no ip address
duplex auto
speed auto
shutdown
!
interface FastEthernet0/0.1
encapsulation dot1Q 10
ip address 192.168.10.1 255.255.255.0
!
interface FastEthernet0/0.2
encapsulation dot1Q 20
ip address 192.168.20.1 255.255.255.0
!
interface FastEthernet0/1
no ip address
duplex auto
speed auto
shutdown
!
interface Vlan1
no ip address
shutdown
!
ip classless
!
!
!
!
!
line con 0
line vty 0 4
login
!
!
end
Router#
Router#
Router#config
Configuring from terminal, memory, or network [terminal]? Enter configuration commands, one per line. End with CNTL/Z. Router(config)#in
Router(config)#interface fa0/0
Router(config-if)#no sh
Router(config-if)#no shutdown
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
%LINK-5-CHANGED: Interface FastEthernet0/0.1, changed state to up %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.1, changed state to up
%LINK-5-CHANGED: Interface FastEthernet0/0.2, changed state to up %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.2, changed state to up
Router(config-if)#
下面我们来验证配置用PC1pingPC0:
可以看到不同的两个网段的PC相互ping通了。
本文档为【路由器以太网端口单臂路由配置实例】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑,
图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。