2011.08.30


今天陈老师第一次给我们第一次上课,给我们点了下我们的欠缺,字打得太慢,工具不会使用等等的一大堆问题。所以我们是很有必要提高的。在这样下去就成文盲啦。。

Eclipse的使用:

             工作空间(workspace)、工程(project)

             在eclipseJava程序的编写和运行,及java运行环境的配置。

快捷键的配置,常用快捷键:

内容提示:Alt + /         

快速修复:Ctrl + 1

导包:Ctrl + shift + O

格式化代码块:ctrl + shift + F

向前向后:Alt + 方向键

添加注释 Ctrl+Shift+/

除去注释 Ctrl+Shift+\

程序的调试和运行

F5(跳入)  F6(跳过)   F7(跳出)

这些知识能够在我们平时的作业当总提高我们的打字速度。节省我们的时间来让我们能够干更多的事情。

下面是我们的郭老师讲的一些内容:

流的分类:

• 按数据流动方向

– 输入流:只能从中读取字节数据,而不能向其写出数据

– 输出流:只能向其写入字节数据,而不能从中读取数据

• 按照流所处理的数据类型

– 字节流:用于处理字节数据。

– 字符流:用于处理Unicode字符数据

• 按照流所处理的源

– 节点流:从/向一个特定的IO设备读/写数据的流

– 处理流:对已存在的流进行连接和封装的流

过滤流

抽象的InputStreamOutputStream类允许我们对字串及数字进行读写。为达到这个目的,还需要功能更多的子类。例如:DateInputStreamDataOutputStream允许我们对所有基本的java类型进行读写。

    文件流类与抽象的InputStreamOutputStream类相似,这些类也只支持字节级的读写操作。换言之,只能从fin对象中读取字符和字节数组。byte b=fin.read(),他们没有提供专门的数值类型,所以DataInputStream没有办法从一个文件中获取数字。

解决方案:java给流职责分工,某些流(FileInputStream)负责从文件或另一些更特殊的地方读入字节数据。而另一些流

DataInputStreamPrintWriter)负责将字节“组装”成更有用的数据类型。必须综合运用这两种流,将其合并成所谓的"过滤流(FilteredStreams",方法是将一个现成的流传递给另一个流的构建器

   下面是数据流的一些例子:

import java.io.*;

public class T1 {

public static void main(String[] args) {

String[] name = {"Tom","Jack","Mary"};

double[] salary = {300, 400, 1200}; 

try{

FileOutputStream fos = new FileOutputStream("res/salary.txt");

DataOutputStream dos = new DataOutputStream(fos);

for(int i=0; i<name.length; i++){

dos.writeUTF(name[i]);

dos.writeDouble(salary[i]);

}

dos.close();

fos.close();

///////////////////////

FileInputStream fin = new FileInputStream("res/salary.txt");

DataInputStream dis = new DataInputStream(fin);

for(int i=0; i<name.length; i++){

String n = dis.readUTF();

double s = dis.readDouble();

System.out.println(n + " : " + s);

}

dis.close();

fin.close();

}catch(Exception e){

e.printStackTrace();

}

}

}

