设置认证网页

(1)制作受保护的目录和文件
#mkdir /usr/local/apache/htdocs/down/
#touch 1.txt 2.txt 3.txt

(2)制作密码文件
制作密码文件命令:htpasswd
语法:
#htpasswd [-c] password_file_name User_name
如1:
#htpasswd apache.passwd  //制作名为apache.passwd的密码文件
#htpasswd apache.passwd aaa  //增加账号

(3)针对保护的目录设置认证的内容
#vi /usr/local/apache2/conf/httpd.conf
加入以下几行:

<Directory “/usr/local/apache2/htdocs/down”>   #保护目录的路径
AuthName “Protected Directory”    #显示上窗口上面的提示字符
AuthType Basic   #认证类型

AuthUserFile /usr/local/apache2/htdocs/apache.passwd #密码文件放置的完整路径

require valid-user  #允许任何在认证文件里的用户

#require user aaa  #允许aaa用户

</Directory>

(4)重启apache

Posted by admin in linux技术 - Comments (0)
4 07月

网络地址转换NAT

网络地址转换NAT

网络地址转换NAT通过将内部网络的私有IP地址翻译成全球唯一的公网IP地址,使内部网络可以连接到互联网等外部网络上.广泛应用于各种类型困特网接入方式和各种类型的网络中.

NAT的三种实现方式:
一,静态转换:将内部网络的私有IP地址转换为公有合法的IP地址时,IP地址的对应关系是一对一的,是不变的,即某人私有IP地址只转换为某个固定的公有IP地址.
配置命令:
Router(config)#ip nat inside source static local-ip(私有地址) global-ip(公有地址)

在内部和外部端口上启用NAT
Router(config)#interface serial 0/0
Router(config-if)#ip nat outside
Router(config)#interface FastEthernet 0/0
Router(config-if)#ip nat inside

二,动态转换:是指将内部网络的私有地址转换为公有地址时,IP地址对应关系是不确定的,随机的,所以被授权访问因特网的私有地址可随机转换为任何指定的合法地址.

配置过程:
1,配置内外部IP地址
2,定义内部网络中允许访问外部网络的访问控制列表
Router(config)#access-list access-list-number permit source source-wildcard
Router(config)#access-list 1 permit 10.1.1.0 0.0.0.255
3,定义合法IP地址池
Router(config)#ip nat pool pool-name star-ip end-ip {netmask metmask | prefix-length prefix-length} [type rotary]

pool-name:放置转换后地址池的名称
star-ip end-ip:地址池内起始和终止IP地址
netmask metmask:子网掩码

4,实现网络地址转换
Router(config)#ip nat inside source list access-list-number  pool pool-name [overload]
overload(可选):使用地址复用,用于PAT
如:
Router(config)#ip nat inside source list 1 pool test

5,在内部和外部端口上启用NAT
Router(config)#interface serial 0/0
Router(config-if)#ip nat outside
Router(config)#interface FastEthernet 0/0
Router(config-if)#ip nat inside

三,端口多路复用(PAT):是改变外出数据包的源IP地址和源端口并进行端口转换,即端口地址转换采用多路复用方式.多对一复用.
配置过程:
1,配置内外部IP地址
2,定义内部网络中允许访问外部网络的访问控制列表
Router(config)#access-list access-list-number permit source source-wildcard
3,定义合法IP地址池
Router(config)#ip nat pool pool-name star-ip end-ip {netmask metmask | prefix-length prefix-length} [type rotary]
4,设置复用动态IP地址转换
Router(config)#ip nat inside source list access-list-number poop pool-name overload

5,在内部和外部端口上启用NAT
Router(config)#interface serial 0/0
Router(config-if)#ip nat outside
Router(config)#interface FastEthernet 0/0
Router(config-if)#ip nat inside
复用路由器外部接口地址:
Router(config)#ip nat inside source list 1 interface serial0/0 overload

TCP负载均衡配置
定义一个NAT地址集
Router(config)#ip nat pool real-host 10.1.1.10 10.1.1.15 prefix-length 25 type rotary

设置访问控制列表与NAT地址集之间的映射
Router(config)#ip nat inside destination list access-list-number pool pool-name
验证NAT的配置
Router#show ip nat translations

清除NAT表的条目
Router#clear ip nat translation *

3 07月

访问控制列表

 

访问控制列表(ACL)是应用在路由器接口的指令副列表,具有同一个

访问列表表号或名称的access-list语句便组成了一个逻辑序列或指

令列表.

ACL基本原理:ACL使用包过滤技术,在路由器上读取OSI7层模型的第

