于交换机和路由器的配置在教大家的时候要是用硬件是不可能的 没哪个条件今天带给大家的是我做个一个小的实验 大家可以下一个华为MA5200G模拟器进行实验 ]'pfw9"f~
具体的命令和解释我全写出来了希望和我一样菜的朋友和我一起做! LLgw1 @-D
No7-fX1B
首先给大家收集了一些交换机的基本命令具体命令解释我已经给出了 ;{I9S'
通常命令: @}q, ';H7
PCA login: root ;使用root用户 g@'XmT="_
password: linux ;口令是linux }`w(sec:3
# shutdown -h now ;关机 |m-N5$\IC
# init 0 ;关机 *y4g\#o.
# logout OL\-SQ&
# login A-r;5?S
# ifconfig ;显示IP地址 h ;uzbu
# ifconfig eth0 <ip address> netmask <netmask> ;设置IP地址 i431mpMa
# ifconfig eht0 <ip address> netmask <netmask> down ; 删除IP地址 T:Cq}4k<
# route add 0.0.0.0 gw <ip> &oG>Rqkm
# route del 0.0.0.0 gw <ip> G u`xJ
# route add default gw <ip> ;设置网关 X`g<"Ka
# route del default gw <ip> ;删除网关 (1CP]5W
# route ;显示网关 5~h)pt47
# ping <ip> kqeEm{I
# telnet <ip> ;建议telnet之前先ping一下 $s_k/dM~&
--------------------------------------- M]o]D;N~l
交换机命令 vl/!w2
~~~~~~~~~~ Cj>HMB}
[Quidway]super password 修改特权用户密码 Zz} o t
[Quidway]sysname 交换机命名 PY.HZ/#d
[Quidway]interface ethernet 0/1 进入接口视图 Kl. *Q
[Quidway]interface vlan x 进入接口视图 G
`|7NL
[Quidway-Vlan-interfacex]ip address 10.65.1.1 255.255.0.0 P.YT/
[Quidway]ip route-static 0.0.0.0 0.0.0.0 10.65.1.2 静态路由=网关 Z RjM^
d;
aA?Qr&]M
[Quidway]user-interface vty 0 4 zYaFbNi
[S3026-ui-vty0-4]authentication-mode password Qb^{`
[S3026-ui-vty0-4]set authentication-mode password simple 222 O]XRalkEM
[S3026-ui-vty0-4]user privilege level 3 sNx_9pJs4
h?TIxo:6/
[Quidway-Ethernet0/1]duplex {half|full|auto} 配置端口双工工作状态 807+|Ol[
[Quidway-Ethernet0/1]speed {10|100|auto} 配置端口工作速率 I q|'#hs
[Quidway-Ethernet0/1]flow-control 配置端口流控 '_?Z{|
[Quidway-Ethernet0/1]mdi {across|auto|normal} 配置端口MDI/MDIX状态平接或扭接 Kii@Z5R_?
[Quidway-Ethernet0/1]port link-type {trunk|access|hybrid} 设置接口工作模式 +j: &_
[Quidway-Ethernet0/1]shutdown 关闭/重起接口 8~T}BC
[Quidway-Ethernet0/2]quit 退出系统视图 vEx'~_+a9
`RY}g;
[Quidway]vlan 3 创建/删除一个VLAN/进入VLAN模式 DQ0S]:tC
[Quidway-vlan3]port ethernet 0/1 to ethernet 0/4 在当前VLAN增加/删除以太网接口 ZW?h\0Hh
[Quidway-Ethernet0/2]port access vlan 3 将当前接口加入到指定VLAN -9LvAV>
[Quidway-Ethernet0/2]port trunk permit vlan {ID|All} 设trunk允许的VLAN #bt z94/~O
[Quidway-Ethernet0/2]port trunk pvid vlan 3 设置trunk端口的PVID /5E0'y,|P
[Quidway]monitor-port <interface_type interface_num> 指定和清除镜像端口 _7N?R0j^9N
[Quidway]port mirror <interface_type interface_num> 指定和清除被镜像端口 {U-z(0
[Quidway]port mirror int_list observing-port int_type int_num 指定镜像和被镜像 UovN"8W+
{EZR}N
[Quidway]description string 指定VLAN描述字符 +\+j/sa
[Quidway]description 删除VLAN描述字符 6OE
xAn8
[Quidway]display vlan [vlan_id] 查看VLAN设置 CY?J$sN
EC\@$Fg
[Quidway]stp {enable|disable} 开启/关闭生成树,默认关闭 D<v<
:
[Quidway]stp priority 4096 设置交换机的优先级 :'r*
5EX
[Quidway]stp root {primary|secondary} 设置交换机为根或根的备份 |gV~U~A]
[Quidway-Ethernet0/1]stp cost 200 设置交换机端口的花费 L/fXP@u
;*rGZ?%*
[SwitchA-vlanx]isolate-user-vlan enable 设置主vlan i3XtrP""
[SwitchA]Isolate-user-vlan <x> secondary <list> 设置主vlan包括的子vlan 0-PT%R
[Quidway-Ethernet0/2]port hybrid pvid vlan <id> 设置vlan的pvid q2#Ebw%]
[Quidway-Ethernet0/2]port hybrid pvid 删除vlan的pvid %rB,Gl:)g
[Quidway-Ethernet0/2]port hybrid vlan vlan_id_list untagged 设置无标识的vlan JA{kifu0+
如果包的vlan id与PVId一致,则去掉vlan信息. 默认PVID=1。 1!1,{\9%
所以设置PVID为所属vlan id, 设置可以互通的vlan为untagged. pOK=o$1V8
;ZB=@@l(
计算机的命令: 6Zpa[,gm
计算机命令 ot7f?tF2<J
~~~~~~~~~~ to13&#o
PCA login: root ;使用root用户 !9gpuS[
password: linux ;口令是linux D*@'%<?
# shutdown -h now ;关机 %x#S?GMV<
# init 0 ;关机 SkV pZh
# logout O4`.ohAZ
# login Zs^zD;zU
# ifconfig ;显示IP地址 Q=!QCDO(
# ifconfig eth0 <ip address> netmask <netmask> ;设置IP地址 ]|F`;} 7
# ifconfig eht0 <ip address> netmask <netmask> down ; 删除IP地址 Eet/l]e#a
# route add 0.0.0.0 gw <ip> @mw1__?
# route del 0.0.0.0 gw <ip> n%h009-5
# route add default gw <ip> ;设置网关 z~ Zm1tZs
# route del default gw <ip> ;删除网关 |j"C52Q
# route ;显示网关 $Ud9v 4
# ping <ip> ]pNM~,
# telnet <ip> ;建议telnet之前先ping一下 oBmv^=cH
mmwc'-jU:
&H+ wzx<
下面是一个小的实验具体内容做了解释 o?O ZsA
lLVD`)
一个交换机,一个计算机,双击交换机,进入终端配置: R)d_0Ng
<Quidway>system 3B[tbU(
password: 4qDa:D"5
[Quidway]sysname S3026 ;交换机命名 g&RhPrtl
[S3026]super password 111 ;设置特权密码 `Zp*?
[S3026]user-interface vty 0 4 /*进入虚拟终端接口配置模式*/ $
^)g,
[S3026-ui-vty0-4]authentication-mode password /*这里我使用的是aaa的认证模式,可选用none 也就是不认证,和passowrd 密码认证这三种,推荐选择aaa 和 password */ 0Runex[
/*set auth pass cipher xxxxx 如果你选择的是password认证方式,则要设置一个密码*/ atZNX1LD[/
/*user privilege level 3 设置telnet登录级别为3级,*/ /*这两步只要选用password时需要使用*/ "o%okN
local-aaa-server no\G
>#
/*进行本地3a服务器视图*/ qKXg'1#E)
[S3026-ui-vty0-4]set authentication-mode password simple 222 1grcCL
q
[S3026-ui-vty0-4]user privilege level 3 Y".?j5f?
[S3026-ui-vty0-4]quit
Mb_"M7
[S3026]quit %Lx#7bR U
<S3026>sys 1$))@K-I
password:111 H1~9f{
[S3026]display currect-config /*显示当前配置*/ DB"z93Mr<K
[S3026]dis curr /*显示当前配置*/ Z3zD4-p$_
LP7jCt
[S3026]vlan 2 ZLaht(`+
[S3026-vlan2]port ethernet0/2 `?&C5*P
[S3026-vlan2]port e0/4 to et0/6 在当前VLAN增加/删除以太网接口 hJFxT8B/
[S3026-vlan2]quit "pX|?ap
[S3026]dis vlan 0dx%b677d
[S3026]int e0/3 Ku6ndc
[S3026-Ethernet1]port access vlan 2 将当前接口加入到指定VLAN `-s]dq
[S3026-Ethernet1]quit }K.)yv n
[S3026]dis vlan 查看VLAN设置 4J9Y
[S3026]dis curr >]Mhkf/=)
Ye^#]%m
[S3026]interface vlan 1 Yh,,(V6
[S3026-Vlan-interface1]ip address 10.65.1.8 255.255.0.0 aEUEy:.
[S3026-Vlan-interface1]quit heES
[
[S3026]ip route-static 0.0.0.0 0.0.0.0 10.65.1.2 =J-&usX
[S3026]ip default-gateway 10.65.1.2 abVEi[nP
[S3026]dis curr /.mx\_$
[S3026]save abe5 As r
ME*zMLoF+
双击小电脑: cor!S a>
login:root 2e,cE6r
password:linux |em_l$oGc
[root@PCA root]#ifconfig eth0 10.65.1.1 netmask 255.255.0.0 BN`tiPNEp
[root@PCA root]#ifconfig Nc EPPl0I
[root@PCA root]#route add default gw 10.65.1.2 zcV~)go6
[root@PCA root]#route 7Or?$
[root@PCA root]#ping 10.65.1.8 3cqc<
[root@PCA root]#telnet 10.65.1.8