本周去长沙实习。实习老师是做云计算的,以下是一些实习知识: 1、网络基础 (1)网络概述 硬件方面:通过线缆将网络设备和计算机连接起来 软件方面:操作系统,应用软件,应用程序通过通信线路互连 实现资源共享、信息传递 (2)网络划分 范围划分:WAN、LAN 拓扑方式划分:星型、网型、树型、总线型 (3)网络设备 交换机、路由器、防火墙、VPN设备 (4)OSI七层模型 物理层 如何使用物理信号来表示数据1和0 数据传输是否可同时在两个方向上进行 通信双方如何建立和中止连接 物理接口特性
数据链路层 数据帧封装结构 源和目的方的物理地址 数据校验功能
网络层 数据包封装结构 源和目的方的逻辑地址 根据包头的逻辑地址选路
传输层 用户进程间的通信 承上启下
会话层 建立用户间的会话关系
表示层 定义传递信息的语法和语义 编码和解码、压缩解压缩、加密解密
应用层 提供与用户的接口
(5)TCP/IP5层协议栈 物理、数据链路、网络、传输、应用 / 使用Cisco学习网络知识: 数据链路层 (1)MAC地址 6个字节:3(供应商标识)+3(供应商网卡内部编号),具备全球唯一性 DOS界面下:ipconfig /all AA-AA-AA-AA-AA-AA (2)帧格式 6+6+2+IP包+4FCS(帧校验字段)
(2)交换机简单配置 用户模式 switch> 特权模式 switch>enable switch# 全局配置模式 switch#config terminal switch(config)#
接口模式 switch(config)# interface fastethernet 0/1 switch(config-if)# 命令的含义 interface:关键字 fastethernet:接口类型 e、fa、gi 0/1:“0”表示模块号,“1”表示端口号
交换机配置IP地址 Switch(config)#interface vlan 1 Switch(config-if)#ip address ip-address subnet-mask Switch(config-if)#no shutdown
Router(config)#interface fastethernet 0/1 Router(config-if)#ip address ip-address subnet-mask Router(config-if)#no shutdown
配置Console口密码 //进入用户模式时候,用此密码 sw1(config)#line console 0 sw1(config-line)#password cisco sw1(config-line)#login
配置明文特权模式密码 //密文特权口令高于明文特权口令
sw1(config)# enable password cisco0 配置密文特权模式密码 sw1(config)# enable secret cisco
Router(config)#no enable password //清除明文特权口令 Router(config)#no enable sec Router(config)#no enable secret //清除密文特权口令
配置静态VLAN的步骤 a、创建VLAN Switch#vlan database Switch(vlan)#vlan vlan-id [name vlan-name] Switch(vlan)#exit //保存退出
b、将端口加入VLAN Switch(config)# interface interface-id Switch(config-if)# switchport mode access \定义交换端口模式为access模式 Switch(config-if)# switchport access vlan vlan-id \将此端口添加到vlan中 Switch(config-if)# no switchport access vlan vlan-id \将端口从某个VLAN中删除
b-I 同时将多个端口加入VLAN Switch(config)# interface range f0/1 –10 Switch(config-if-range)# switchport access vlan vlan-id Switch(config-if)# switchport mode access
c、(Switch)#show vlan brief \查看不同vlan下包含有哪些端口 测试同vlan主机能通信,不同vlan主机之间不同通信
将交换机的端口加入到相应的VLAN中 验证VLAN的配置 2、Linux命令基础 (1)linux 6.3 32位系统安装 vawareworkstatins、镜像文件 a、linux分区必须要有/ 、SWAP 、/boot三个分区 b、安装一个最小化(mini)版的系统
linux虚拟机配置桥接IP,并测试网络连通性 ifconfig eth0 172.16.x.y netmask 255.255.0.0 ping 172.16.1.254 //linux虚拟机和教师机连通性测试 pwd、cd、ls、touch、mkdir、useradd
[root@stone ~]# pwd 查看当前所在工作目录 /root
[root@stone ~]# cd /boot [root@stone boot]# pwd /boot [root@stone boot]# cd ~ //切换到家目录 [root@stone ~]# pwd /root [root@stone ~]# cd /etc/sysconfig/network-scripts/ [root@stone network-scripts]# cd //切换到家目录
[root@stone ~]# mkdir hjgxy [root@stone ~]# ls anaconda-ks.cfg hjgxy install.log install.log.syslog [root@stone ~]# mkdir hjqxy/ymh //此处目录名错误,导致创建子目录失败 mkdir: 无法创建目录"hjqxy/ymh": 没有那个文件或目录 [root@stone ~]# mkdir hjgxy/ymh [root@stone ~]# ls anaconda-ks.cfg hjgxy install.log install.log.syslog [root@stone ~]# ls hjgxy
[root@stone ~]# mkdir hy/hs mkdir: 无法创建目录"hy/hs": 没有那个文件或目录 [root@stone ~]# mkdir -p hy/hs //通过-p选项实现多级目录的建立
[root@stone ~]# pwd /root [root@stone ~]# cd … //切换到父级目录 [root@stone /]# cd …/…/…/… [root@stone /]#
[root@stone ~]# mkdir -p yttlj/{em,hs,wd,kt,sl,my} //创建多级目录下多个子目录 [root@stone ~]# ls yttlj em hs kt my sl wd [root@stone ~]#
[root@stone ~]# ls anaconda-ks.cfg hjgxy hy install.log install.log.syslog yttlj [root@stone ~]# rm -rf hy hjgxy yttlj //强制递归删除多个子目录 [root@stone ~]# ls anaconda-ks.cfg install.log install.log.syslog 练习1: 请用mkdir命令创建china,china下有hunan,nmg,fj三个省份名称。且hunan目录下有 cs,hy两个子目录,nmg下有als,hhht两个子目录,fj下有xm,fz两个子目录。 PS:一条命令实现 [root@stone ~]# mkdir -p china/{hunan/{cs,hy},nmg/{hhht,als},fj/{fz,xm}} [root@stone ~]# ls china fj hunan nmg [root@stone ~]# ls china/fj fz xm [root@stone ~]# ls china/hunan cs hy [root@stone ~]# ls china/nmg als hhht
for 条件;do 动作;done
[root@stone ~]# for i in {1…100};do mkdir dirKaTeX parse error: Expected 'EOF', got '#' at position 42: … [root@stone ~]#̲ for i in `seq …i;done [root@stone ~]# ls anaconda-ks.cfg dir20 dir34 dir48 dir61 dir75 dir89 china dir21 dir35 dir49 dir62 dir76 dir9 dir1 dir22 dir36 dir5 dir63 dir77 dir90 dir10 dir23 dir37 dir50 dir64 dir78 dir91 dir100 dir24 dir38 dir51 dir65 dir79 dir92 dir11 dir25 dir39 dir52 dir66 dir8 dir93 dir12 dir26 dir4 dir53 dir67 dir80 dir94 dir13 dir27 dir40 dir54 dir68 dir81 dir95 dir14 dir28 dir41 dir55 dir69 dir82 dir96 dir15 dir29 dir42 dir56 dir7 dir83 dir97 dir16 dir3 dir43 dir57 dir70 dir84 dir98 dir17 dir30 dir44 dir58 dir71 dir85 dir99 dir18 dir31 dir45 dir59 dir72 dir86 install.log dir19 dir32 dir46 dir6 dir73 dir87 install.log.syslog dir2 dir33 dir47 dir60 dir74 dir88 练习2:删除dir1~dir100. (rm -rf) 方法一、 [root@stone ~]# for i in {1…100};do rm -rf dir$i;done 方法二、 [root@stone ~]# rm -rf dir* [root@stone ~]# ls anaconda-ks.cfg china install.log install.log.syslog
[root@stone ~]# mkdir dir{a…z} //创建dira~dirz [root@stone ~]# ls anaconda-ks.cfg dirc dirg dirk diro dirs dirw install.log china dird dirh dirl dirp dirt dirx install.log.syslog dira dire diri dirm dirq diru diry dirb dirf dirj dirn dirr dirv dirz
练习3:删除目录dira~dirz [root@stone ~]# rm -rf dir{a…z} //方法一 [root@stone ~]# ls anaconda-ks.cfg china install.log install.log.syslog [root@stone ~]# mkdir dir{a…z} [root@stone ~]# rm -rf dir[a-z] //方法二
[root@stone ~]# vi aa //vi命令编辑脚本 [root@stone ~]# cat aa //查看脚本文件的内容 read -p “please input a dir name:” dir mkdir $dir [root@stone ~]# bash aa //bash命令执行脚本并测试 please input a dir name:mht [root@stone ~]# ls //检查脚本执行结果 aa anaconda-ks.cfg china install.log install.log.syslog mht
[root@stone ~]# vi aa.sh //编辑一个脚本,实现手工输入一个数字后,批量创建dir1~dirn read -p “Input your number:” n for i in seq $n do mkdir dir$i done [root@stone ~]# bash aa.sh //bash命令执行脚本并测试
感觉做运维方面的话,的确不用敲那么多代码,逻辑思维不那么强也可以