三和第四层包头的信息,如源地址,目的地址,源端口,目的端口等,根

据预先定义好的规则,对包进行过滤,从而达到访问控制的目的.

ACL的两种基本类型
标准访问控制列表(1~99):检查被路由数据包的源地址.
扩展访问控制列表:对数据包的源地址与目标地址进行检查.

ACL的基本作用:
1)提供网络访问的基本安全手段
2)访问控制列表可用于QoS对数据流量进行控制
3)提供对通信流量的控制手段

数据包与每一个判断不匹配时,它才交给ACL中的下一个条件判断语

句进行比较;在与某条语句匹配后,就结束比较过程,不再检查以后的

其他条件判断语句;如果不与任一语句匹配,则它必与最后隐含的拒

绝匹配.

访问控制列表的入与出
Router(config-if)#ip access-group access-list-number

{in|on}

访问控制列表的deny和permit
Router(config)#access-list access-list-number {permit |

deny } {test conditions}

permit:允许数据包通过
deny:拒绝数据包通过

如:
Router(config)#access-list 1 deny 192.168.1.0 0.0.0.255
Router(config)#access-list 1 permit 192.168.2.0 0.0.0.255

删除一个列表:
首先在接口模式下输入命令:no ip access-group
瑞在全局模式下输入:no access-list

通配符(any)任何网络
通配符(host)间个主机

标准访问控制列表的应该配置
1,access-list和show access-list命令:配置和显示访问列表

Router(config)#access-list access-list-number {permit |

deny} source [source(源地址)-wildcard] [log]

Router(config)#no access-list access-list-number

2,access-group命令:访问控制列表与出站接口联系起来
Router(config-if)#ip access-group access-list-number {in |

out}

扩展访问控制列表的应用与配置

Router(config)#access-list access-list-number {permit |

deny } protocol [source source-wildcare detination

destination-wildcard] [operator operan] [established] [log]

测试条件 | 源/目的地址 | 反码/源反码
operator operan:lt(小于) gt(大于) eq(大于) neq(不等于)和一

个端口

如:
Router(config)#access-list 101 deny tcp 10.1.1.0 0.0.0.255

10.1.2.0 0.0.0.255 eq 21

Router(config)#access-list 101 permit ip any any

命令访问控制列表
Router(config)#ip access-list {standard(标准)|extended(扩展

)} name

命名访问控制列表的应用
1,创建名为network的命名访问控制列表:
Router(config)#ip access-list extended network
2,指定一个或多个允许及拒绝条件:
Router(config-ext-nacl)#deny tcp 10.1.1.0 0.0.0.255

10.1.2.0 0.0.0.255 eq 23
Router(config-ext-nacl)#permit ip any any
3,应用到接口E0的出方向
Router(config)#interface fastethernet 0/0
Router(config-if)#ip access-group network out

2 07月

HSRP协议

热备份HSRP协议为IP网络提供了容错和增强的路由选择功能,通过使

用同一个IP地址和虚拟MAC地址,LAN网段上的两台或者多台可以作为

一台”虚拟”路由器而对外提供服务,如果一台出现故障,另一台就能

接替它,继续完成路由功能.

HSRP备份组成员
一台活跃路由器:功能是转发发送到虚拟路由器的数据包
一台备份路由器:功能是监视HSRP组的运行状态
一台虚拟路由器:功能是最终用户代表一台可以连续工作的路由器

配置HSRP的主要内容

1,配置一个端口参加HSRP备份组
2,分配HSRP备份优先级
3,配置HSRP备份优先级
4,配置HELLO计时器
5,显示HSRP的状态

HSRP的基本配置
1,将路由器配置为HSRP的成员
Router(config-if)#standby group-number ip vitrual-ip-

address

例如:
Router#config terminal
Router(config)#interface fastethernet 0/1
Router(config-if)#ip address 1.1.1.1 255.255.255.0
Router(config-if)#standby 10 ip 1.1.1.10

从HSRP组中取消一个端口
Router(config-if)#no standby 10 ip 1.1.1.10

关闭端口重定向功能
Router(config-if)#no ip redirects

配置HSRP的优先级
Router(config-if)#standby group-number priority priority-

value

配置HSRP的占先权
Router(config-if)#standby group-number preempt
配置HELLO消息的计时器
Router(config-if)#standby group-number times hellotime(间隔

) holdtime(默认)

配置端口跟踪
Router(config-if)#standby group-number track type number

interface-priority

关闭端口跟踪
Router(config-if)#no standby group track
查检HSRP路由器的状态
Router#show standby type-number group brief

2 07月

