Vlan划分及远程登陆设置

来源:互联网 发布:贵州医科大学网络教务 编辑:程序博客网 时间:2024/05/17 08:34

企业园区网交换技术——Vlan划分及远程登陆设置


环境:Cisco Packet Tracer(思科模拟器)

1. VLAN划分

Vlan划分目的是隔离广播域。

拓扑图:

这里写图片描述

(1)给四台主机分配静态IP和掩码
这里写图片描述

(2)对路由器进行配置,划分vlan

Switch>enable       #进入特权模式   Switch#configure terminal           #进入配置模式Enter configuration commands, one per line.  End with CNTL/Z.Switch(config)#hostname Hello      #修改交换机名字Hello(config)#vlan 10       #创建vlanHello(config-vlan)#exitHello(config)#int range fastEthernet 0/1-2   #进入接口1,2Hello(config-if-range)#switch mode access#将接口1,2划分到vlan10Hello(config-if-range)#switch access vlan 10Hello(config-if-range)#exitHello(config)#vlan 20Hello(config-vlan)#exitHello(config)#int range fastEthernet 0/3-4Hello(config-if-range)#switch mode accessHello(config-if-range)#switch access vlan 20Hello(config-if-range)#exitHello(config)#exitHello#%SYS-5-CONFIG_I: Configured from console by console

(3)配置完成后可以看到端口1-2被划分到vlan10,端口3-4被划分到vlan20,其余端口被默认划分到vlan1

Hello#show vlan VLAN Name                             Status    Ports---- -------------------------------- --------- -------------------------------1    default                          active    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                                                Gig0/1, Gig0/210   VLAN0010                         active    Fa0/1, Fa0/220   VLAN0020                         active    Fa0/3, Fa0/41002 fddi-default                     act/unsup 1003 token-ring-default               act/unsup 1004 fddinet-default                  act/unsup 1005 trnet-default                    act/unsup 

现在vlan10的两台主机可以互相访问,vlan20的两台主机可以互相访问,而不同vlan的主机无法互相访问

2. 远程访问

添加一台主机连接到交换机的五号端口,并配置静态IP为192.168.10.1/24 ,拓扑图如下:

这里写图片描述

(1)为新增主机Laptop4添加静态IP和掩码

(2)远程访问vty设置方式介绍

  • no login :无密码,无需登陆
  • login:需要密码
  • login local:需要用户名和密码

(3)vty登陆设置/安全配置

Hello(config)#line vty 0 4 #远程vty设置Hello(config-line)#login  #login模式Hello(config-line)#password 123Hello(config-line)#exitHello(config)#enable password 123  #设置进入特权模式的密码Hello(config)#line console 0   #设置控制台密码Hello(config-line)#password 123Hello(config-line)#exitHello(config)#line vty 0 4Hello(config-line)#login local #login local模式Hello(config-line)#username Koala password 123 #此处可以指定权限,语句为:username Koala password 123 privilege 0-15 Hello(config)#end

(4)设置远程登陆–Telnet

Hello(config)#int vlan 1#为vlan1设置ip地址,作为远程登陆ipHello(config-if)#ip add 192.168.10.222 255.255.255.0Hello(config-if)#no shutdown Hello(config-if)#%LINK-5-CHANGED: Interface Vlan1, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to up

设置完成后可以到Laptop4进行远程telnet登陆,对交换机进行设置

在其终端框输入:telnet [ip address]

(5)设置远程登陆–SSH

Hello(config)#ip domain name Koala.com #声明domain名Hello(config)#crypto key generate rsa  #采用rsa加密方式The name for the keys will be: Hello.Koala.comChoose the size of the key modulus in the range of 360 to 2048 for your  General Purpose Keys. Choosing a key modulus greater than 512 may take  a few minutes.How many bits in the modulus [512]: 2048 #长度设为2048(尽量大)% Generating 2048 bit RSA keys, keys will be non-exportable...[OK]#之后设置登录密码,方法与之前一样Hello(config)#line vty 0 4*3? 1 0:37:12.956:  %SSH-5-ENABLED: SSH 1.99 has been enabled Hello(config-line)#login localHello(config-line)#user Koala pass 123 pri 15 

设置完成后再在Laptop4终端输入 : ssh [username] [ip address] 进行连接

原创粉丝点击