单臂路由的简单配置

拓扑图.png

操作步骤:

路由器配置:

Router>en
Router#config t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#no ip domain-lookup
Router(config)#line console 0
Router(config-line)#exec-timeout 0 0
Router(config-line)#logging synchronous
Router(config-line)#exit
Router(config)#int f0/0.1
Router(config-subif)#encapsulation dot1Q 20
Router(config-subif)#ip address 192.168.10.1 255.255.255.0
Router(config-subif)#no shutdown
Router(config-subif)#exit
Router(config)#int f0/0.2
Router(config-subif)#encapsulation dot1Q 10
Router(config-subif)#ip address 172.18.74.1 255.255.255.0
Router(config-subif)#no shutdown
Router(config-subif)#int f0/0
Router(config-if)#no shut

Router(config-if)#
%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)#

SwitchA 配置:

SwitchA>en
SwitchA#config t
Enter configuration commands, one per line. End with CNTL/Z.
SwitchA(config)#no ip domain-lookup
SwitchA(config)#line console 0
SwitchA(config-line)#exec-timeout 0 0
SwitchA(config-line)#logging synchronous
SwitchA(config-line)#exit
SwitchA(config)#int f0/1
SwitchA(config-if)#switchport mode trunk

SwitchA(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up

SwitchA(config-if)#exit
SwitchA(config)#int f0/2
SwitchA(config-if)#switchport mode trunk

SwitchA(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to up

SwitchA(config-if)#exit
SwitchA(config)#vlan 10
SwitchA(config-vlan)#exit
SwitchA(config)#vlan 20
SwitchA(config-vlan)#exit
SwitchA(config)#int f0/3
SwitchA(config-if)#switchport access vlan 10
SwitchA(config-if)#exit
SwitchA(config)#int f0/4
SwitchA(config-if)#switchport access vlan 20
SwitchA(config-if)#

SwitchB 配置:

SwitchB>en
SwitchB#config t
Enter configuration commands, one per line. End with CNTL/Z.
SwitchB(config)#line console 0
SwitchB(config-line)#exec-timeout 0 0
SwitchB(config-line)#logging synchronous
SwitchB(config-line)#exit
SwitchB(config)#no ip domain-lookup
SwitchB(config)#int f0/1
SwitchB(config-if)#switchport mode trunk
SwitchB(config-if)#exit
SwitchB(config)#vlan 10
SwitchB(config-vlan)#exit
SwitchB(config)#vlan 20
SwitchB(config-vlan)#exit
SwitchB(config)#int f0/2
SwitchB(config-if)#switchport access vlan 10
SwitchB(config-if)#exit
SwitchB(config)#int f0/3
SwitchB(config-if)#switchport access vlan 20
SwitchB(config-if)#

测试:
在PC3 ping PC0、1、2

PC0.png

在PC0 ping pc1、2、3

PC3.png

参数说明:

config t   进入全局配置模式
no ip domain-lookup   禁用DNS查找功能
line console 0  进入console #配置模式
exec-timeout 0 0 配置控制台会话永不超时
logging synchronous  配置控制台输出日志同步
int f0/0.1 进入子接口
encapsulation dot1Q 20  设置该接口的封装模式为802.1q,并配置vlan20服务
ip address 192.168.10.1 255.255.255.0 配置IP地址和子网掩码
no shutdown  开启子接口
switchport mode trunk 把端口设置为trunk模式
vlan 10 创建vlan10
switchport access vlan 10 把端口加入到vlan当中
-------------本文结束感谢您的阅读-------------
请我吃辣条
0%