OSPF单域的基本配置命令

(1)配置loopback接口地址
Router(config)#interface loopback 0
Router(config-if)#ip address ip-address ip-mask

(2)启动OSPF路由进程
Router(config)#router ospf 进程号

(3)指定OSPF协议运行的接口和所在的区域
Router(config-router)#network 网络号 反向掩码 area

区域号
如:Router(config-router)#network 1.1.1.0 0.0.0.255

area 0

(4)修改接口的cost值
Router(config-if)#ip ospf cost cost值
如:Router(config-if)#ip ospf cost 1000

(5)配置OSPF计时器
Router(config-if)#if ospf hello-interval 时间(S)
Router(config-if)#if ospf dead-interval 时间(S)

(6)查看邻居表
Router#show ip ospf neighbor

(7)查看链路状态数据库
Router#show ip ospf detabase

(8)查看路由表
Router#show ip route

(9)查看OSPF接口数据结构
Router#show ip ospf interface  接口

1 07月

PPP协议

 

PPP(点对点协议的简称)
PPP协议的优点
1,支持同步,异步串行链路
2,支持多种网络层协议
3,支持各种连接参数的协商
4,支持错误检测
5,支持用户认证
6,允许进行数据压缩

PPP协议三个组成部分:协议封装方式,LCP(链路控制协议),NCP(网络控制

协议)

PPP支持两种认证方式:PAP认证和CHAP认证

PPP协议的配置的主要内容有:
1,PPP协议基本配置
Router(config)#interface serial slot/port
Router(config-if)#encapsulation ppp
Router(config-if)#ip address ip_addr ip_mask
Router(config-if)#shutdown
Router(config-if)#no shutdown

2,配置PAP认证
1)主认证端PAP配置
Router(config)#username user_name password 0 pass_word
0表示明文保存
Router(config-if)#ppp authentication pap

2)被认证端PAP配置
Router(config-if)#ppp pap sent-username user_name password 0

pass_word

3,配置CHAP认证
1)主认证端CHAP配置
Router(config)#username user_name password 0 pass_word
0表示明文保存
Router(config-if)#ppp authentication chap

自己指定用户名:
Router(config-if)#ppp chap hostname user_name

2)被认证端配置CHAP
Router(config)#username user_name password 0 pass_word
Router(config-if)#ppp chap password 0 pass_word

自己指定用户名:
Router(config-if)#ppp chap hostname user_name

4,配置IP地址协商
1)服务器端配置
Router(config-if)#peer default ip address ip_address
2)客户端配置
Router(config-if)#ip address negotiated

5,配置PPP压缩(两端须同时配置)
1)配置Stac压缩
Router(config-if)#compress {predictor | stac}
predictor消耗大量内存
stac占用很大部分CPU

2)配置TCP头压缩
Router(config-if)#ip tcp header-compression
启用TCP头压缩之后,接口的快速转发功能将被自动关闭.

debug ppp packet查检连接的状态和协商过程是否正确

 

Posted by admin in 好友圈子 - Comments (0)
1 07月

三层交换

三层交换机同时具有二层交换机的功能和三层路由选择的功能,三层交换

采用硬件转发技术,实现数据的线事转发.

三层交换机用来解决路由器与交换机之间的链路成为整个网络瓶颈的问

三层交换机技术:二层交换技术+三层转发技术

配置单臂路由,主要包含以下几个内容:

配置路由器的子接口
在子接口上封装VLAN Trunk协议
配置子接口的IP地址,使之成为相应VLAN的网关

Router(config)#interface fastEthernet 0/0.1
Router(config-subif)#encapsulation dot1q 1
Router(config-subif)#ip address 1.1.1.1 255.0.0.0

三层交换机的配置命令

1,在三层交换机上启用路由:
Switch(config)#ip routing
2,配置VLAN的IP地址:
Switch(config)#interface vlan vlan-id
Switch(config-if)#ip address ip-address subnet-mask
Switch(config-if)#no shut
3,查看FIB表:
Switch(config)#show ip cef
4,查看邻接关系表:
Switch(config)#show adjacency detail
5,在三层交换机上配置路由接口
Switch(config-if)#no switchport
6,配置DHCP中继转发
Switch(config)#interface vlan vlan-id
Switch(config-if)#ip helper-address dhcpserver-address

Posted by admin in 好友圈子 - Comments (0)
1 07月

STP协议

 

STP生成树协议:把一个环形的结构改变成一个树形的结构,用来将热处理

上存在环路的网络,通过一种算法,在逻辑上断开一些端口,来生成一个逻

辑上的树形结构.

