CCNA第二天

来源:互联网 发布:apache服务器添加域名 编辑:程序博客网 时间:2024/06/11 15:28

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

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

IP

pc IP address 192.168.1.1 Subnet Mask 255.255.255.0 Default Gateway 192.168.1.254 DNS Server 192.168.2.1 Server0 DNS IP address 192.168.2.1 Subnet Mask 255.255.255.0 Default Gateway 192.168.2.254 DNS Server 192.168.2.1 Server1 web IP address 192.168.2.2 Subnet Mask 255.255.255.0 Default Gateway 192.168.2.254 DNS Serve1 92.168.2.1

路由器配置

         --- System Configuration Dialog ---Continue with configuration dialog? [yes/no]: noPress RETURN to get started!Router>enable Router#configure terminal Enter configuration commands, one per line.  End with CNTL/Z.Router(config)#interface f0/0Router(config-if)#ip addRouter(config-if)#ip address 192.168.1.254 255.255.255.0Router(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 upRouter(config-if)#exit Router(config)#interface f0/1Router(config-if)#ip address 192.168.2.254 255.255.255.0Router(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 upRouter(config-if)#^ZRouter#%SYS-5-CONFIG_I: Configured from console by consoleRouter#wrBuilding configuration...[OK]Router#

单臂路由器实验

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

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

这里写图片描述

IP

pc0 IP address 192.168.1.1 Subnet Mask 255.255.255.0 Default Gateway 192.168.1.254 pc1 IP address 192.168.1.2 Subnet Mask 255.255.255.0 Default Gateway 192.168.1.254 pc2 IP address 192.168.2.1 Subnet Mask 255.255.255.0 Default Gateway 192.168.2.254 pc3 IP address 192.168.2.2 Subnet Mask 255.255.255.0 Default Gateway 192.168.2.254 pc4 IP address 192.168.3.1 Subnet Mask 255.255.255.0 Default Gateway 192.168.3.254 pc5 IP address 192.168.3.2 Subnet Mask 255.255.255.0 Default Gateway 192.168.1.254

链接

PC0-->Fa0/1PC1-->Fa0/2PC2-->Fa0/10PC3-->Fa0/11PC4-->Fa0/20PC5-->Fa0/21Router0 Fa0/0 -->Fa0/24

交换机配置

Switch>Switch>enable Switch#configure terminal Enter configuration commands, one per line.  End with CNTL/Z.Switch(config)#vlan 2Switch(config-vlan)#name vlan2Switch(config-vlan)#vlan 3Switch(config-vlan)#name vlan3Switch(config-vlan)#vlan 4Switch(config-vlan)#name vlan4Switch(config)#exit Switch#%SYS-5-CONFIG_I: Configured from console by consoleSwitch#show vlanVLAN 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/242    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      02    enet  100002     1500  -      -      -        -    -        0      03    enet  100003     1500  -      -      -        -    -        0      04    enet  100004     1500  -      -      -        -    -        0      01002 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-2Switch(config-if-range)#switchport mode access Switch(config-if-range)#switchport  access vlan 2Switch(config-if-range)#interface range f0/10-11Switch(config-if-range)#switchport  access vlan 3Switch(config-if-range)#interface range f0/20-21Switch(config-if-range)#switchport  access vlan 4Switch(config-if-range)#^ZSwitch#%SYS-5-CONFIG_I: Configured from console by consoleSwitch#show vlanVLAN 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/242    vlan2                            active    Fa0/1, Fa0/23    vlan3                            active    Fa0/10, Fa0/114    vlan4                            active    Fa0/20, Fa0/211002 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      02    enet  100002     1500  -      -      -        -    -        0      03    enet  100003     1500  -      -      -        -    -        0      04    enet  100004     1500  -      -      -        -    -        0      01002 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#wrBuilding configuration...[OK]Switch#Switch#enSwitch#configure terminal Enter configuration commands, one per line.  End with CNTL/Z.Switch(config)#interface f0/24Switch(config-if)#switchport mode trunk Switch(config-if)#^ZSwitch#%SYS-5-CONFIG_I: Configured from console by consoleSwitch#wrBuilding configuration...[OK]Switch#Switch#

路由器配置

         --- System Configuration Dialog ---Continue with configuration dialog? [yes/no]: noPress RETURN to get started!Router>enRouter#conf tEnter configuration commands, one per line.  End with CNTL/Z.Router(config)#int f0/0Router(config-if)#no shRouter(config-if)#%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to upRouter(config-if)#Router(config-if)#int f0/0.1Router(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 upRouter(config-subif)#encapsulation dot1Q 2Router(config-subif)#ip add 192.168.1.254 255.255.255.0Router(config-subif)#int f0/0.2Router(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 upRouter(config-subif)#encapsulation dot1Q 3Router(config-subif)#ip add 192.168.2.254 255.255.255.0Router(config-subif)#int f0/0.3Router(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 upRouter(config-subif)#encapsulation dot1Q 4Router(config-subif)#ip add 192.168.3.254 255.255.255.0Router(config-subif)#Router(config-subif)#Router(config-subif)#^ZRouter#%SYS-5-CONFIG_I: Configured from console by consoleRouter#Router#wrBuilding configuration...[OK]Router#

知识点

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