码迷,mamicode.com
首页 > 其他好文 > 详细

配置单臂路由

时间:2018-07-31 22:00:18      阅读:149      评论:0      收藏:0      [点我收藏+]

标签:sig   upd   comm   hang   red   开启   outer   from   ima   

技术分享图片

 

R1

由器的物理接口可以被划分为成多个逻辑接口,这些被划分后的逻辑接口被形象的称为子接口。值得注意的是这些逻辑子接口不能被单独的开启或关闭

Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.

Router(config)#hostname R1

#进入和交换机连接的那个接口 0/0
R1(config)#interface fastEthernet 0/0

#激活该端口
R1(config-if)#no shutdown 

R1(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

R1(config-if)#exit

#配置 子接口 这是配置单臂路由的关键,这个接口是个 逻辑接口,并不是实际存在的

R1(config)#interface fastEthernet 0/0.2
R1(config-subif)#
%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

#.为这个接口配置802.1Q协议,最后面的 2 是vlan 号,这也是关键部分
R1(config-subif)#encapsulation dot1Q 2

#为该接口划分网关地址
R1(config-subif)#ip add 192.168.2.254 255.255.255.0

R1(config-subif)#interface fastEthernet 0/0.3
R1(config-subif)#
%LINK-5-CHANGED: Interface FastEthernet0/0.3, changed state to up

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

#.为这个接口配置802.1Q协议,最后面的 3 是vlan 号
R1(config-subif)#encapsulation dot1Q 3

#划分网关地址和子网掩码
R1(config-subif)#ip add 192.168.3.254 255.255.255.0

R1(config-subif)#end
R1#
%SYS-5-CONFIG_I: Configured from console by console


R1(config)#end

R1#show ip int br
Interface              IP-Address      OK? Method Status                Protocol 
FastEthernet0/0        unassigned      YES unset  up                    up 
FastEthernet0/0.2      192.168.2.254   YES manual up                    up 
FastEthernet0/0.3      192.168.3.254   YES manual up                    up 
FastEthernet0/1        unassigned      YES unset  administratively down down 
Vlan1                  unassigned      YES unset  administratively down down
R1#

 

SW1

Switch>en
Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.

Switch(config)#hostname SW1
SW1(config)#vlan 2
SW1(config-vlan)#name caiwu
SW1(config-vlan)#vlan 3
SW1(config-vlan)#name it

SW1(config-vlan)#end
SW1#
%SYS-5-CONFIG_I: Configured from console by console

SW1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.

SW1(config)#interface range fastEthernet 0/1-2

SW1(config-if-range)#switchport mode access 

SW1(config-if-range)#switchport access vlan 2

SW1(config-if-range)#interface range fastEthernet 0/3-5

SW1(config-if-range)#switchport mode access 

SW1(config-if-range)#switchport access vlan 3
SW1(config-if-range)#end
SW1#
%SYS-5-CONFIG_I: Configured from console by console

SW1#show vlan brief 

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/6, Fa0/7, Fa0/8, Fa0/9
                                                Fa0/10, Fa0/11, Fa0/12, Fa0/13
                                                Fa0/14, Fa0/15, Fa0/16, Fa0/17
                                                Fa0/18, Fa0/19, Fa0/20, Fa0/21
                                                Fa0/22, Fa0/23, Fa0/24, Gig0/1
                                                Gig0/2
2    caiwu                            active    Fa0/1, Fa0/2
3    it                               active    Fa0/3, Fa0/4, Fa0/5
1002 fddi-default                     active    
1003 token-ring-default               active    
1004 fddinet-default                  active    
1005 trnet-default                    active    

SW1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
SW1(config)#in

SW1(config)#interface gigabitEthernet 0/1
  allowed  Set allowed VLAN characteristics when interface is in trunking mode
  native   Set trunking native characteristics when interface is in trunking
           mode

SW1(config-if)#switchport mode trunk 

SW1(config-if)#switchport nonegotiate
%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/1, changed state to down %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/1, changed state to up SW1(config-if)#end SW1# %SYS-5-CONFIG_I: Configured from console by console SW1#show interfaces trunk Port Mode Encapsulation Status Native vlan Gig0/1 on 802.1q trunking 1 Port Vlans allowed on trunk Gig0/1 1-1005 Port Vlans allowed and active in management domain Gig0/1 1,2,3 Port Vlans in spanning tree forwarding state and not pruned Gig0/1 1,2,3 SW1#conf t Enter configuration commands, one per line. End with CNTL/Z. SW1(config)#interface fastEthernet 0/24 SW1(config-if)#switchport mode trunk SW1(config-if)#switchport nonegotiate

 

SW2

Switch>en
Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#vlan 2
Switch(config-vlan)#name caiwu
Switch(config-vlan)#vlan 3
Switch(config-vlan)#name it
Switch(config-vlan)#exit

SW1(config)#hostname SW2

SW2(config)#interface fastEthernet 0/1

SW2(config-if)#switchport mode access 

SW2(config-if)#switchport access vlan 2

SW2(config-if)#interface fastEthernet 0/2

SW2(config-if)#switchport mode access 

SW2(config-if)#switchport access vlan 3
SW2(config-if)#end
SW2#
%SYS-5-CONFIG_I: Configured from console by console

SW2#show vlan brief 

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/3, Fa0/4, Fa0/5, Fa0/6
                                                Fa0/7, Fa0/8, Fa0/9, Fa0/10
                                                Fa0/11, Fa0/12, Fa0/13, Fa0/14
                                                Fa0/15, Fa0/16, Fa0/17, Fa0/18
                                                Fa0/19, Fa0/20, Fa0/21, Fa0/22
                                                Fa0/23, Fa0/24, Gig0/1, Gig0/2
2    caiwu                            active    Fa0/1
3    it                               active    Fa0/2
1002 fddi-default                     active    
1003 token-ring-default               active    
1004 fddinet-default                  active    
1005 trnet-default                    active    
SW2#
%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/1, changed state to down

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

SW2#conf t
Enter configuration commands, one per line.  End with CNTL/Z.

SW2(config)#interface gigabitEthernet 0/1

SW2(config-if)#switchport mode trunk 

SW1(config-if)#switchport nonegotiate

SW2(config-if)#
SW2(config-if)#end
SW2#
%SYS-5-CONFIG_I: Configured from console by console


SW2#show interfaces trunk 
Port        Mode         Encapsulation  Status        Native vlan
Gig0/1      on           802.1q         trunking      1

Port        Vlans allowed on trunk
Gig0/1      1-1005

Port        Vlans allowed and active in management domain
Gig0/1      1,2,3

Port        Vlans in spanning tree forwarding state and not pruned
Gig0/1      1,2,3

SW2#

 

 

技术分享图片

 

配置单臂路由

标签:sig   upd   comm   hang   red   开启   outer   from   ima   

原文地址:https://www.cnblogs.com/peter1007/p/9397834.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!