生成树算法:
1)选择根网桥(Root Bridge):选择根网桥的依据是网桥ID
2)选择根端口(Root Ports):依据顺序依次是’到根网桥最低成本的根路

径成本,直连网桥ID最小,端口ID最小’
3)选择指定端口(Designeted Ports):依据’根路径成本较低,所以的交换

机的网桥ID的值较小,端口的值较小’

STP状态:
转发(Forwarding) 发送/接收用户数据
学习(Learning)  构建网桥表
侦听(Listening)  构建”活动”拓扑
阻塞(Blockink)  只接收BPDU
禁用(Disabled)  强制关闭

Cisco的生成树(PVST)为每个VLAN使用独立的一个生成树实例,能优化根

桥的位置,能为所有的VLAN提供最优路径

PVST与IEEE的CST不兼容,使得运行PVST的Cisco交换机不能与其厂家的交

换机相互操作.

PVST配置命令:
1,启用生成树:
Switch(config)#spanning-tree vlan vlan-list
2,配置根网桥:
Switch(config)#spanning-tree vlan vlan-list root primary |

secondary
3,修改网桥的优先级:
Switch(config)#spanning-tree vlan vlan-list priority Bridge-

priority
4,修改端口成本:
Switch(config)#spanning-tree vlan vlan-list cost cost
5,修改端口优先级:
Switch(config)#spanning-tree vlan vlan-list port-priority

priority
6,配置上行事链路:
Switch(config)#spanning-tree uplinkfast
7,配置速端口:
Switch(config)#spanning-tree portfast
8,查看生成树配置:
Switch#show spanning-tree
9,查看VLAN生成树的信息:
Switch#show spanning-tree vlan vlan-id detail
10,配置以太网通道:
Switch(config)#interface range fastEthernet 0/1 - 2
Switch(config-if-range)#channel-group 1 mode on
11,查看通道配置信息:
Switch#show etherchannel 1 summary

Posted by admin in 好友圈子 - Comments (0)
1 07月

VTP协议

 

VTP协议优点:
1)保持VLAN配置的一致性
2)提供从一个交换机在整个管理域中增加虚拟局域网的方法

VTP的两种重要概念:
VTP域:VLAN管理域,由一个以上共享VTP域名的相互连接的交换机组成
VTP通告:在交换机之间用来传递VLAN信息的数据包

VTP域要求:
1)每台交换机必须使用相同的域名
2)交换机必须是相邻的
3)交换机之间必须启用中继

VTP三种模式:
1)服务器模式(server):充当VTP服务器的交换机控制着它所在域中VLAN

的生成和修改
客户机模式(client):不允许管理员创建,修改或删除VLAN
透明模式(transparent):不参与VTP

VTP版本号:版本1和版本2,版本2支持令牌环和令牌住环VLAN

VTP三种通告消息:
1)通告请求:客户机请求VLAN信息,服务器以汇总和子集通告作为回应
2)汇总通告:在VLAN 1上,每隔300S进行一次,每当拓扑发生改变时,也会

发出该通告
3)子集通告:包含与VLAN有关的详细信息

VTP修剪(VTP Pruning):减少中继端口上不必要的广播信息流量,提高中

继链路的带宽利用率

VTP的配置命令

1,配置域名:
switch(config)#vtp domain domain_name
2,配置VTP模式:
switch(config)#vtp mode server | client | transparent
3,配置VTP口令:
switch(config)#vtp password password
4,配置VTP修剪:
switch(config)#vtp pruning
5,配置VTP版本:
switch(config)#vtp version 2
6,查看VTP的配置信息:
switch#show vtp status

1 07月

创建数据库表

创建数据库表模式:
Customers(CustomerID,Name,Address,City)
Orders(OrderID,CustomerID,Amount,Date)
Books(ISBN,Author,Title,Price)
Orders_Items(OrderID,ISBN,Quantity)
Book_Reviews(ISBN,Reviews)

create tables customers
( customerid int unsigned not null auto_increment primary key,
name char(50) not null,
address char(100) not null,
city char(30) not null
);

create tables orders
( orderid int unsigned not null auto_increment primary key,
customerid int unsigned not null,
amount float(6,2),
date date not null
);

create table books
( isbn char(13) not null primary key,
 author char(50),
 title char(100),
price float(4,2)
);

create talbes order_items
(orderid int unsigned not null,
isbn char(13) not null,
quantity tinyint nusigned,
primary key (orderid,isbn)
);

create table book_reviews
(
isbn char(13) not null primary key,
review test
);

Posted by admin in mysql技术 - Comments (0)
11 06月