局域网 思科 pt

![[Pasted image 20240909162940.png]]

第二节课 #

enable
conf t
hostname xxx

配置线连 PC 连 RS 232 连 交换机Console 直通线

第三节课 #

en         #进入特权模式
conf t     #进入配置模式
enable password xxx   # 在配置模式下设置进入特权模式的密码xxx
show run              # 查看运行过的命令
no xxx xxx            # 取消某一条命令或者配置
no en pa              # 取消密码

vlan 配置 #

配置模式

int vlan 1                                   # 进入vlan 1 接口(vlan 是虚拟接口)
ip address 192.168.1.1 255.255.255.0         # 设置ip地址
no shutdown                                  # 打开接口

远程登录,进入配置模式

line vty 0 4
password 123     # 设置密码
login            # 开启
end              # 推出

pc 打开终端

telnet 192.168.1.1

第四节课 #

ssh配置

# 用户名ljyh,密码123
username ljyh passowrd 123
# 此处可能提示Please define a hostname other than Switch.
# 使用 hostname xxx 改名字即可
ip domain-name sj2301.com   
crypto key generate rsa # 直接回车或者输入1024

-----------------

R2(config)#ip domain-name man.com   //配置域名为man.com
R2(config)#crypto key generate rsa   //生成加密密钥
R2(config)#username man secret cisco   //在本地创建一个用户名为man并且加密密码为cisco的用户。
R2(config-line)#transport input ssh      //启用SSH登陆
R2(config-line)#login local                  //采用本地验证

vlan 配置

Switch>en
Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#vlan 2
Switch(config-vlan)#exit
Switch(config)#vlan 3
Switch(config-vlan)#exit
Switch(config)#int fa 0/1
Switch(config-if)#sw ac vlan 2
Switch(config-if)#exit
Switch(config)#int fa 0/2
Switch(config-if)#sw ac vlan 3
Switch(config-if)#exit
Switch(config)#int fa 0/24
Switch(config-if)#sw mode trunk
Switch(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/24, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/24, changed state to up

Switch(config-if)#exit
Switch(config)#end
Switch#

第四节课 #

端口聚合

  1. 多端口选择
int range fa0/5-6
  1. 启用端口聚合
Switch(config-if-range)#channel-group 1 mode on
  1. 设置为trunk
sw mo t
  1. 设置均衡负载

有dst-ip和dst-mac,一般用mac 地址

Switch(config)#port-channel load-balance dst-mac

第五节课 #

  1. 连线,ip设置

![[Pasted image 20241014143109.png]] 2. 二层交换机,设置vlan


//创建vlan
vlan 10
e
vlan 20
e
//进入配置 0/1
int fa 0/1
sw ac vlan 10
e

//进入配置 0/2

int fa 0/2
sw ac vlan 20
e

int fa 0/24
sw m t
  1. 三层,步骤先同上,但是没有int fa 0/24 sw m t

然后,设置ip 地址

int vlan 10
ip ad 192.168.1.1 255.255.255.0
e

int vlan 20 
ip ad 192.168.2.1 255.255.255.0
e


//这一步好像叫转发
ip routing

记得给对应的pc 设置默认网关。

生成树协议 #

  1. 先画一个换线的拓扑结构

![[Pasted image 20241014144055.png]] 知识点

  • 根网桥
  • 根端口
  • 指定端口
  • 阻塞端口

路由器 #

  1. 弄个路由器出来,先断电,没亮就行
  2. 然后拖动下面这个模块到上面去。

![[Pasted image 20241014145120.png]]

![[Pasted image 20241014145209.png]] 基本的

en
conf t
hostname xxx01
  1. pc ip地址设置以及网关

![[Pasted image 20241014161444.png]]

  1. 交换机 vlan 划分
vlan 10
e

int fa 0/1
sw m ac
sw ac vlan 10
e

vlan 20  vlan 30 ....
....


int fa 0/24
sw m t

end
  1. 路由器

记得开启

![[Pasted image 20241014161345.png]]

int fa0/0.1

encapsulation dot1Q 10
ip ad 192.168.1.1 255.255.255.0


int fa0/0.2

encapsulation dot1Q 20
ip ad 192.168.2.1 255.255.255.0

int fa0/0.3

encapsulation dot1Q 30
ip ad 192.168.3.1 255.255.255.0

要添加就继续cv即可
....


end
  • 静态路由

此处我没听课,只听了一点点

![[Pasted image 20241014165523.png]]

![[Pasted image 20241014165542.png]]

先断电,然后用HWIC-2T 这个模块,拖上去,开电,反复。然后使用自动配置线,就有这个闪电的这个线了。

ip route [目标网络] [子网掩码] [下一跳的IP地址]
  • 动态路由

没听