日志分类:Netwroking

单臂路由的完整配置

2010年03月15日 2:37 下午  |  分类:Netwroking

1、设置虚拟PC的IP
 ip 192.168.10.1 192.168.10.254
设置网管是为了跨区域通讯。
查看IP地址sh

2、进设备
配置基本的
Router#configure terminal   #进入到配置模式下
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#hostname SW1  #更改交换机的名称
SW1(config)#no ip domain lookup   #关闭查询功能
SW1(config)#line console 0
SW1(config-line)#logging synchronous   #同步日志
SW1(config-line)#exec-timeout 0 0     #配置为永远不超时 exec-

timeout 0 10  表示登录后无操作10秒后超时登出,这时候就要重新输入密

码登陆设备。
SW1(config-line)#end
以上的命令路由器和交换机上都要做

3、关闭每台交换机的路由功能
SW1(config)#no ip routing

4、做两天交换机之间的trunk和以太接口

SW1(config)#interface range fastEthernet0/14 – 15 #进入交换机1的14

和15端口
SW1(config-if-range)#channel-group 1 mode on   #绑定为以太口
SW1(config)#int port-channel 1  #进入以太口
SW1(config-if)#switchport trunk encapsulation dot1q  #做trunk并做

dot1q的封装。
SW1(config-if)#switchport mode trunk #设置为trunk模式
SW1(config-if)#no sh #激活端口

上面的几步在sw2上也要做验证trunk的命令如下
SW1#show interfaces trunk
Port      Mode         Encapsulation  Status        Native vlan
Fa0/0     on           802.1q         trunking      1
Po1       on           802.1q         trunking      1

Port      Vlans allowed on trunk
Fa0/0     1-1005
Po1       1-1005

Port      Vlans allowed and active in management domain
Fa0/0     1,10,20
Po1       1,10,20

Port      Vlans in spanning tree forwarding state and not pruned
Fa0/0     1,10,20
Po1       1,10,20
5、创建vlan和做vtp
SW1#vlan database    #通过数据库模式创建vlan
SW1(vlan)#vlan 10 name fin    #创建vlan 10 并命名
VLAN 10 added:
    Name: fin
SW1(vlan)#vlan 20 name mar
VLAN 20 added:
    Name: mar
SW1(vlan)#vtp ?   #设置vtp,查看vtp命令
  client       Set the device to client mode.
  domain       Set the name of the VTP administrative domain.
  password     Set the password for the VTP administrative domain.
  pruning      Set the administrative domain to permit pruning.
  server       Set the device to server mode.
  transparent  Set the device to transparent mode.
  v2-mode      Set the administrative domain to V2 mode.

SW1(vlan)#vtp server   #设置vtp模式
Device mode already VTP SERVER. 

SW1(vlan)#vtp domain cisco    #设置vtp域名
Changing VTP domain name from NULL to cisco

SW1(vlan)#vtp pruning  #开启裁剪模式
Pruning switched ON

SW1(vlan)#vtp password 123  #设置vtp密码
Setting device VLAN database password to 123.
SW1(vlan)#exit

在SW1上做完vtp后,在进入到SW2中做vtp,在SW2上做了vtp后SW2就可以把

SW1上的vlan学习到了。

6、通过vtp效验
SW1#sh vtp status
VTP Version                     : 2
Configuration Revision          : 1
Maximum VLANs supported locally : 256
Number of existing VLANs        : 7
VTP Operating Mode              : Server
VTP Domain Name                 : cisco
VTP Pruning Mode                : Enabled
VTP V2 Mode                     : Disabled
VTP Traps Generation            : Disabled
MD5 digest                      : 0×81 0xE9 0×5C 0×99 0xDA 0×01

0xCE 0×3A
Configuration last modified by 0.0.0.0 at 3-1-02 00:14:30
Local updater ID is 0.0.0.0 (no valid interface found)
比较两台交换机上的MD5值,如果一样则证明vtp是通的

7、将端口加入到vlan中
SW1(config)#int fa0/1
SW1(config-if)#switchport mode access 

SW1(config-if)#switchport access vlan 10 
SW1(config-if)#no sh

8、做sw1与R1的trunk
SW1(config-if)#int fa0/0    
SW1(config-if)#switchport tr
SW1(config-if)#switchport trunk en do
SW1(config-if)#switchport mode trunk
SW1(config-if)#no sh

9、配置路由
R1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R1(config)#int fa0/0
R1(config-if)#no ip address 
R1(config-if)#no sh

01:00:53: %LINEPROTO-5-UPDOWN: Line protocol on Interface

FastEthernet0/0, changed state to up
R1(config-if)#
R1(config)#interface fastEthernet0/0.1  #进入子端口
R1(config-subif)#encapsulation dot1Q 10  #封装到vlan 10

R1(config-subif)#ip add 192.168.10.254 255.255.255.0 #对子端口进行

ip配置
R1(config-subif)#no sh
R1(config-subif)#int fa0/0.2
R1(config-subif)#encapsulation dot1Q 20
R1(config-subif)#ip address 192.168.20.254 255.255.255.0
R1(config-subif)#no sh
R1(config-subif)#int fa0/0.1

10、验证正确性,在虚拟pc1上ping虚拟pc2的网关。

私有地址

2010年03月11日 11:04 上午  |  分类:Netwroking

