也许
也许毕业后才发现自己需要多读书,
却没有问过自己大学里都做了什么。
也许很努力的学一样东西,
却没有问自己目前有用没。
也许总在问身边的人这个问题怎么做,
却没有问过自己如何去解决这个问题。
也许总在想该如何把工资涨起来,
却没有问自己该如何把工作做好。
也许总在想自己现在做的事情没什么前途,
却没有想过自己能不能把有前途的事做好。
也许总在说别人的不是,
却没有问自己做的对不。
也许总在给别人好的建议好的人生规划,
却没有给自己一个好的建议和好的规划。
也许总在想计划赶不上变化,
却没有想给自己计划过了没。
也许总在想自己过的是多么不好多么糟糕,
却没有想比自己努力但过的不好人的感受。
也许总在想朋友不跟自己联系不理自己,
却没有想过自己跟朋友有过多少次联系。
也许总在想跟朋友打电话说什么最好,
却没有想过朋友需要的只是一句问候。
也许总在想自己以后能怎么样好,
却没有想现在该怎么做该做什么。
也许总是在抱怨这抱怨那,
却没有去想着要试着改变。
也许觉得今天是很艰难的,
却没有想过明天是美好的。
也许…….也许……..
单臂路由的完整配置
1、设置虚拟PC的IP
ip 192.168.10.1 192.168.10.254
设置网管是为了跨区域通讯。
查看IP地址sh
2、进设备
配置基本的
Router#configure terminal #进入到配置模式下
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname SW1 #更改交换机的名称
SW1(config)#no ip domain lookup #关闭查询功能
SW1(config)#line console 0
SW1(config-line)#logging synchronous #同步日志
SW1(config-line)#exec-timeout 0 0 #配置为永远不超时 exec-
timeout 0 10 表示登录后无操作10秒后超时登出,这时候就要重新输入密
码登陆设备。
SW1(config-line)#end
以上的命令路由器和交换机上都要做
3、关闭每台交换机的路由功能
SW1(config)#no ip routing
4、做两天交换机之间的trunk和以太接口
SW1(config)#interface range fastEthernet0/14 – 15 #进入交换机1的14
和15端口
SW1(config-if-range)#channel-group 1 mode on #绑定为以太口
SW1(config)#int port-channel 1 #进入以太口
SW1(config-if)#switchport trunk encapsulation dot1q #做trunk并做
dot1q的封装。
SW1(config-if)#switchport mode trunk #设置为trunk模式
SW1(config-if)#no sh #激活端口
上面的几步在sw2上也要做验证trunk的命令如下
SW1#show interfaces trunk
Port Mode Encapsulation Status Native vlan
Fa0/0 on 802.1q trunking 1
Po1 on 802.1q trunking 1
Port Vlans allowed on trunk
Fa0/0 1-1005
Po1 1-1005
Port Vlans allowed and active in management domain
Fa0/0 1,10,20
Po1 1,10,20
Port Vlans in spanning tree forwarding state and not pruned
Fa0/0 1,10,20
Po1 1,10,20
5、创建vlan和做vtp
SW1#vlan database #通过数据库模式创建vlan
SW1(vlan)#vlan 10 name fin #创建vlan 10 并命名
VLAN 10 added:
Name: fin
SW1(vlan)#vlan 20 name mar
VLAN 20 added:
Name: mar
SW1(vlan)#vtp ? #设置vtp,查看vtp命令
client Set the device to client mode.
domain Set the name of the VTP administrative domain.
password Set the password for the VTP administrative domain.
pruning Set the administrative domain to permit pruning.
server Set the device to server mode.
transparent Set the device to transparent mode.
v2-mode Set the administrative domain to V2 mode.
SW1(vlan)#vtp server #设置vtp模式
Device mode already VTP SERVER.
SW1(vlan)#vtp domain cisco #设置vtp域名
Changing VTP domain name from NULL to cisco
SW1(vlan)#vtp pruning #开启裁剪模式
Pruning switched ON
SW1(vlan)#vtp password 123 #设置vtp密码
Setting device VLAN database password to 123.
SW1(vlan)#exit
在SW1上做完vtp后,在进入到SW2中做vtp,在SW2上做了vtp后SW2就可以把
SW1上的vlan学习到了。
6、通过vtp效验
SW1#sh vtp status
VTP Version : 2
Configuration Revision : 1
Maximum VLANs supported locally : 256
Number of existing VLANs : 7
VTP Operating Mode : Server
VTP Domain Name : cisco
VTP Pruning Mode : Enabled
VTP V2 Mode : Disabled
VTP Traps Generation : Disabled
MD5 digest : 0×81 0xE9 0×5C 0×99 0xDA 0×01
0xCE 0×3A
Configuration last modified by 0.0.0.0 at 3-1-02 00:14:30
Local updater ID is 0.0.0.0 (no valid interface found)
比较两台交换机上的MD5值,如果一样则证明vtp是通的
7、将端口加入到vlan中
SW1(config)#int fa0/1
SW1(config-if)#switchport mode access
SW1(config-if)#switchport access vlan 10
SW1(config-if)#no sh
8、做sw1与R1的trunk
SW1(config-if)#int fa0/0
SW1(config-if)#switchport tr
SW1(config-if)#switchport trunk en do
SW1(config-if)#switchport mode trunk
SW1(config-if)#no sh
9、配置路由
R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#int fa0/0
R1(config-if)#no ip address
R1(config-if)#no sh
01:00:53: %LINEPROTO-5-UPDOWN: Line protocol on Interface
FastEthernet0/0, changed state to up
R1(config-if)#
R1(config)#interface fastEthernet0/0.1 #进入子端口
R1(config-subif)#encapsulation dot1Q 10 #封装到vlan 10
R1(config-subif)#ip add 192.168.10.254 255.255.255.0 #对子端口进行
ip配置
R1(config-subif)#no sh
R1(config-subif)#int fa0/0.2
R1(config-subif)#encapsulation dot1Q 20
R1(config-subif)#ip address 192.168.20.254 255.255.255.0
R1(config-subif)#no sh
R1(config-subif)#int fa0/0.1
10、验证正确性,在虚拟pc1上ping虚拟pc2的网关。
私有地址
私有地址(Private address)属于非注册地址,专门为组织机构内部使用。
以下表列出留用的内部寻址地址
A类 10.0.0.0 –10.255.255.255
B类 172.16.0.0–172.31.255.255
C类 192.168.0.0–192.168.255.255
1. A类地址
⑴ A类地址第1字节为网络地址,其它3个字节为主机地址。另外第1个字节的最高位固定为0。
⑵ A类地址范围:1.0.0.1到126.255.255.254。
⑶ A类地址中的私有地址和保留地址:
①10.0.0.0到10.255.255.255是私有地址(所谓的私有地址就是在互联网上不使用,而被用在局域网络中的地址)。
② 127.0.0.0到127.255.255.255是保留地址,用做循环测试用的。
2. B类地址
⑴ B类地址第1字节和第2字节为网络地址,其它2个字节为主机地址。另外第1个字节的前两位固定为10。
⑵ B类地址范围:128.0.0.1到191.255.255.254。
⑶ B类地址的私有地址和保留地址
① 172.16.0.0到172.31.255.255是私有地址
②169.254.0.0到169.254.255.255是保留地址。如果你的IP地址是自动获取IP地址,而你在网络上又没有找到可用的DHCP服务器,这时你将会从169.254.0.0到169.254.255.255中临得获得一个IP地址。
3. C类地址
⑴C类地址第1字节、第2字节和第3个字节为网络地址,第4个个字节为主机地址。另外第1个字节的前三位固定为110。
⑵ C类地址范围:192.0.0.1到223.255.255.254。
⑶ C类地址中的私有地址:192.168.0.0到192.168.255.255是私有地址。
Trunk配置
一、交换机SW1配置:
Switch1(config)#vlan 20
Switch1(config)#vlan 30
Switch1(config)#interface fastEthernet 0/1
Switch1(config-if)#switchport mode access
Switch1(config-if)#switchport access vlan 20
Switch1(config)#interface fastEthernet 0/2
Switch1(config-if)#switchport mode access
Switch1(config-if)#switchport access vlan 30
Switch1#show vlan
VLAN Name Status Ports
—- ——————————– ——— ——————————-
1 default active Fa0/3, Fa0/4, Fa0/5, Fa0/6
Fa0/7, Fa0/8, Fa0/9, Fa0/10
Fa0/11, Fa0/12, Fa0/13, Fa0/14
Fa0/15, Fa0/16, Fa0/17, Fa0/18
Fa0/19, Fa0/20, Fa0/21, Fa0/22
Fa0/23, Fa0/24
20 VLAN0020 active Fa0/1
30 VLAN0030 active Fa0/2
1002 fddi-default active
1003 token-ring-default active
1004 fddinet-default active
1005 trnet-default active
VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2
—- —– ———- —– —— —— ——– —- ——– —— ——
1 enet 100001 1500 - - - - - 0 0
20 enet 100020 1500 - - - - - 0 0
30 enet 100030 1500 - - - - - 0 0
1002 enet 101002 1500 - - - - - 0 0
1003 enet 101003 1500 - - - - - 0 0
1004 enet 101004 1500 - - - - - 0 0
1005 enet 101005 1500 - - - - - 0 0
Switch1(config)#interface fastEthernet 0/24
Switch1(config-if)#switchport mode trunk //2950交换机只能封装dot1q ,所以无须键入switchport trunk encanpsulation dotiq
Switch1#show vlan
VLAN Name Status Ports
—- ——————————– ——— ——————————-
1 default active Fa0/3, Fa0/4, Fa0/5, Fa0/6
Fa0/7, Fa0/8, Fa0/9, Fa0/10
Fa0/11, Fa0/12, Fa0/13, Fa0/14
Fa0/15, Fa0/16, Fa0/17, Fa0/18
Fa0/19, Fa0/20, Fa0/21, Fa0/22
Fa0/23
20 VLAN0020 active Fa0/1
30 VLAN0030 active Fa0/2
1002 fddi-default active
1003 token-ring-default active
1004 fddinet-default active
1005 trnet-default active
VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2
—- —– ———- —– —— —— ——– —- ——– —— ——
1 enet 100001 1500 - - - - - 0 0
20 enet 100020 1500 - - - - - 0 0
30 enet 100030 1500 - - - - - 0 0
1002 enet 101002 1500 - - - - - 0 0
1003 enet 101003 1500 - - - - - 0 0
1004 enet 101004 1500 - - - - - 0 0
1005 enet 101005 1500 - - - - - 0 0
Switch1#show interfaces trunk
Port Mode Encapsulation Status Native vlan
Fa0/24 on 802.1q trunking 1
Port Vlans allowed on trunk
Fa0/24 1-1005
Port Vlans allowed and active in management domain
Fa0/24 1,20,30,1002,1003,1004,1005
Port Vlans in spanning tree forwarding state and not pruned
Fa0/24 1,20,30,1002,1003,1004,1005
Switch1(config)#interface fastEthernet 0/24
Switch1(config-if)#switchport native vlan 20
Switch1#show interfaces trunk
Port Mode Encapsulation Status Native vlan
Fa0/24 on 802.1q trunking 20
Port Vlans allowed on trunk
Fa0/24 1-1005
Port Vlans allowed and active in management domain
Fa0/24 1,20,30,1002,1003,1004,1005
Port Vlans in spanning tree forwarding state and not pruned
Fa0/24 1,20,30,1002,1003,1004,1005
二、交换机SW2配置:
Switch2(config)#interface fastEthernet 0/24
Switch2(config-if)#switchport mode trunk
三、DTP
Cisco交换机之间的链路是否形成Trunk是可以自动协商的,这个协议称为DTP(Dynamic Trunk Protocol),DTP还可以协商Trunk链路的封装类型。
前段时间碰到虚拟机磁盘空间不够用的问题在网上找了很久还是很有解决,有一哥们说VM虚拟自带了扩展磁盘的工具,下面就是操作步骤。
1、首先找到VMware的安装路径,从vm的快捷方式的属性去寻找安装路径(如:C:\Program Files\VMware\VMware Workstation>)找到vmware-vdiskmanager这个程序,它就是用来扩展磁盘用的。
2、找到虚拟机系统的存放路径如:E:\My Documents\My Virtual Machines\Ubuntu_Svn\Ubuntu_Svn.vmdk
3、用命令进入到虚拟机安装路径在执行如下命令vmware-vdiskmanager -x 15Gb “E:\My Documents\My Virtual Machines\Ubuntu_Svn\Ubuntu_Svn.vmdk”
C:\Program Files\VMware\VMware Workstation>vmware-vdiskmanager -x 15Gb “E:\My Documents\My Virtual Machines\Ubuntu_Svn\Ubuntu_Svn.vmdk”
上面的命令中的15Gb是只扩展到15Gb而不是扩展了15Gb。然后等待几分钟就可以了。
注意:此时启动虚拟机是扩展的硬盘空间还不能用,还需要下面的设置。
如果是win的系统,进入系统后直接在磁盘管理里增加磁盘即可。
linux的需要用到gparted-live-0.5.1-1.iso这个工具,用光驱驱动。进入后选择第一个入然后安找提示做既可以。
gparted-live-0.5.1-1.iso这个工具很好用的,也可以用在win下
Linux DB2备份恢复
通过如下备份脚本备份的数据库进行恢复
备份脚本:
. /home/db2admin/sqllib/db2profile
db2 backup db datedb online to /dbbackup/date include logs
cd /dbbackup/datetoday=`date +”%Y%m%d”`
file1=”*$today*”
ftpfile=`ls $file1`
echo $ftpfile
lftp -c “open ftp地址;user 用户名密码@\$0;put $ftpfile”
find /dbbackup/date -ctime +15 -exec rm {} \;
恢复命令:
通过root命令登录到服务器上后切换到数据库用户名下用su – db2admin命令。
进入到备份文件存放目录
执行如下命令
[db2admin@localhost db2back]$ db2 restore db datedb from /hom
ubuntu安装桌面环境的命令
用做服务器的话,实际上不需要配置 GUI,不过因为初装,对 Ubuntu 和 Linux 都不熟悉,所以还是装了个 gnome协助管理。
服务器版配置 gnome 也很方便:
a) 安装:
#apt-get aptitude install Ubuntu-desktop
安装成功后便会自动登录到桌面了。
GUI 里确实可以更方便地进行很多操作,尤其是文件、目录、文本编辑的操作,这些在终端下都是
繁杂的工作。不过很多系统操作,还是要在终端下更方便进行,跟 Windows 不同,GUI 在
Server 上很多时候只起个辅助作用。
b) 取消 GUI 自动启动:
#update-rc.d -f gdm remove
重启后便不会自动进入桌面,此时可用 startx 启动桌面。
1.启动数据库
db2start
2.停止数据库
db2stop
3.连接数据库
db2 connect to o_yd user db2 using pwd
4.读数据库管理程序配置
db2 get dbm cfg
5.写数据库管理程序配置
db2 update dbm cfg using 参数名 参数值
6.读数据库的配置
db2 connect to o_yd user db2 using pwd
db2 get db cfg for o_yd
7.写数据库的配置
db2 connect to o_yd user db2 using pwd
db2 update db cfg for o_yd using 参数名 参数值
8.关闭所有应用连接
db2 force application all
db2 force application ID1,ID2,,,Idn MODE ASYNC
(db2 list application for db o_yd show detail)
9.备份数据库
db2 force application all
db2 backup db o_yd to d:
(db2 initialize tape on \\.\tape0)
(db2 rewind tape on \\.\tape0)
db2 backup db o_yd to \\.\tape0
10.恢复数据库
db2 restore db o_yd from d: to d:
db2 restore db o_yd from \\.\tape0 to d:
11.绑定存储过程
db2 connect to o_yd user db2 using pwd
db2 bind c:\dfplus.bnd
拷贝存储过程到服务器上的C:\sqllib\function目录中
12.整理表
db2 connect to o_yd user db2 using pwd
db2 reorg table ydd
db2 runstats on table ydd with distribution and indexes all13.导出表数据
db2 export to c:\dftz.txt of del select * from dftz
db2 export to c:\dftz.ixf of ixf select * from dftz
14.导入表数据
import from c:\123.txt of del insert into ylbx.czyxx
db2 import to c:\dftz.txt of del commitcount 5000 messages c:\dftz.msg insert into dftz
db2 import to c:\dftz.ixf of ixf commitcount 5000 messages c:\dftz.msg insert into dftz
db2 import to c:\dftz.ixf of ixf commitcount 5000 insert into dftz
db2 import to c:\dftz.ixf of ixf commitcount 5000 insert_update into dftz
db2 import to c:\dftz.ixf of ixf commitcount 5000 replace into dftz
db2 import to c:\dftz.ixf of ixf commitcount 5000 create into dftz (仅IXF)
db2 import to c:\dftz.ixf of ixf commitcount 5000 replace_create into dftz (仅IXF)15.执行一个批处理文件
db2 -tf 批处理文件名
(文件中每一条命令用 ;结束)
16.自动生成批处理文件
建文本文件:temp.sql
select ‘runstats on table DB2.’ || tabname || ‘with distribution and detailed indexes all;’
from syscat.tables where tabschema=’DB2′ and type=’T';
db2 -tf temp.sql>runstats.sql
17.自动生成建表(视图)语句
在服务器上:C:\sqllib\misc目录中
db2 connect to o_yd user db2 using pwd
db2look -d o_yd -u db2 -e -p -c c:\o_yd.txt
18.其他命令
grant dbadm on database to user bb19select * from czyxx fetch first 1 rows only
20db2look -d ylbx -u db2admin -w -asd -a -e -o a.txt21. 显示当前用户所有表list tables
22.列出所有的系统表list tables for system
23.查看表结构
db2 describe select * from user.tables