The device is running! ############## <lsw1>sys Enter system view, return user view with Ctrl+Z. [lsw1]sys S1 [S1] Nov 23 2025 14:23:42-08:00 S1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25. 191.3.1 configurations have been changed. The current change number is 1, the ch ange loop count is 0, and the maximum number of records is 4095. [S1]int eth-trunk 1 [S1-Eth-Trunk1]int g0/0/1 [S1-GigabitEthernet0/0/1]eth-trunk 1 Info: This operation may take a few seconds. Please wait for a moment...done. [S1-GigabitEthernet0/0/1] Nov 23 2025 14:28:31-08:00 S1 %%01IFNET/4/IF_STATE(l)[54]:Interface Eth-Trunk1 h as turned into UP state. [S1-GigabitEthernet0/0/1] Nov 23 2025 14:28:33-08:00 S1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25. 191.3.1 configurations have been changed. The current change number is 2, the ch ange loop count is 0, and the maximum number of records is 4095.int g0/0/2 [S1-GigabitEthernet0/0/2]eth-trunk 1 Info: This operation may take a few seconds. Please wait for a moment...done. [S1-GigabitEthernet0/0/2] Nov 23 2025 14:28:53-08:00 S1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25. 191.3.1 configurations have been changed. The current change number is 3, the ch ange loop count is 0, and the maximum number of records is 4095. [S1-GigabitEthernet0/0/2]int eth-trunk 1 [S1-Eth-Trunk1]port link-type trunk [S1-Eth-Trunk1]port trunk Nov 23 2025 14:29:33-08:00 S1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25. 191.3.1 configurations have been changed. The current change number is 4, the ch ange loop count is 0, and the maximum number of records is 4095.all vlan 10 20 [S1-Eth-Trunk1] Nov 23 2025 14:29:43-08:00 S1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25. 191.3.1 configurations have been changed. The current change number is 5, the ch ange loop count is 0, and the maximum number of records is 4095. [S1-Eth-Trunk1]vlan batch 10 20 30 Info: This operation may take a few seconds. Please wait for a moment...done. [S1] Nov 23 2025 14:30:13-08:00 S1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25. 191.3.1 configurations have been changed. The current change number is 6, the ch ange loop count is 0, and the maximum number of records is 4095. [S1]int g0/0/24 [S1-GigabitEthernet0/0/24]port link-type access [S1-GigabitEthernet0/0/24]port Nov 23 2025 14:30:53-08:00 S1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25. 191.3.1 configurations have been changed. The current change number is 7, the ch ange loop count is 0, and the maximum number of records is 4095.defa vlan 30 [S1-GigabitEthernet0/0/24] Nov 23 2025 14:31:03-08:00 S1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25. 191.3.1 configurations have been changed. The current change number is 8, the ch ange loop count is 0, and the maximum number of records is 4095. [S1-GigabitEthernet0/0/24]q [S1]int vlan10 [S1-Vlanif10] Nov 23 2025 14:31:38-08:00 S1 %%01IFNET/4/IF_STATE(l)[55]:Interface Vlanif10 has turned into UP state. [S1-Vlanif10]ip add 10.1.10.254 24 [S1-Vlanif10] Nov 23 2025 14:31:51-08:00 S1 %%01IFNET/4/LINK_STATE(l)[56]:The line protocol IP on the interface Vlanif10 has entered the UP state. [S1-Vlanif10] Nov 23 2025 14:31:53-08:00 S1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25. 191.3.1 configurations have been changed. The current change number is 9, the ch ange loop count is 0, and the maximum number of records is 4095. [S1-Vlanif10]int vlan20 [S1-Vlanif20] Nov 23 2025 14:32:41-08:00 S1 %%01IFNET/4/IF_STATE(l)[57]:Interface Vlanif20 has turned into UP state. [S1-Vlanif20]ip add 10.1.20.254 24 [S1-Vlanif20] Nov 23 2025 14:32:53-08:00 S1 %%01IFNET/4/LINK_STATE(l)[58]:The line protocol IP on the interface Vlanif20 has entered the UP state. [S1-Vlanif20]int vla Nov 23 2025 14:33:03-08:00 S1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25. 191.3.1 configurations have been changed. The current change number is 10, the c hange loop count is 0, and the maximum number of records is 4095.n30 [S1-Vlanif30] Nov 23 2025 14:33:05-08:00 S1 %%01IFNET/4/IF_STATE(l)[59]:Interface Vlanif30 has turned into UP state. [S1-Vlanif30]ip add 10.1.30.254 24 [S1-Vlanif30] Nov 23 2025 14:33:18-08:00 S1 %%01IFNET/4/LINK_STATE(l)[60]:The line protocol IP on the interface Vlanif30 has entered the UP state. [S1-Vlanif30] Nov 23 2025 14:33:23-08:00 S1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25. 191.3.1 configurations have been changed. The current change number is 11, the c hange loop count is 0, and the maximum number of records is 4095. [S1-Vlanif30]q [S1]dhcp enable Info: The operation may take a few seconds. Please wait for a moment.done. [S1] Nov 23 2025 14:35:23-08:00 S1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25. 191.3.1 configurations have been changed. The current change number is 12, the c hange loop count is 0, and the maximum number of records is 4095. [S1]ip pool vlan10 Info:It's successful to create an IP address pool. [S1-ip-pool-vlan10] Nov 23 2025 14:35:43-08:00 S1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25. 191.3.1 configurations have been changed. The current change number is 13, the c hange loop count is 0, and the maximum number of records is 4095. [S1-ip-pool-vlan10]net 10.1.10.0 mask 255.255.255.0 [S1-ip-pool-vlan10] Nov 23 2025 14:36:13-08:00 S1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25. 191.3.1 configurations have been changed. The current change number is 14, the c hange loop count is 0, and the maximum number of records is 4095. [S1-ip-pool-vlan10]gat [S1-ip-pool-vlan10]gateway-list 10.1.10.254 [S1-ip-pool-vlan10]lease da Nov 23 2025 14:36:33-08:00 S1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25. 191.3.1 configurations have been changed. The current change number is 15, the c hange loop count is 0, and the maximum number of records is 4095.y 2 [S1-ip-pool-vlan10]dn Nov 23 2025 14:36:43-08:00 S1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25. 191.3.1 configurations have been changed. The current change number is 16, the c hange loop count is 0, and the maximum number of records is 4095.s-l [S1-ip-pool-vlan10]dns-list 8.8.8.8 [S1-ip-pool-vlan10]q [S1]in Nov 23 2025 14:37:03-08:00 S1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25. 191.3.1 configurations have been changed. The current change number is 17, the c hange loop count is 0, and the maximum number of records is 4095.t vlanif10 [S1-Vlanif10]dhcp se [S1-Vlanif10]dhcp select g [S1-Vlanif10]dhcp select global [S1-Vlanif10] Nov 23 2025 14:37:33-08:00 S1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25. 191.3.1 configurations have been changed. The current change number is 18, the c hange loop count is 0, and the maximum number of records is 4095. [S1-Vlanif10]undo dhcp select global [S1-Vlanif10] Nov 23 2025 14:41:53-08:00 S1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25. 191.3.1 configurations have been changed. The current change number is 19, the c hange loop count is 0, and the maximum number of records is 4095.dhcp se [S1-Vlanif10]dhcp select re [S1-Vlanif10]dhcp select relay [S1-Vlanif10]dhcp Nov 23 2025 14:42:13-08:00 S1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25. 191.3.1 configurations have been changed. The current change number is 20, the c hange loop count is 0, and the maximum number of records is 4095. [S1-Vlanif10]dhcp r [S1-Vlanif10]dhcp relay s [S1-Vlanif10]dhcp relay server-ip 10.1.30.253 [S1-Vlanif10] Nov 23 2025 14:42:53-08:00 S1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25. 191.3.1 configurations have been changed. The current change number is 21, the c hange loop count is 0, and the maximum number of records is 4095.
11-24
### 路由器 AR3 配置过程及命令作用解析 #### 1. 系统视图及设备命名 ```plaintext <AR3>sys Enter system view, return user view with Ctrl+Z. [AR3]sys R3 ``` - `sys`:从用户视图进入系统视图,用户视图下主要进行一些简单的查看操作,系统视图下可以进行设备的全局配置。 - `sys R3`:将设备的名称修改为 R3,方便在网络管理和维护中识别设备。 #### 2. 接口配置 ```plaintext [R3]int g0/0/0 [R3-GigabitEthernet0/0/0]ip add 10.1.30.253 24 ``` - `int g0/0/0`:进入 GigabitEthernet0/0/0 接口视图,接口视图用于对特定接口进行配置。 - `ip add 10.1.30.253 24`:为 GigabitEthernet0/0/0 接口配置 IP 地址为 10.1.30.253,子网掩码为 255.255.255.0(“24” 表示子网掩码中前 24 位为 1),使该接口能够在 10.1.30.0/24 网络中进行通信。 #### 3. OSPF 配置 ```plaintext [R3]ospf 1 [R3-ospf-1]area 0 [R3-ospf-1-area-0.0.0.0]net 10.1.30.0 0.0.0.255 ``` - `ospf 1`:启动 OSPF 进程,进程 ID 为 1,不同的进程可以独立运行不同的 OSPF 配置。 - `area 0`:进入 OSPF 的骨干区域(Area 0),OSPF 网络被划分为不同的区域,骨干区域负责连接其他区域。 - `net 10.1.30.0 0.0.0.255`:宣告 10.1.30.0/24 网络属于 OSPF 区域 0,使该网络的路由信息能够在 OSPF 网络中传播。 #### 4. DHCP 配置 ```plaintext [R3]dhcp enable [R3]ip pool poolvlan20 [R3-ip-pool-poolvlan20]net 10.1.20.0 mask 255.255.255.0 [R3-ip-pool-poolvlan20]gateway-list 10.1.20.254 [R3-ip-pool-poolvlan20]lease day 1 [R3-ip-pool-poolvlan20]dns-list 8.8.8.8 [R3-ip-pool-poolvlan20]excluded-ip-address 10.1.20.250 10.1.20.253 [R3]int g0/0/0 [R3-GigabitEthernet0/0/0]dhcp select global ``` - `dhcp enable`:开启 DHCP 服务功能,使设备能够为客户端动态分配 IP 地址。 - `ip pool poolvlan20`:创建一个名为 poolvlan20 的 DHCP 地址池,用于管理分配给客户端的 IP 地址。 - `net 10.1.20.0 mask 255.255.255.0`:指定 DHCP 地址池的网段为 10.1.20.0/24。 - `gateway-list 10.1.20.254`:为使用该地址池的客户端指定网关地址为 10.1.20.254。 - `lease day 1`:设置客户端获取的 IP 地址的租用期限为 1 天,到期后需要重新申请。 - `dns-list 8.8.8.8`:为客户端指定 DNS 服务器地址为 8.8.8.8,使客户端能够进行域名解析。 - `excluded-ip-address 10.1.20.250 10.1.20.253`:从地址池中排除 10.1.20.250 - 10.1.20.253 这些 IP 地址,不分配给客户端。 - `dhcp select global`:在 GigabitEthernet0/0/0 接口上选择使用全局的 DHCP 地址池为客户端分配 IP 地址。 ### 交换机 S1 配置过程及命令作用解析(参考引用[1]) #### 1. 修改交换机名称 ```plaintext <Huawei>sys Enter system view, return user view with Ctrl+Z. [Huawei]sys S1 ``` - `sys`:从用户视图进入系统视图。 - `sys S1`:将交换机的名称修改为 S1。 #### 2. VLAN 间通信配置(假设使用 VLANIF 接口实现) ```plaintext [S1]vlan batch 10 20 30 [S1]interface vlanif 10 [S1-Vlanif10]ip address 10.1.10.1 24 [S1]interface vlanif 20 [S1-Vlanif20]ip address 10.1.20.1 24 [S1]interface vlanif 30 [S1-Vlanif30]ip address 10.1.30.1 24 ``` - `vlan batch 10 20 30`:批量创建 VLAN 10、VLAN 20 和 VLAN 30,VLAN 用于将一个物理网络划分为多个逻辑子网。 - `interface vlanif 10`:进入 VLANIF 10 接口视图,VLANIF 接口是虚拟接口,用于为 VLAN 提供三层路由功能。 - `ip address 10.1.10.1 24`:为 VLANIF 10 接口配置 IP 地址为 10.1.10.1,子网掩码为 255.255.255.0,使 VLAN 10 中的设备可以通过该接口进行三层通信。 同理,为 VLANIF 20 和 VLANIF 30 接口分别配置 IP 地址,实现不同 VLAN 之间的通信。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值