于交换机和路由器的配置在教大家的时候要是用硬件是不可能的 没哪个条件今天带给大家的是我做个一个小的实验 大家可以下一个华为MA5200G模拟器进行实验 B*3_m
_a
具体的命令和解释我全写出来了希望和我一样菜的朋友和我一起做! ZVJ6 {DS/
RrrlfF ms
首先给大家收集了一些交换机的基本命令具体命令解释我已经给出了 0Bp0ScE|FA
通常命令: g#l!b%$
PCA login: root ;使用root用户 YqXN|&
password: linux ;口令是linux CE
# shutdown -h now ;关机 u81F^72U
# init 0 ;关机 -L2 +4
# logout +/%4E %
# login :N^B54o%6
# ifconfig ;显示IP地址 5>CeFy
# ifconfig eth0 <ip address> netmask <netmask> ;设置IP地址 s nxwe
# ifconfig eht0 <ip address> netmask <netmask> down ; 删除IP地址 h82y9($cZ
# route add 0.0.0.0 gw <ip> XPq`;<G
# route del 0.0.0.0 gw <ip> 2uY:p=DxG9
# route add default gw <ip> ;设置网关 ak3WER|f#
# route del default gw <ip> ;删除网关 bT9:9LP
# route ;显示网关 wRwx((eb
# ping <ip> @q]!C5
# telnet <ip> ;建议telnet之前先ping一下 gMq;
--------------------------------------- ^tm2Duv
交换机命令 C'l\4ij)7
~~~~~~~~~~ ~
W8
M3(^
[Quidway]super password 修改特权用户密码 *"F*6+}w"
[Quidway]sysname 交换机命名 X3gYe-2
[Quidway]interface ethernet 0/1 进入接口视图 _h=h43'3
[Quidway]interface vlan x 进入接口视图 Gb Mu;CA
[Quidway-Vlan-interfacex]ip address 10.65.1.1 255.255.0.0 o!y<:CGL
[Quidway]ip route-static 0.0.0.0 0.0.0.0 10.65.1.2 静态路由=网关 u|EJ)dT?
U'5p;j)_
[Quidway]user-interface vty 0 4 z=jzr=lP
[S3026-ui-vty0-4]authentication-mode password e*Nm[*@UW
[S3026-ui-vty0-4]set authentication-mode password simple 222 UQ^
)t
]
[S3026-ui-vty0-4]user privilege level 3 HQ4WunH2Y
rvnm*e,
[Quidway-Ethernet0/1]duplex {half|full|auto} 配置端口双工工作状态 {"|GV~
[Quidway-Ethernet0/1]speed {10|100|auto} 配置端口工作速率 5y0LkuRR:
[Quidway-Ethernet0/1]flow-control 配置端口流控 T_)+l)
[Quidway-Ethernet0/1]mdi {across|auto|normal} 配置端口MDI/MDIX状态平接或扭接 r`u 9MJ*
[Quidway-Ethernet0/1]port link-type {trunk|access|hybrid} 设置接口工作模式 !
c~3 `7v
[Quidway-Ethernet0/1]shutdown 关闭/重起接口 Z,XivU&
[Quidway-Ethernet0/2]quit 退出系统视图 FEa%wS{
Mwj7*pxUh
[Quidway]vlan 3 创建/删除一个VLAN/进入VLAN模式 cx)x="c
[Quidway-vlan3]port ethernet 0/1 to ethernet 0/4 在当前VLAN增加/删除以太网接口 J[K>)@I/
[Quidway-Ethernet0/2]port access vlan 3 将当前接口加入到指定VLAN #LwDs,J :
[Quidway-Ethernet0/2]port trunk permit vlan {ID|All} 设trunk允许的VLAN &w%%^ +n
|
[Quidway-Ethernet0/2]port trunk pvid vlan 3 设置trunk端口的PVID Pm24;'
[Quidway]monitor-port <interface_type interface_num> 指定和清除镜像端口 J(XK%e[8
[Quidway]port mirror <interface_type interface_num> 指定和清除被镜像端口 nu|odP
[Quidway]port mirror int_list observing-port int_type int_num 指定镜像和被镜像 b%X}{/ n
}_Sgor83n
[Quidway]description string 指定VLAN描述字符 i~HS"n
[Quidway]description 删除VLAN描述字符 m Ub2U&6(
[Quidway]display vlan [vlan_id] 查看VLAN设置 [vdC $9z,
=E~SaT
[Quidway]stp {enable|disable} 开启/关闭生成树,默认关闭 D{[i_K
[Quidway]stp priority 4096 设置交换机的优先级 Pc~)4>X<
[Quidway]stp root {primary|secondary} 设置交换机为根或根的备份 cetlr
[Quidway-Ethernet0/1]stp cost 200 设置交换机端口的花费 JvW!w)$pY
,Qe`(vU*s
[SwitchA-vlanx]isolate-user-vlan enable 设置主vlan :KRe==/
[SwitchA]Isolate-user-vlan <x> secondary <list> 设置主vlan包括的子vlan 63i&e/pv
[Quidway-Ethernet0/2]port hybrid pvid vlan <id> 设置vlan的pvid 9B3}LVg\
[Quidway-Ethernet0/2]port hybrid pvid 删除vlan的pvid *(*XNd||
[Quidway-Ethernet0/2]port hybrid vlan vlan_id_list untagged 设置无标识的vlan .8|5;!`WB
如果包的vlan id与PVId一致,则去掉vlan信息. 默认PVID=1。 FEA/}*2F
所以设置PVID为所属vlan id, 设置可以互通的vlan为untagged. <@@@Pl!~
+w@/$datI
计算机的命令: .M\0+,%/
计算机命令 *OKve
~~~~~~~~~~ =&U7:u
PCA login: root ;使用root用户 N9f;X{
password: linux ;口令是linux Ahg6>7+R.
# shutdown -h now ;关机 kRz qgVr%
# init 0 ;关机 P'Jb')m
# logout .7#04_aP
# login UZc{ Av
# ifconfig ;显示IP地址 0j'k%R[l
# ifconfig eth0 <ip address> netmask <netmask> ;设置IP地址 N_.`5I;e
# ifconfig eht0 <ip address> netmask <netmask> down ; 删除IP地址 (W`=`]!
# route add 0.0.0.0 gw <ip> a4!6K
# route del 0.0.0.0 gw <ip> -32.g\]
# route add default gw <ip> ;设置网关 +G!;:o
# route del default gw <ip> ;删除网关 A)^A2xZQ
# route ;显示网关 ?[O Sy.6
# ping <ip> l{\@+m
# telnet <ip> ;建议telnet之前先ping一下 n8e}8.Bu
3Q+THg3~?
gJZ9XLPC
下面是一个小的实验具体内容做了解释 l)1ySX&BU
Nx(y_.I{K
一个交换机,一个计算机,双击交换机,进入终端配置: f^XfI H_#
<Quidway>system !r0 z3^*N
password: /lvH p
[Quidway]sysname S3026 ;交换机命名 UC9w T
[S3026]super password 111 ;设置特权密码 HR k^KB
[S3026]user-interface vty 0 4 /*进入虚拟终端接口配置模式*/ /#?i +z
[S3026-ui-vty0-4]authentication-mode password /*这里我使用的是aaa的认证模式,可选用none 也就是不认证,和passowrd 密码认证这三种,推荐选择aaa 和 password */ \V<deMb=
/*set auth pass cipher xxxxx 如果你选择的是password认证方式,则要设置一个密码*/ NslaG
/*user privilege level 3 设置telnet登录级别为3级,*/ /*这两步只要选用password时需要使用*/ v*e=oyx[
local-aaa-server LZ~$=<
/*进行本地3a服务器视图*/ &$NVEmW-J
[S3026-ui-vty0-4]set authentication-mode password simple 222 Yr+ghl/ V
[S3026-ui-vty0-4]user privilege level 3 +wr
5&
[S3026-ui-vty0-4]quit 9D mQ
[S3026]quit RFm9dHI27
<S3026>sys D#&N?<}
password:111 gLv";"4S
[S3026]display currect-config /*显示当前配置*/ .J|"bs9
[S3026]dis curr /*显示当前配置*/ ^`!EpO>k9
o"A%dC_
[S3026]vlan 2 nF|m*_DW
[S3026-vlan2]port ethernet0/2 <0)@Ikhx
[S3026-vlan2]port e0/4 to et0/6 在当前VLAN增加/删除以太网接口 uI[lrMQYa
[S3026-vlan2]quit IqONDdep9
[S3026]dis vlan P!2[#TL0
[S3026]int e0/3 ,t>/_pI+=
[S3026-Ethernet1]port access vlan 2 将当前接口加入到指定VLAN $yg}HS7HC
[S3026-Ethernet1]quit !7[Rhk7bW
[S3026]dis vlan 查看VLAN设置 dCMWv~>
[S3026]dis curr ~4~>;e
kv3jbSKCT
[S3026]interface vlan 1 axi%5:I
[S3026-Vlan-interface1]ip address 10.65.1.8 255.255.0.0 }+f@$L
[S3026-Vlan-interface1]quit re}P
[S3026]ip route-static 0.0.0.0 0.0.0.0 10.65.1.2 G;pxB,4s5
[S3026]ip default-gateway 10.65.1.2 $X;fz)u
[S3026]dis curr X<"W@
[S3026]save %7rWebd-
o%A@
OY
双击小电脑: ;H8A"$%n~
login:root Ow]c,F}^
password:linux e c`3Qw
[root@PCA root]#ifconfig eth0 10.65.1.1 netmask 255.255.0.0 G@QZmuj&KH
[root@PCA root]#ifconfig |+i?FYA\
[root@PCA root]#route add default gw 10.65.1.2 @7';bfsix
[root@PCA root]#route R|AGN*.
[root@PCA root]#ping 10.65.1.8 O ijG@bI8
[root@PCA root]#telnet 10.65.1.8