CCNA第二天

使用PC机通过路由器访问网址

其间配置DNS,HTTP
首先划分两个子网
分别是PC(192.168.1.0)和DNS和WEB的网络(192.168.2.0)

IP
pc
IP address192.168.1.1
Subnet Mask255.255.255.0
Default Gateway192.168.1.254
DNS Server192.168.2.1
Server0DNS
IP address192.168.2.1
Subnet Mask255.255.255.0
Default Gateway192.168.2.254
DNS Server192.168.2.1
Server1web
IP address192.168.2.2
Subnet Mask255.255.255.0
Default Gateway192.168.2.254
DNS Serve192.168.2.1
路由器配置



         --- System Configuration Dialog ---

Continue with configuration dialog? [yes/no]: no


Press RETURN to get started!


Router>enable 
Router#configure terminal 
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#interface f0/0
Router(config-if)#ip add
Router(config-if)#ip address 192.168.1.254 255.255.255.0
Router(config-if)#no shutdown 
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

Router(config-if)#exit 
Router(config)#interface f0/1
Router(config-if)#ip address 192.168.2.254 255.255.255.0
Router(config-if)#no shutdown 

Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up

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

Router(config-if)#^Z
Router#
%SYS-5-CONFIG_I: Configured from console by console

Router#wr
Building configuration...
[OK]
Router#

单臂路由器实验

实验需要:
6台PC(192.168.1.0)(192.168.2.0)(192.168.3.0)
划分子网,vlan技术
一台交换机,使得6台机器在3个不同的网络中

单臂路由器的意义是:让不在一个vlan的网络相互通信

这里写图片描述

IP
pc0
IP address192.168.1.1
Subnet Mask255.255.255.0
Default Gateway192.168.1.254
pc1
IP address192.168.1.2
Subnet Mask255.255.255.0
Default Gateway192.168.1.254
pc2
IP address192.168.2.1
Subnet Mask255.255.255.0
Default Gateway192.168.2.254
pc3
IP address192.168.2.2
Subnet Mask255.255.255.0
Default Gateway192.168.2.254
pc4
IP address192.168.3.1
Subnet Mask255.255.255.0
Default Gateway192.168.3.254
pc5
IP address192.168.3.2
Subnet Mask255.255.255.0
Default Gateway192.168.1.254
链接
PC0-->Fa0/1
PC1-->Fa0/2
PC2-->Fa0/10
PC3-->Fa0/11
PC4-->Fa0/20
PC5-->Fa0/21

Router0 Fa0/0 -->Fa0/24
交换机配置
Switch>
Switch>enable 
Switch#configure terminal 
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#vlan 2
Switch(config-vlan)#name vlan2
Switch(config-vlan)#vlan 3
Switch(config-vlan)#name vlan3
Switch(config-vlan)#vlan 4
Switch(config-vlan)#name vlan4
Switch(config)#exit 
Switch#
%SYS-5-CONFIG_I: Configured from console by console

Switch#show vlan

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/1, Fa0/2, 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
2    vlan2                            active    
3    vlan3                            active    
4    vlan4                            active    
1002 fddi-default                     act/unsup 
1003 token-ring-default               act/unsup 
1004 fddinet-default                  act/unsup 
1005 trnet-default                    act/unsup 

VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1    enet  100001     1500  -      -      -        -    -        0      0
2    enet  100002     1500  -      -      -        -    -        0      0
3    enet  100003     1500  -      -      -        -    -        0      0
4    enet  100004     1500  -      -      -        -    -        0      0
1002 fddi  101002     1500  -      -      -        -    -        0      0   
1003 tr    101003     1500  -      -      -        -    -        0      0   
1004 fdnet 101004     1500  -      -      -        ieee -        0      0   
1005 trnet 101005     1500  -      -      -        ibm  -        0      0   

Remote SPAN VLANs
------------------------------------------------------------------------------


Primary Secondary Type              Ports
------- --------- ----------------- ------------------------------------------
Switch#
Switch(config)#interface range f0/1-2
Switch(config-if-range)#switchport mode access 
Switch(config-if-range)#switchport  access vlan 2
Switch(config-if-range)#interface range f0/10-11
Switch(config-if-range)#switchport  access vlan 3
Switch(config-if-range)#interface range f0/20-21
Switch(config-if-range)#switchport  access vlan 4
Switch(config-if-range)#^Z
Switch#
%SYS-5-CONFIG_I: Configured from console by console

Switch#show vlan

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

VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1    enet  100001     1500  -      -      -        -    -        0      0
2    enet  100002     1500  -      -      -        -    -        0      0
3    enet  100003     1500  -      -      -        -    -        0      0
4    enet  100004     1500  -      -      -        -    -        0      0
1002 fddi  101002     1500  -      -      -        -    -        0      0   
1003 tr    101003     1500  -      -      -        -    -        0      0   
1004 fdnet 101004     1500  -      -      -        ieee -        0      0   
1005 trnet 101005     1500  -      -      -        ibm  -        0      0   

Remote SPAN VLANs
------------------------------------------------------------------------------


Primary Secondary Type              Ports
------- --------- ----------------- ------------------------------------------
Switch#
Switch#wr
Building configuration...
[OK]
Switch#
Switch#en
Switch#configure terminal 
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#interface f0/24
Switch(config-if)#switchport mode trunk 
Switch(config-if)#^Z
Switch#
%SYS-5-CONFIG_I: Configured from console by console

Switch#wr
Building configuration...
[OK]
Switch#
Switch#
路由器配置

         --- System Configuration Dialog ---

Continue with configuration dialog? [yes/no]: no


Press RETURN to get started!




Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#int f0/0
Router(config-if)#no sh

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

Router(config-if)#
Router(config-if)#int f0/0.1
Router(config-subif)#
%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

Router(config-subif)#encapsulation dot1Q 2
Router(config-subif)#ip add 192.168.1.254 255.255.255.0
Router(config-subif)#int f0/0.2
Router(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

Router(config-subif)#encapsulation dot1Q 3
Router(config-subif)#ip add 192.168.2.254 255.255.255.0
Router(config-subif)#int f0/0.3
Router(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

Router(config-subif)#encapsulation dot1Q 4
Router(config-subif)#ip add 192.168.3.254 255.255.255.0
Router(config-subif)#
Router(config-subif)#
Router(config-subif)#^Z
Router#
%SYS-5-CONFIG_I: Configured from console by console

Router#
Router#wr
Building configuration...
[OK]
Router#

知识点

  • show vlan 在#(特权模式下使用)
  • switchport mode access 设置通路,连接交换机和PC
  • switchport mode trunk 设置trunk,及设立主干网路
  • encapsulation dot1Q (4)括号中的数字要与vlan号相匹配
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值