于交换机和路由器的配置在教大家的时候要是用硬件是不可能的 没哪个条件今天带给大家的是我做个一个小的实验 大家可以下一个华为MA5200G模拟器进行实验 JOBhx)E
具体的命令和解释我全写出来了希望和我一样菜的朋友和我一起做! '@P^0+B!(.
y1L,0 ]
首先给大家收集了一些交换机的基本命令具体命令解释我已经给出了 }\k"n{!"
通常命令: A\5L
7
PCA login: root ;使用root用户 C$)onk
password: linux ;口令是linux l%i+cO D
# shutdown -h now ;关机 x'R`.
!g3
# init 0 ;关机 \Y}8S/]
# logout mpJ#:}n
# login x]ot 2
# ifconfig ;显示IP地址 &b& ,
# ifconfig eth0 <ip address> netmask <netmask> ;设置IP地址 "" ZQ/t\
# ifconfig eht0 <ip address> netmask <netmask> down ; 删除IP地址 Aq7osU1B
# route add 0.0.0.0 gw <ip> @7n"yp*"
# route del 0.0.0.0 gw <ip> 0_t!T'jr7
# route add default gw <ip> ;设置网关 b>JDH1)
# route del default gw <ip> ;删除网关 qJUK_6|3
# route ;显示网关 y:l\$pGC%
# ping <ip> {.mngRQF
# telnet <ip> ;建议telnet之前先ping一下 $ L]lHji
--------------------------------------- K@hw.Xq"
交换机命令 u\JNr}bL
~~~~~~~~~~ Nda *L|
[Quidway]super password 修改特权用户密码 _zMW=nypdx
[Quidway]sysname 交换机命名 xKp4*[}m
[Quidway]interface ethernet 0/1 进入接口视图 =_u4=4
[Quidway]interface vlan x 进入接口视图 3=ymm^
[Quidway-Vlan-interfacex]ip address 10.65.1.1 255.255.0.0 VY\&8n}e(
[Quidway]ip route-static 0.0.0.0 0.0.0.0 10.65.1.2 静态路由=网关 SasJic2M
R{T$[$6S
[Quidway]user-interface vty 0 4 Xla~Yg
[S3026-ui-vty0-4]authentication-mode password *CHX
[S3026-ui-vty0-4]set authentication-mode password simple 222 5/Uy{Xt
[S3026-ui-vty0-4]user privilege level 3 lnR{jtWP
P7~ >mm+
[Quidway-Ethernet0/1]duplex {half|full|auto} 配置端口双工工作状态 kMd.h[X~
[Quidway-Ethernet0/1]speed {10|100|auto} 配置端口工作速率 k$^`{6l
[Quidway-Ethernet0/1]flow-control 配置端口流控 `PH{syz
[Quidway-Ethernet0/1]mdi {across|auto|normal} 配置端口MDI/MDIX状态平接或扭接 VW4r{&rS
[Quidway-Ethernet0/1]port link-type {trunk|access|hybrid} 设置接口工作模式 icK/],
[Quidway-Ethernet0/1]shutdown 关闭/重起接口 u;c?d!E
[Quidway-Ethernet0/2]quit 退出系统视图 J-hbh
M =r)I~
[Quidway]vlan 3 创建/删除一个VLAN/进入VLAN模式 c!9nnTap
[Quidway-vlan3]port ethernet 0/1 to ethernet 0/4 在当前VLAN增加/删除以太网接口 +srGN5!
[Quidway-Ethernet0/2]port access vlan 3 将当前接口加入到指定VLAN L;I]OC^J
[Quidway-Ethernet0/2]port trunk permit vlan {ID|All} 设trunk允许的VLAN IO-Ow!
[Quidway-Ethernet0/2]port trunk pvid vlan 3 设置trunk端口的PVID [ibu/W$
[Quidway]monitor-port <interface_type interface_num> 指定和清除镜像端口 ~$?ZK]YOrx
[Quidway]port mirror <interface_type interface_num> 指定和清除被镜像端口 wAW5
Z0D
[Quidway]port mirror int_list observing-port int_type int_num 指定镜像和被镜像 ?5
7Sk+
%bfQ$a:
[Quidway]description string 指定VLAN描述字符 D d</`iUq
[Quidway]description 删除VLAN描述字符 '."ed%=MC
[Quidway]display vlan [vlan_id] 查看VLAN设置 3$9W%3
HA>OkA/
[Quidway]stp {enable|disable} 开启/关闭生成树,默认关闭 n7-6-
#
[Quidway]stp priority 4096 设置交换机的优先级 <e</m)j
[Quidway]stp root {primary|secondary} 设置交换机为根或根的备份 y
h9*z3
[Quidway-Ethernet0/1]stp cost 200 设置交换机端口的花费 9qG6Pb
BF{Y"8u$
[SwitchA-vlanx]isolate-user-vlan enable 设置主vlan b1?'gn~
[SwitchA]Isolate-user-vlan <x> secondary <list> 设置主vlan包括的子vlan S|`o]?nc>
[Quidway-Ethernet0/2]port hybrid pvid vlan <id> 设置vlan的pvid dlTt_.
[Quidway-Ethernet0/2]port hybrid pvid 删除vlan的pvid ) hfpwdQ
[Quidway-Ethernet0/2]port hybrid vlan vlan_id_list untagged 设置无标识的vlan u4h4.NHX
如果包的vlan id与PVId一致,则去掉vlan信息. 默认PVID=1。 <W $mj04@
所以设置PVID为所属vlan id, 设置可以互通的vlan为untagged. Z?m3~L9L2
`+Q%oj#FF
计算机的命令: ]GQG~H^
计算机命令 Q$@I"V&G.
~~~~~~~~~~ 9zy!Fq
PCA login: root ;使用root用户 rh}J3S5vp
password: linux ;口令是linux gSQJJxZ{?
# shutdown -h now ;关机 ikiypWq
# init 0 ;关机 >V}#[ /n
# logout V33T+P~j
# login :G%61x&=Zc
# ifconfig ;显示IP地址 wDe& 1(T^
# ifconfig eth0 <ip address> netmask <netmask> ;设置IP地址 z ~/` 1
# ifconfig eht0 <ip address> netmask <netmask> down ; 删除IP地址 B,epzI
# route add 0.0.0.0 gw <ip> ut7zVp<"
# route del 0.0.0.0 gw <ip> 7%eK37@u
# route add default gw <ip> ;设置网关 x+@rg];m
# route del default gw <ip> ;删除网关 @t_=Yl2;
# route ;显示网关 'AH0ww_)n
# ping <ip> DN5 7p!z
# telnet <ip> ;建议telnet之前先ping一下 o:Sa,
!DK
Z@PmM4F@S
+!.^zp21
下面是一个小的实验具体内容做了解释 wEvVL
?+}_1x`
一个交换机,一个计算机,双击交换机,进入终端配置: 'AS|ZRr/
<Quidway>system ,wAF:7'
password: :^B1~p(?sK
[Quidway]sysname S3026 ;交换机命名 O[JL+g4
[S3026]super password 111 ;设置特权密码 6G""I]uT
[S3026]user-interface vty 0 4 /*进入虚拟终端接口配置模式*/ o]I\6,T/|
[S3026-ui-vty0-4]authentication-mode password /*这里我使用的是aaa的认证模式,可选用none 也就是不认证,和passowrd 密码认证这三种,推荐选择aaa 和 password */ %/ #NK1&M
/*set auth pass cipher xxxxx 如果你选择的是password认证方式,则要设置一个密码*/ {[?(9u7R
/*user privilege level 3 设置telnet登录级别为3级,*/ /*这两步只要选用password时需要使用*/ 1NA.nw.
local-aaa-server J]pir4&j
/*进行本地3a服务器视图*/ ZRU{[4
[S3026-ui-vty0-4]set authentication-mode password simple 222 i6Emhji
[S3026-ui-vty0-4]user privilege level 3 CdjI`
[S3026-ui-vty0-4]quit &Ys<@M7E:
[S3026]quit C1 GKLl~
<S3026>sys JYbL?N
password:111 Vb]=B~ ^`
[S3026]display currect-config /*显示当前配置*/ x)O!["'"
[S3026]dis curr /*显示当前配置*/ %2V? ,zY@
K^<BW(s
[S3026]vlan 2 +*/Zu`kzX
[S3026-vlan2]port ethernet0/2 z/@slT
[S3026-vlan2]port e0/4 to et0/6 在当前VLAN增加/删除以太网接口 UJ')I`zuI
[S3026-vlan2]quit A@{PZ
[S3026]dis vlan PP33i@G
[S3026]int e0/3 @YTaSz$L
[S3026-Ethernet1]port access vlan 2 将当前接口加入到指定VLAN 9 X`Sm}i
[S3026-Ethernet1]quit fN1-d&T
[S3026]dis vlan 查看VLAN设置 SbrecZ
[S3026]dis curr )W
_v:?A9
x\G'kEd
[S3026]interface vlan 1 o9yJf#-En
[S3026-Vlan-interface1]ip address 10.65.1.8 255.255.0.0 dn$!&
[S3026-Vlan-interface1]quit z/2//mM
[S3026]ip route-static 0.0.0.0 0.0.0.0 10.65.1.2 A0 C,tVd
[S3026]ip default-gateway 10.65.1.2 3eAX.z`D
[S3026]dis curr >$/>#e~
[S3026]save mLLDE;7|}
9gK`E
双击小电脑: M\Ye<Tk
login:root scz&h#0V
password:linux -3Z,EaG^
[root@PCA root]#ifconfig eth0 10.65.1.1 netmask 255.255.0.0 O23k:=Av
[root@PCA root]#ifconfig =wV<hg)C
[root@PCA root]#route add default gw 10.65.1.2 m'=Crei
[root@PCA root]#route e)?
.r9pA;
[root@PCA root]#ping 10.65.1.8 =|y9UlsD
[root@PCA root]#telnet 10.65.1.8