本人目前在学习路由器,下面是一个单臂路由的实验,我该配的都配了 ,VLAN划的没错 ,DOT1Q封装,TRUNK链路都配了, a.b.c的网关配的1.4D,E.F的网关为 2.4为什么能ping通网关ping不到对端?目的全网通信,任意一点可以ping通,请告诉我所有命令,包括划分VLAN,满意追加100分,那些粘来的就不用了 ,
S1é ç½®Vlan VTP
S1(config)#vlan 10
S1(config-vlan)#exit
S1(config)#vlan 20
S1(config-vlan)#exit
S1(config)#vlan 30
S1(config-vlan)#exit
S1(config)#vlan 40
S1(config-vlan)#exit
S1(config)#vtp
S1(config)#vtp ?
domain Set the name of the VTP administrative domain.
mode Configure VTP device mode
password Set the password for the VTP administrative domain
version Set the adminstrative domain to VTP version
S1(config)#vtp do
S1(config)#vtp domain ?
WORD The ascii name for the VTP administrative domain.
S1(config)#vtp domain ccna
Changing VTP domain name from NULL to ccna
S1(config)#vtp m s
Device mode already VTP SERVER.
S1(config)#vtp pass ccna
Setting device VLAN database password to ccna
S1(config)#
S1(config)#int r f 0/1 - 2
S1(config-if-range)#sw m t
%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
S1(config-if-range)#sw m t
S1(config-if-range)#
===============================================================
S2ä¸çvtp
S2(config)#vtp do ccna
Changing VTP domain name from NULL to ccna
S2(config)#vtp pass ccna
Setting device VLAN database password to ccna
S2(config)#vtp m c
Setting device to VTP CLIENT mode.
S2(config)#int f 0/2
S2(config-if)#sw m t
S2(config-if)#end
S2#
%SYS-5-CONFIG_I: Configured from console by console
S2#sh vlan
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/1, 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, Gig1/1
Gig1/2
10 VLAN0010 active
20 VLAN0020 active
30 VLAN0030 active
40 VLAN0040 active
1002 fddi-default act/unsup
1003 token-ring-default act/unsup
1004 fddinet-default act/unsup
1005 trnet-default act/unsup
==========================================================
交æ¢æºä¸æ¥å£é ç½®
S1#
S1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
S1(config)#int f 0/10
S1(config-if)#sw m a
S1(config-if)#sw a v 10
S1(config-if)#span po
%Warning: portfast should only be enabled on ports connected to a single
host. Connecting hubs, concentrators, switches, bridges, etc... to this
interface when portfast is enabled, can cause temporary bridging loops.
Use with CAUTION
%Portfast has been configured on FastEthernet0/10 but will only
have effect when the interface is in a non-trunking mode.
S1(config-if)#int f 0/20 è¿å ¥0/20æ¥å£
S1(config-if)#sw m a æ¥å£æ¨¡å¼ä¸ºä¸»æº
S1(config-if)#sw a v 20ååå°Vlan20
S1(config-if)#span poå¯ç¨å¿«é转æ¢
%Warning: portfast should only be enabled on ports connected to a single
host. Connecting hubs, concentrators, switches, bridges, etc... to this
interface when portfast is enabled, can cause temporary bridging loops.
Use with CAUTION
%Portfast has been configured on FastEthernet0/20 but will only
have effect when the interface is in a non-trunking mode.
S1(config-if)#
S1(config-if)#end
S1#
%SYS-5-CONFIG_I: Configured from console by console
S1#sh vlan b
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/1, Fa0/3, Fa0/4, Fa0/5
Fa0/6, Fa0/7, Fa0/8, Fa0/9
Fa0/11, Fa0/12, Fa0/13, Fa0/14
Fa0/15, Fa0/16, Fa0/17, Fa0/18
Fa0/19, Fa0/21, Fa0/22, Fa0/23
Fa0/24, Gig1/1, Gig1/2
10 VLAN0010 active Fa0/10
20 VLAN0020 active Fa0/20
30 VLAN0030 active
40 VLAN0040 active
1002 fddi-default active
1003 token-ring-default active
1004 fddinet-default active
1005 trnet-default active
S1#
=====================================================
R1(config)#ip dh poo 2é ç½®DHCPæå¡
R1(dhcp-config)#net 192.168.2.0 255.255.255.0 å°åæ±
R1(dhcp-config)#de
R1(dhcp-config)#default-router 192.168.2.1 ç½å ³
R1(dhcp-config)#dns
R1(dhcp-config)#dns-server 61.134.1.4 DNSæå¡å¨
R1(dhcp-config)#exit
以æ¤ç±»æ¨ sh run
!
ip dhcp pool 1
network 192.168.1.0 255.255.255.0
default-router 192.168.1.1
dns-server 61.134.1.4
ip dhcp pool 2
network 192.168.2.0 255.255.255.0
default-router 192.168.2.1
dns-server 61.134.1.4
ip dhcp pool 3
network 192.168.3.0 255.255.255.0
default-router 192.168.3.1
dns-server 61.134.1.4
ip dhcp pool 4
network 192.168.4.0 255.255.255.0
default-router 192.168.4.1
dns-server 61.134.1.4
===================================================
R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#int f 0/1.10 è¿å ¥åæ¥å£ 1.10 åé¢10没æææåªä¸è¿æè¿æ¯Vlan10çæ¥å£ æ以æå10
%LINK-5-CHANGED: Interface FastEthernet0/1.10, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1.10, changed state to up
R1(config-subif)#
R1(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
mtu Set the interface Maximum Transmission Unit (MTU)
no Negate a command or set its defaults
shutdown Shutdown the selected interface
R1(config-subif)#en
R1(config-subif)#encapsulation d
R1(config-subif)#encapsulation dot1Q 10 ä¸ç»§æ¨¡å¼ ä¸ç»§çVlan10
R1(config-subif)#ip add 192.168.1.1 255.255.255.0
R1(config-subif)#
åèèµæï¼èªå·±æ²ç
交换机和路由器连接线为直通线 路由器F0/0端口连接交换机1端口
配置F0/0.1 封装 encapsulation dot1q 2(VLAN号)
配置网关IP地址
F0/0.2封装VLAN3 encapsulation dot1q 3 也配置IP
其余电脑设置相对应的IP和网关就可以了 下面是路由器的配置命令 交换机只是简单创建VLAN 然后将端口指定为TRUNK或ACCESS 然后划分到VLAN下就可以了 VLAN不需要指定IP地址
interface FastEthernet0/0.1
encapsulation dot1Q 2
ip address 192.168.1.254 255.255.255.0
interface FastEthernet0/0.2
encapsulation dot1Q 3
ip address 192.168.2.254 255.255.255.0
interface FastEthernet0/0.3
encapsulation dot1Q 1 native
ip address 192.168.3.254 255.255.255.0
int f0/0
no shut
第二,配置没问题。从图中可知,路由和交换机连接电缆,错了,用真通。