公告

文章

评论

留言

连接

信息

登陆

搜索

2008-8-13 18:17:17
为vlan单臂路由


需要注意的是 R3的主接口配置双工, 子接口配置封装模式同时指明vlan id

SW1的接口上,上先配速度,再配双工,与R1R2access,与R3trunk(封装802.1q),

Router>en

Router#conf t

Enter configuration commands, one per line.  End with CNTL/Z.

Router(config)#no ip do lo

Router(config)#line con 0

Router(config-line)#logg syn

Router(config-line)#no exec-t

Router(config-line)#exit

Router(config)#host R1

R1(config)#no ip routing

R1(config)#ip defaul

R1(config)#ip default-ga

R1(config)#ip default-gateway 13.0.0.3 ?

  <cr>

 

R1(config)#ip default-gateway 13.0.0.3

R1(config)#int e0/0

R1(config-if)#ip ad 13.0.0.1 255.255.255.0

R1(config-if)#no shu

R1(config-if)#

*Mar  1 00:09:09.171: %LINK-3-UPDOWN: Interface Ethernet0/0, changed state to up

*Mar  1 00:09:10.171: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0, changed state to up

R1(config-if)#duple

R1(config-if)#duplex ?

  full  Force full duplex operation

  half  Force half-duplex operation

 

R1(config-if)#duplex full

 

 

R3(config)#int e0/0

R3(config-if)#duplex fu

R3(config-if)#duplex full         主接口下

R3(config-if)#exit

R3(config)#int e0/0.1

R3(config-subif)#ip add 13.0.0.3 255.255.255.0              没有封装,配不上IP

 

% Configuring IP routing on a LAN subinterface is only allowed if that

subinterface is already configured as part of an IEEE 802.10, IEEE 802.1Q,

or ISL vLAN.

 

R3(config-subif)#encap

R3(config-subif)#encapsulation dot1q

% Incomplete command.

 

R3(config-subif)#enca

R3(config-subif)#encapsulation ?

  dot1Q  IEEE 802.1Q Virtual LAN

 

R3(config-subif)#encapsulation dot1q ?

  <1-4095>  IEEE 802.1Q VLAN ID required, range 1 - 0xFFF.

 

R3(config-subif)#encapsulation dot1q 13 ?           必须有vlan id 13

  native  Make this as native vlan

  <cr>

 

R3(config-subif)#encapsulation dot1q 13

R3(config-subif)#ip add 13.0.0.3 255.255.255.0

 

 

R3(config)#int e 0/0

R3(config-if)#no shu                                 不要忘记总接口下的no shu

 

 

sw(config)#host SW1

SW1(config)#no ip routing

SW1(config)#end

SW1#vlan database

SW1(vlan)#vlan 13 name vlan13

VLAN 13 added:

    Name: vlan13

SW1(vlan)#vlan 23 name vlan23

VLAN 23 added:

    Name: vlan23

SW1(vlan)#int f0/1

          ^

% Invalid input detected at '^' marker.

 

SW1(vlan)#exit

APPLY completed.

Exiting....

SW1#conf t

Enter configuration commands, one per line.  End with CNTL/Z.

SW1(config)#int f0/1

SW1(config-if)#switchport mode access

 

 

SW1(config-if)#switchport access vlan 13

 

SW1(config-if)#speed 10

 

SW1(config-if)#duplex full

 

 

SW1(config-if)#int f0/2

SW1(config-if)#sw

SW1(config-if)#switchport mode acc

SW1(config-if)#switchport mode access

SW1(config-if)#sw

SW1(config-if)#switchport acc vlan 23

SW1(config-if)#dup

SW1(config-if)#duplex full

SW1(config-if)#duplex full

Duplex will not be set until speed is set to non-auto value        必须先配速度

SW1(config-if)#speed 10

SW1(config-if)#duplex full

 

 

开始配与R3trunk

SW1(config-if)#speed 10

SW1(config-if)#duplex full

SW1(config-if)#

*Mar  1 00:31:04.507: %LINK-3-UPDOWN: Interface FastEthernet0/3, changed state to up

SW1(config-if)#swi

SW1(config-if)#switchport mode

SW1(config-if)#switchport mode trun

SW1(config-if)#switchport mode trunk

 

SW1(config-if)#switchport trunk encapsulation dot1q        两条命令

SW1(config-if)#

 

 

R1#ping 23.0.0.2

 

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 23.0.0.2, timeout is 2 seconds:      

!!!!!

 

 

R3#show ip r

*Mar  1 00:36:52.379: %SYS-5-CONFIG_I: Configured from console by console

R3#show ip route

Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP

       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

       E1 - OSPF external type 1, E2 - OSPF external type 2

       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area

       * - candidate default, U - per-user static route, o - ODR

       P - periodic downloaded static route

 

Gateway of last resort is not set

 

     23.0.0.0/24 is subnetted, 1 subnets

C       23.0.0.0 is directly connected, Ethernet0/0.2                    都当作直连对待

     13.0.0.0/24 is subnetted, 1 subnets

C       13.0.0.0 is directly connected, Ethernet0/0.1



发表评论:

    昵称:
    密码:
    主页:
    标题:
Powered by Oblog.