私有地址(Private address)属于非注册地址,专门为组织机构内部使用。
  以下表列出留用的内部寻址地址
  A类 10.0.0.0 –10.255.255.255
  B类 172.16.0.0–172.31.255.255
  C类 192.168.0.0–192.168.255.255
  1. A类地址
  ⑴ A类地址第1字节为网络地址,其它3个字节为主机地址。另外第1个字节的最高位固定为0。
  ⑵ A类地址范围:1.0.0.1到126.255.255.254。
  ⑶ A类地址中的私有地址和保留地址:
  ①10.0.0.0到10.255.255.255是私有地址(所谓的私有地址就是在互联网上不使用,而被用在局域网络中的地址)。
  ② 127.0.0.0到127.255.255.255是保留地址,用做循环测试用的。
  2. B类地址
  ⑴ B类地址第1字节和第2字节为网络地址,其它2个字节为主机地址。另外第1个字节的前两位固定为10。
  ⑵ B类地址范围:128.0.0.1到191.255.255.254。
  ⑶ B类地址的私有地址和保留地址
  ① 172.16.0.0到172.31.255.255是私有地址
  ②169.254.0.0到169.254.255.255是保留地址。如果你的IP地址是自动获取IP地址,而你在网络上又没有找到可用的DHCP服务器,这时你将会从169.254.0.0到169.254.255.255中临得获得一个IP地址。
  3. C类地址
  ⑴C类地址第1字节、第2字节和第3个字节为网络地址,第4个个字节为主机地址。另外第1个字节的前三位固定为110。
  ⑵ C类地址范围:192.0.0.1到223.255.255.254。
  ⑶ C类地址中的私有地址:192.168.0.0到192.168.255.255是私有地址。

Trunk配置

2010年03月9日 9:59 下午  |  分类:Netwroking

 

一、交换机SW1配置:

Switch1(config)#vlan 20
Switch1(config)#vlan 30

Switch1(config)#interface fastEthernet 0/1
Switch1(config-if)#switchport mode access
Switch1(config-if)#switchport access vlan 20

Switch1(config)#interface fastEthernet 0/2
Switch1(config-if)#switchport mode access
Switch1(config-if)#switchport access vlan 30

Switch1#show vlan

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
20   VLAN0020                         active    Fa0/1
30   VLAN0030                         active    Fa0/2
1002 fddi-default                     active  
1003 token-ring-default               active  
1004 fddinet-default                  active  
1005 trnet-default                    active  

VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
—- —– ———- —– —— —— ——– —- ——– —— ——
1    enet  100001     1500  -      -      -        -    -        0      0
20   enet  100020     1500  -      -      -        -    -        0      0
30   enet  100030     1500  -      -      -        -    -        0      0
1002 enet  101002     1500  -      -      -        -    -        0      0
1003 enet  101003     1500  -      -      -        -    -        0      0
1004 enet  101004     1500  -      -      -        -    -        0      0
1005 enet  101005     1500  -      -      -        -    -        0      0

Switch1(config)#interface fastEthernet 0/24
Switch1(config-if)#switchport mode trunk     //2950交换机只能封装dot1q ,所以无须键入switchport trunk encanpsulation dotiq
Switch1#show vlan

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
20   VLAN0020                         active    Fa0/1
30   VLAN0030                         active    Fa0/2
1002 fddi-default                     active  
1003 token-ring-default               active  
1004 fddinet-default                  active  
1005 trnet-default                    active  

VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
—- —– ———- —– —— —— ——– —- ——– —— ——
1    enet  100001     1500  -      -      -        -    -        0      0
20   enet  100020     1500  -      -      -        -    -        0      0
30   enet  100030     1500  -      -      -        -    -        0      0
1002 enet  101002     1500  -      -      -        -    -        0      0
1003 enet  101003     1500  -      -      -        -    -        0      0
1004 enet  101004     1500  -      -      -        -    -        0      0
1005 enet  101005     1500  -      -      -        -    -        0      0

Switch1#show interfaces trunk
Port        Mode         Encapsulation  Status        Native vlan
Fa0/24      on           802.1q         trunking      1

Port        Vlans allowed on trunk
Fa0/24      1-1005

Port        Vlans allowed and active in management domain
Fa0/24      1,20,30,1002,1003,1004,1005

Port        Vlans in spanning tree forwarding state and not pruned
Fa0/24      1,20,30,1002,1003,1004,1005
Switch1(config)#interface fastEthernet 0/24
Switch1(config-if)#switchport native vlan 20
Switch1#show interfaces trunk
Port        Mode         Encapsulation  Status        Native vlan
Fa0/24      on           802.1q         trunking      20

Port        Vlans allowed on trunk
Fa0/24      1-1005

Port        Vlans allowed and active in management domain
Fa0/24      1,20,30,1002,1003,1004,1005

Port        Vlans in spanning tree forwarding state and not pruned
Fa0/24      1,20,30,1002,1003,1004,1005

 二、交换机SW2配置:

Switch2(config)#interface fastEthernet 0/24
Switch2(config-if)#switchport mode trunk

三、DTP

Cisco交换机之间的链路是否形成Trunk是可以自动协商的,这个协议称为DTP(Dynamic Trunk Protocol),DTP还可以协商Trunk链路的封装类型。

Դ