于交换机和路由器的配置在教大家的时候要是用硬件是不可能的 没哪个条件今天带给大家的是我做个一个小的实验 大家可以下一个华为MA5200G模拟器进行实验 JY4 +MApN
具体的命令和解释我全写出来了希望和我一样菜的朋友和我一起做! ?.,..p
o3qBRT0[R
首先给大家收集了一些交换机的基本命令具体命令解释我已经给出了 3{]csZvW
通常命令: zxT&K|
PCA login: root ;使用root用户 rcY[jF
password: linux ;口令是linux Xj.6A,}^
# shutdown -h now ;关机 HT[<~c
# init 0 ;关机 QUH USDT
# logout rB<
UOe
# login !%_}Rv!JT
# ifconfig ;显示IP地址 >#)^4-e
# ifconfig eth0 <ip address> netmask <netmask> ;设置IP地址 ZdY:I;)s
# ifconfig eht0 <ip address> netmask <netmask> down ; 删除IP地址 ")i4w{_y
# route add 0.0.0.0 gw <ip> |36d<b Io
# route del 0.0.0.0 gw <ip> rMdOE&5G
# route add default gw <ip> ;设置网关 &Plc
# route del default gw <ip> ;删除网关 Vyf r>pgW1
# route ;显示网关 ^R!
qxSj
# ping <ip> nulVQOj|
# telnet <ip> ;建议telnet之前先ping一下 oDrfzm|[Y
--------------------------------------- VK[^v;
交换机命令 %8DU}}Rj
~~~~~~~~~~ -V%"i,t
[Quidway]super password 修改特权用户密码 e)zE*9
[Quidway]sysname 交换机命名 L(fOe3
v
[Quidway]interface ethernet 0/1 进入接口视图 ;1'X_tp
[Quidway]interface vlan x 进入接口视图 ~*79rDs{
[Quidway-Vlan-interfacex]ip address 10.65.1.1 255.255.0.0 H"=%|/1M0
[Quidway]ip route-static 0.0.0.0 0.0.0.0 10.65.1.2 静态路由=网关 LkK%DY
)R(kXz=M
[Quidway]user-interface vty 0 4 8Mf6*G#Y
[S3026-ui-vty0-4]authentication-mode password +? E~F
[S3026-ui-vty0-4]set authentication-mode password simple 222 |k\4\aLj
[S3026-ui-vty0-4]user privilege level 3 O&RW[ml*3
!D!~4h)
[Quidway-Ethernet0/1]duplex {half|full|auto} 配置端口双工工作状态 |A0BYzlVc
[Quidway-Ethernet0/1]speed {10|100|auto} 配置端口工作速率 @@-n/9>vs
[Quidway-Ethernet0/1]flow-control 配置端口流控 G3
rTzMO
[Quidway-Ethernet0/1]mdi {across|auto|normal} 配置端口MDI/MDIX状态平接或扭接 V|gW%Z,j
[Quidway-Ethernet0/1]port link-type {trunk|access|hybrid} 设置接口工作模式 Ub2t7MU
[Quidway-Ethernet0/1]shutdown 关闭/重起接口 ~:'tp28?
[Quidway-Ethernet0/2]quit 退出系统视图 7/&i'y
a\pOgIp
[Quidway]vlan 3 创建/删除一个VLAN/进入VLAN模式
U*!q@g_
[Quidway-vlan3]port ethernet 0/1 to ethernet 0/4 在当前VLAN增加/删除以太网接口 9~n`6;R
[Quidway-Ethernet0/2]port access vlan 3 将当前接口加入到指定VLAN BKvX,[R2
[Quidway-Ethernet0/2]port trunk permit vlan {ID|All} 设trunk允许的VLAN 6<u=hhL
[Quidway-Ethernet0/2]port trunk pvid vlan 3 设置trunk端口的PVID Z$LWZg
[Quidway]monitor-port <interface_type interface_num> 指定和清除镜像端口 :tBIo7
[Quidway]port mirror <interface_type interface_num> 指定和清除被镜像端口 1LYz
X;H1
[Quidway]port mirror int_list observing-port int_type int_num 指定镜像和被镜像 RtO3!dGT.
>'ev_eAk
[Quidway]description string 指定VLAN描述字符 U6cpj
[Quidway]description 删除VLAN描述字符
U*(/eEtd-
[Quidway]display vlan [vlan_id] 查看VLAN设置 = >CADTU
js;p7wi
[Quidway]stp {enable|disable} 开启/关闭生成树,默认关闭 FjR/_GPo6
[Quidway]stp priority 4096 设置交换机的优先级 w"ZngrwBl
[Quidway]stp root {primary|secondary} 设置交换机为根或根的备份 #{K}o}
[Quidway-Ethernet0/1]stp cost 200 设置交换机端口的花费 ~tx|C3A`d
cq+G 0F+H
[SwitchA-vlanx]isolate-user-vlan enable 设置主vlan /S2lA>
[SwitchA]Isolate-user-vlan <x> secondary <list> 设置主vlan包括的子vlan K</EVt,U~
[Quidway-Ethernet0/2]port hybrid pvid vlan <id> 设置vlan的pvid W>TG!R 5
[Quidway-Ethernet0/2]port hybrid pvid 删除vlan的pvid @n2Dt d
[Quidway-Ethernet0/2]port hybrid vlan vlan_id_list untagged 设置无标识的vlan PL} Wu=
如果包的vlan id与PVId一致,则去掉vlan信息. 默认PVID=1。 f#mNx
所以设置PVID为所属vlan id, 设置可以互通的vlan为untagged. sjGy=d{:oL
bpP-wA^Hd
计算机的命令: ?#s9@R1
计算机命令 ncTPFv
H5
~~~~~~~~~~ !ZNirvk
PCA login: root ;使用root用户 ,Tp:. "
password: linux ;口令是linux t2x2_;a
# shutdown -h now ;关机 BOt1J_;(rO
# init 0 ;关机 CWT#1L=
# logout xmVW6 ,<?
# login {E=BFs
# ifconfig ;显示IP地址 w'[JfMu P
# ifconfig eth0 <ip address> netmask <netmask> ;设置IP地址 E' -lpE
# ifconfig eht0 <ip address> netmask <netmask> down ; 删除IP地址 `PY=B$?{4
# route add 0.0.0.0 gw <ip> OSoIH`tA
# route del 0.0.0.0 gw <ip> r&%TKm^/
# route add default gw <ip> ;设置网关 Ec/&?|$
# route del default gw <ip> ;删除网关 H4B|c42
# route ;显示网关 R?{f:,3R
# ping <ip> + Vv+<M
# telnet <ip> ;建议telnet之前先ping一下 =[JstiT?E
m^!Kthq
qu\cU(H|
下面是一个小的实验具体内容做了解释 >Nam@,hm
=kzuU1s
一个交换机,一个计算机,双击交换机,进入终端配置: IA%|OVAfF
<Quidway>system niA>afo
password: #| pn,/
[Quidway]sysname S3026 ;交换机命名 knfEbH
[S3026]super password 111 ;设置特权密码 7D(Eo{ue
[S3026]user-interface vty 0 4 /*进入虚拟终端接口配置模式*/ 6Y`rQ/F
[S3026-ui-vty0-4]authentication-mode password /*这里我使用的是aaa的认证模式,可选用none 也就是不认证,和passowrd 密码认证这三种,推荐选择aaa 和 password */ ~3&*>H^U
/*set auth pass cipher xxxxx 如果你选择的是password认证方式,则要设置一个密码*/ _C@A>]GT
/*user privilege level 3 设置telnet登录级别为3级,*/ /*这两步只要选用password时需要使用*/ XX7zm_>+
local-aaa-server ;
,Nvg6c
/*进行本地3a服务器视图*/ _-|/$ jZ
[S3026-ui-vty0-4]set authentication-mode password simple 222 %W}YtDf\
[S3026-ui-vty0-4]user privilege level 3 mzRH:HgN?
[S3026-ui-vty0-4]quit VUon>XQ
G
[S3026]quit ,ZI#p6
<S3026>sys Pm7lP5
password:111 S
awf]/
[S3026]display currect-config /*显示当前配置*/ `h%K8];<6f
[S3026]dis curr /*显示当前配置*/ ).)^\
2BKiA[
;;
[S3026]vlan 2 |(<A)C
[S3026-vlan2]port ethernet0/2 4|&_i)S-Y
[S3026-vlan2]port e0/4 to et0/6 在当前VLAN增加/删除以太网接口 B/*\Ih9y
[S3026-vlan2]quit ;V?3Hwl
[S3026]dis vlan ?[]jJ
[S3026]int e0/3 e'yw8U5E/
[S3026-Ethernet1]port access vlan 2 将当前接口加入到指定VLAN )3f<0C>
[S3026-Ethernet1]quit `_()|; !y
[S3026]dis vlan 查看VLAN设置 G#Kw6
[S3026]dis curr I5*<J n
eZ]>;5
[S3026]interface vlan 1 Yl&bv#[z
[S3026-Vlan-interface1]ip address 10.65.1.8 255.255.0.0 @Q7^caG
[S3026-Vlan-interface1]quit U3jnH
[S3026]ip route-static 0.0.0.0 0.0.0.0 10.65.1.2 xS4?M<|L63
[S3026]ip default-gateway 10.65.1.2 5)Z:J
[S3026]dis curr ZkWMo=vL
[S3026]save
[b+B"f6
O]Ey@7 &
双击小电脑: JXV#V7
login:root ev#/v:$?
password:linux
jM-7
[root@PCA root]#ifconfig eth0 10.65.1.1 netmask 255.255.0.0 @QMU$]&i]
[root@PCA root]#ifconfig 8=@f lK
[root@PCA root]#route add default gw 10.65.1.2 NFy V02.
[root@PCA root]#route NoMlTh(O
[root@PCA root]#ping 10.65.1.8 v.ow`MO=;
[root@PCA root]#telnet 10.65.1.8