于交换机和路由器的配置在教大家的时候要是用硬件是不可能的 没哪个条件今天带给大家的是我做个一个小的实验 大家可以下一个华为MA5200G模拟器进行实验 XG_Iq ,
具体的命令和解释我全写出来了希望和我一样菜的朋友和我一起做! _I}rQfPJ
."\&;:ZNv
首先给大家收集了一些交换机的基本命令具体命令解释我已经给出了 =*?2+ ;
通常命令: )XAD#GYM
PCA login: root ;使用root用户 t(F] -[
password: linux ;口令是linux 4*aNdh[t.
# shutdown -h now ;关机 @C fxPA
# init 0 ;关机 l\Or.I7n
# logout yNu%D$6u7
# login J>Uzd,
/
# ifconfig ;显示IP地址 *^5..0du
# ifconfig eth0 <ip address> netmask <netmask> ;设置IP地址 %Jc>joU
# ifconfig eht0 <ip address> netmask <netmask> down ; 删除IP地址 x#s=eeP1
# route add 0.0.0.0 gw <ip> Q8r 7
# route del 0.0.0.0 gw <ip> |xQq+e}l<
# route add default gw <ip> ;设置网关 M`kR2NCi
# route del default gw <ip> ;删除网关 ,"!P{c
# route ;显示网关 Q&Ox\*sMK
# ping <ip> *|DIG{
# telnet <ip> ;建议telnet之前先ping一下 :g[G&Ds8
--------------------------------------- 1*Ui=M4
交换机命令 >{]mN5
~~~~~~~~~~ l
TJqWSV=f
[Quidway]super password 修改特权用户密码 %<Q?|}
[Quidway]sysname 交换机命名 Bz#K_S
[Quidway]interface ethernet 0/1 进入接口视图 63?fn~0\
[Quidway]interface vlan x 进入接口视图 %7oB[2
[Quidway-Vlan-interfacex]ip address 10.65.1.1 255.255.0.0 $@blP<I
[Quidway]ip route-static 0.0.0.0 0.0.0.0 10.65.1.2 静态路由=网关 2o5v{W
C^x+'. ^N
[Quidway]user-interface vty 0 4 e!(0y)*
[S3026-ui-vty0-4]authentication-mode password fC4D#
[S3026-ui-vty0-4]set authentication-mode password simple 222 @|^2 +K/
[S3026-ui-vty0-4]user privilege level 3 \Ow-o0
bUp
,vc*
[Quidway-Ethernet0/1]duplex {half|full|auto} 配置端口双工工作状态 ?>p<!:E!r
[Quidway-Ethernet0/1]speed {10|100|auto} 配置端口工作速率 2W=(
{e)$
[Quidway-Ethernet0/1]flow-control 配置端口流控 6:Nz=sw8
[Quidway-Ethernet0/1]mdi {across|auto|normal} 配置端口MDI/MDIX状态平接或扭接 cn4CK.?
[Quidway-Ethernet0/1]port link-type {trunk|access|hybrid} 设置接口工作模式 G;%Pf9o26
[Quidway-Ethernet0/1]shutdown 关闭/重起接口 @Pc]qu
[Quidway-Ethernet0/2]quit 退出系统视图 )2P4EEs[
O}!L;?
[Quidway]vlan 3 创建/删除一个VLAN/进入VLAN模式 y'<juaw
[Quidway-vlan3]port ethernet 0/1 to ethernet 0/4 在当前VLAN增加/删除以太网接口 3=r8kh7,
[Quidway-Ethernet0/2]port access vlan 3 将当前接口加入到指定VLAN n_n0Q}du
[Quidway-Ethernet0/2]port trunk permit vlan {ID|All} 设trunk允许的VLAN aQEMCWxZ
[Quidway-Ethernet0/2]port trunk pvid vlan 3 设置trunk端口的PVID J0U9zI4
[Quidway]monitor-port <interface_type interface_num> 指定和清除镜像端口 +{j? +4(B
[Quidway]port mirror <interface_type interface_num> 指定和清除被镜像端口 [[P UK{P0
[Quidway]port mirror int_list observing-port int_type int_num 指定镜像和被镜像 Eqg(U0k0
d&p]O
[Quidway]description string 指定VLAN描述字符 aO]0|<2
j
[Quidway]description 删除VLAN描述字符 'sL>U$(
[Quidway]display vlan [vlan_id] 查看VLAN设置 a9q68
[z:bnS~yiD
[Quidway]stp {enable|disable} 开启/关闭生成树,默认关闭 $3!j1
[Quidway]stp priority 4096 设置交换机的优先级 ZL`G<Mo;.
[Quidway]stp root {primary|secondary} 设置交换机为根或根的备份 2b]'KiX
[Quidway-Ethernet0/1]stp cost 200 设置交换机端口的花费 q(Y<cJ?X
O]n"aAu@
[SwitchA-vlanx]isolate-user-vlan enable 设置主vlan o4b!U %
[SwitchA]Isolate-user-vlan <x> secondary <list> 设置主vlan包括的子vlan ogX'3L
[Quidway-Ethernet0/2]port hybrid pvid vlan <id> 设置vlan的pvid 4><b3r;T'
[Quidway-Ethernet0/2]port hybrid pvid 删除vlan的pvid X"W%(x`w
[Quidway-Ethernet0/2]port hybrid vlan vlan_id_list untagged 设置无标识的vlan PomX@N}1
如果包的vlan id与PVId一致,则去掉vlan信息. 默认PVID=1。 =$g8"[4
所以设置PVID为所属vlan id, 设置可以互通的vlan为untagged. 22|f!la8n
9_rNJLj8y
计算机的命令: pQxaT$
计算机命令 SrN;S kS
~~~~~~~~~~ Es kh=xA {
PCA login: root ;使用root用户 h@72eav3+
password: linux ;口令是linux G^F4c{3c~
# shutdown -h now ;关机 ,$habq=;
# init 0 ;关机 m%$z&<!
# logout ^b`}g
# login x, js}Mlw
# ifconfig ;显示IP地址 sa`7_KB
# ifconfig eth0 <ip address> netmask <netmask> ;设置IP地址 $.}fL;BzVz
# ifconfig eht0 <ip address> netmask <netmask> down ; 删除IP地址 l{4=La{?j
# route add 0.0.0.0 gw <ip> ^)b*"o
# route del 0.0.0.0 gw <ip> buRXzSR
# route add default gw <ip> ;设置网关 )Xa`LG=|
# route del default gw <ip> ;删除网关 /c`)Er6d
# route ;显示网关 <GShm~XD2
# ping <ip> j8@YoD5o
# telnet <ip> ;建议telnet之前先ping一下 DFs
J}`
$
uKqN
J!
>HT'M
下面是一个小的实验具体内容做了解释 )}?'1ciHI
^6 +P&MxM
一个交换机,一个计算机,双击交换机,进入终端配置: +b]g;
<Quidway>system 6:B[8otQ
password: :eI.E:/'
[Quidway]sysname S3026 ;交换机命名 vZC2F
[S3026]super password 111 ;设置特权密码 }Xs=x6Mj
[S3026]user-interface vty 0 4 /*进入虚拟终端接口配置模式*/ j?6%=KuX<
[S3026-ui-vty0-4]authentication-mode password /*这里我使用的是aaa的认证模式,可选用none 也就是不认证,和passowrd 密码认证这三种,推荐选择aaa 和 password */ !cLX1S
/*set auth pass cipher xxxxx 如果你选择的是password认证方式,则要设置一个密码*/ :>'^l?b'WX
/*user privilege level 3 设置telnet登录级别为3级,*/ /*这两步只要选用password时需要使用*/ K$Y!d"D
local-aaa-server H!&]Di1Eh
/*进行本地3a服务器视图*/ DT(A~U<y
[S3026-ui-vty0-4]set authentication-mode password simple 222 v|jBRKU99
[S3026-ui-vty0-4]user privilege level 3 e(BF=gesgp
[S3026-ui-vty0-4]quit {so"xoA^c
[S3026]quit @4h .?
<S3026>sys IBU(Hm1,
password:111 Tn/
3`j
{
[S3026]display currect-config /*显示当前配置*/ K3?7Hndf2
[S3026]dis curr /*显示当前配置*/ ReP7c3D>p
Qg?^%O'
[S3026]vlan 2 3bpbk
[S3026-vlan2]port ethernet0/2 )KR9al f3
[S3026-vlan2]port e0/4 to et0/6 在当前VLAN增加/删除以太网接口 <!&nyuSz
[S3026-vlan2]quit $dci?7q
[S3026]dis vlan K|Std)6
[S3026]int e0/3 HPpKti7g
[S3026-Ethernet1]port access vlan 2 将当前接口加入到指定VLAN !yH&l6s
[S3026-Ethernet1]quit @6ZQkX/
[S3026]dis vlan 查看VLAN设置 }Fyf?TZ$T
[S3026]dis curr }MrRsvN
8;.WX
[S3026]interface vlan 1 R3&W.?C
T
[S3026-Vlan-interface1]ip address 10.65.1.8 255.255.0.0 a`GoNh,
[S3026-Vlan-interface1]quit zp"sM
z]
[S3026]ip route-static 0.0.0.0 0.0.0.0 10.65.1.2 kwK<?\D
[S3026]ip default-gateway 10.65.1.2 %|o4 U0c
[S3026]dis curr ;04doub
[S3026]save sxl29y^*
UBi0
/
双击小电脑: +|Xx=1_?BK
login:root ]gkI:scPA
password:linux h5x FP
[root@PCA root]#ifconfig eth0 10.65.1.1 netmask 255.255.0.0 |>GtClL
[root@PCA root]#ifconfig 3Zdkf]Gh
[root@PCA root]#route add default gw 10.65.1.2 >va#PFHA
[root@PCA root]#route w^NE`4 -
[root@PCA root]#ping 10.65.1.8 `>'E4z]-_
[root@PCA root]#telnet 10.65.1.8