**概要设计**

战神咖按照业务功能分成以下几个分区:普通上网区、游戏区、包厢区、视频区、商务区,各个分区部署在不同VLAN。IP网段分别为172.16.1.0/24——172.16.5.0/24。网吧的客户机采用千兆接入局域网,交换机带有万兆上行接口。出于安全考虑,网吧部署了监控系统,并由PoE交换机集中供电,采集的视频存储于网络硬盘录像机供调取。根据需要网吧在CentOS6.5上架设了流媒体服务器用于存放电影,音乐和视频游戏,部署DHCP服务为各功能分区统一提供IP地址等管理。网管系统和计费系统采用单独的软件部署在Windows7上,采用硬件防火墙设置访问策略和过滤规则来优化网吧内外网环境,网吧采用100M电信和50M联通的双WAN出口规划,以实现冗余和流量均衡。
根据以上要求给出设计方案,设备选型,拓扑设计,IP规划,产品配置,应用服务器配置,设计结果验证。

                                                **网络设计拓扑图**

主要调试配置命令
1.1.接入层交换机配置:
sw3:
u t m
sys
sys sw3
vlan 10
int e0/0/3
port link-type acc
port default vlan 10
int g0/0/1
port link-type trunk
port trunk allow vlan 10
int g0/0/2
port link-type trunk
port trunk allow vlan 10
quit
stp enable
stp mode mstp
stp region-configuration
region-name huawei
instance 1 vlan 10 20 30
instance 2 vlan 40 50 60 70
active region-configuration
quit
int e0/0/3
stp edged-port enable
quit
stp bpdu-protection

sw4:
u t m
sys
sys sw4
vlan 20
int e0/0/3
port link-type acc
port default vlan 20
int g0/0/1
port link-type trunk
port trunk allow vlan 20
int g0/0/2
port link-type trunk
port trunk allow vlan 20
quit
stp enable
stp mode mstp
stp region-configuration
region-name huawei
instance 1 vlan 10 20 30
instance 2 vlan 40 50 60 70
active region-configuration
quit
int e0/0/3
stp edged-port enable
quit
stp bpdu-protection

sw5:
u t m
sys
sys sw5
vlan 30
int e0/0/3
port link-type acc
port default vlan 30
int g0/0/1
port link-type trunk
port trunk allow vlan 30
int g0/0/2
port link-type trunk
port trunk allow vlan 30
quit
stp enable
stp mode mstp
stp region-configuration
region-name huawei
instance 1 vlan 10 20 30
instance 2 vlan 40 50 60 70
active region-configuration
quit
int e0/0/3
stp edged-port enable
quit
stp bpdu-protection

sw6:
u t m
sys
sys sw6
vlan 40
int e0/0/3
port link-type acc
port default vlan 40
int g0/0/1
port link-type trunk
port trunk allow vlan 40
int g0/0/2
port link-type trunk
port trunk allow vlan 40
quit
stp enable
stp mode mstp
stp region-configuration
region-name huawei
instance 1 vlan 10 20 30
instance 2 vlan 40 50 60 70
active region-configuration
quit
int e0/0/3
stp edged-port enable
quit
stp bpdu-protection

sw7:
u t m
sys
sys sw7
vlan 50
int e0/0/3
port link-type acc
port default vlan 50
int g0/0/1
port link-type trunk
port trunk allow vlan 50
int g0/0/2
port link-type trunk
port trunk allow vlan 50
quit
stp enable
stp mode mstp
stp region-configuration
region-name huawei
instance 1 vlan 10 20 30
instance 2 vlan 40 50 60 70
active region-configuration
quit
int e0/0/3
stp edged-port enable
quit
stp bpdu-protection

sw8:
u t m
sys
sys sw8
vlan 60
int e0/0/3
port link-type access
port default vlan 60
int G0/0/1
port link-type trunk
port trunk allow vlan 60
int G0/0/2
port link-type trunk
port trunk allow vlan 60
quit
stp enable
stp mode mstp
stp region-configuration
region-name huawei
instance 1 vlan 10 20 30
instance 2 vlan 40 50 60 70
active region-configuration
quit
int e0/0/3
stp edged-port enable
quit
stp bpdu-protection

sw9:
u t m
sys
sys sw9
vlan 70
int e0/0/3
port link-type access
port default vlan 70
int G0/0/1
port link-type trunk
port trunk allow vlan 70
int G0/0/2
port link-type trunk
port trunk allow vlan 70
quit
stp enable
stp mode mstp
stp region-configuration
region-name huawei
instance 1 vlan 10 20 30
instance 2 vlan 40 50 60 70
active region-configuration
quit
int e0/0/3
stp edged-port enable
quit
stp bpdu-protection

1.2.流媒体服务器:
R1:
u t m
sys
sys zhanshen
dhcp enable
ip pool 10
gateway-list 172.16.1.254
network 172.16.1.0 mask 24
excluded-ip-address 172.16.1.253
lease day 3 hour 0 minute 0
dns-list 202.101.224.101
ip pool 20
gateway-list 172.16.2.254
network 172.16.2.0 mask 24
excluded-ip-address 172.16.2.253
lease day 3 hour 0 minute 0
dns-list 202.101.224.101
ip pool 30
gateway-list 172.16.3.254
network 172.16.3.0 mask 24
excluded-ip-address 172.16.3.253
lease day 3 hour 0 minute 0
dns-list 202.101.224.101
ip pool 40
gateway-list 172.16.4.254
network 172.16.4.0 mask 24
excluded-ip-address 172.16.4.253
lease day 3 hour 0 minute 0
dns-list 202.101.224.101
ip pool 50
gateway-list 172.16.5.254
network 172.16.5.0 mask 24
excluded-ip-address 172.16.5.253
lease day 3 hour 0 minute 0
dns-list 202.101.224.101
interface g0/0/1
ip address 172.16.8.2 24
dhcp select global
ip route-static 172.16.1.0 24 172.16.8.1
ip route-static 172.16.2.0 24 172.16.8.1
ip route-static 172.16.3.0 24 172.16.8.1
ip route-static 172.16.4.0 24 172.16.8.1
ip route-static 172.16.5.0 24 172.16.8.1
ip route-static 202.101.224.0 24 172.16.8.1
ip route-static 182.84.89.0 24 172.16.8.1
interface g0/0/2
ip address 172.16.9.2 24
dhcp select global
ip route-static 172.16.1.0 24 172.16.9.1
ip route-static 172.16.2.0 24 172.16.9.1
ip route-static 172.16.3.0 24 172.16.9.1
ip route-static 172.16.4.0 24 172.16.9.1
ip route-static 172.16.5.0 24 172.16.9.1
ip route-static 202.101.224.0 24 172.16.9.1
ip route-static 182.84.89.0 24 172.16.9.1

1.3.汇聚层交换机配置:
sw1:
u t m
sys
sys sw1
vlan batch 10 20 30 40 50 60 70 80 90
int g0/0/1
port link-type trunk
port trunk allow vlan 10
int g0/0/2
port link-type trunk
port trunk allow vlan 20
int g0/0/3
port link-type trunk
port trunk allow vlan 30
int g0/0/4
port link-type trunk
port trunk allow vlan 40
int g0/0/5
port link-type trunk
port trunk allow vlan 50
int g0/0/6
port link-type trunk
port trunk allow vlan 60
int vlanif60
ip add 172.16.6.254 24
int g0/0/7
port link-type trunk
port trunk allow vlan 70
int vlanif70
ip add 172.16.7.254 24
int g0/0/11
port link-type access
port default vlan 80
int vlanif80
ip add 172.16.8.1 24
int g0/0/8
port link-type access
port default vlan 90
int vlanif90
ip add 172.16.10.2 24
quit
ip route-static 0.0.0.0 0.0.0.0 172.16.10.1
dhcp enable
dhcp server group DHCP10
dhcp-server 172.16.8.2
interface vlanif10
ip add 172.16.1.254 24
dhcp select relay
dhcp relay server-select DHCP10
dhcp server group DHCP20
dhcp-server 172.16.8.2
interface vlanif20
ip add 172.16.2.254 24
dhcp select relay
dhcp relay server-select DHCP20
dhcp server group DHCP30
dhcp-server 172.16.8.2
interface vlanif30
ip add 172.16.3.254 24
dhcp select relay
dhcp relay server-select DHCP30
dhcp server group DHCP40
dhcp-server 172.16.8.2
interface vlanif40
ip add 172.16.4.254 24
dhcp select relay
dhcp relay server-select DHCP40
dhcp server group DHCP50
dhcp-server 172.16.8.2
interface vlanif50
ip add 172.16.5.254 24
dhcp select relay
dhcp relay server-select DHCP50
stp enable
stp mode mstp
stp region-configuration
region-name zhanshen
instance 1 vlan 10 to 30
instance 2 vlan 40 to 70
active region-configuration
quit
stp instance 1 root primary
stp instance 2 root secondary
int eth-trunk 1
int g0/0/9
eth-trunk 1
int g0/0/10
eth-trunk 1
int eth-trunk 1
port link-type trunk
port trunk allow-pass vlan all
quit
int vlanif10
vrrp vrid 1 virtual-ip 172.16.1.253
vrrp vrid 1 priority 150
vrrp vrid 1 preempt-mode timer delay 5
vrrp vrid 1 track interface g0/0/8 reduced 80
vrrp vrid 1 track interface g0/0/11 reduced 80
int vlanif20
vrrp vrid 2 virtual-ip 172.16.2.253
vrrp vrid 2 priority 150
vrrp vrid 2 preempt-mode timer delay 5
vrrp vrid 2 track interface g0/0/8 reduced 80
vrrp vrid 2 track interface g0/0/11 reduced 80
int vlanif30
vrrp vrid 3 virtual-ip 172.16.3.253
vrrp vrid 3 priority 150
vrrp vrid 3 preempt-mode timer delay 5
vrrp vrid 3 track interface g0/0/8 reduced 80
vrrp vrid 3 track interface g0/0/11 reduced 80
int vlanif40
vrrp vrid 4 virtual-ip 172.16.4.253
int vlanif50
vrrp vrid 5 virtual-ip 172.16.5.253
int vlanif60
vrrp vrid 6 virtual-ip 172.16.6.253
int vlanif70
vrrp vrid 7 virtual-ip 172.16.7.253
quit
ospf router-id 1.1.1.1
area 0
network 172.16.10.0 0.0.0.255
quit
ospf router-id 2.2.2.2
area 1
network 172.16.1.0 0.0.0.255
network 172.16.2.0 0.0.0.255
network 172.16.3.0 0.0.0.255
network 172.16.4.0 0.0.0.255
network 172.16.5.0 0.0.0.255
network 172.16.6.0 0.0.0.255
network 172.16.7.0 0.0.0.255
ospf router-id 4.4.4.4
area 3
network 172.16.8.0 0.0.0.255

sw2:
u t m
sys
sys sw2
vlan batch 10 20 30 40 50 60 70 80 90
int g0/0/1
port link-type trunk
port trunk allow vlan 10
int g0/0/2
port link-type trunk
port trunk allow vlan 20
int g0/0/3
port link-type trunk
port trunk allow vlan 30
int g0/0/4
port link-type trunk
port trunk allow vlan 40
int g0/0/5
port link-type trunk
port trunk allow vlan 50
int g0/0/6
port link-type trunk
port trunk allow vlan 60
int vlanif60
ip add 172.16.6.254 24
int g0/0/7
port link-type trunk
port trunk allow vlan 70
int vlanif70
ip add 172.16.7.254 24
int g0/0/11
port link-type access
port default vlan 80
int vlanif80
ip add 172.16.9.1 24
int g0/0/8
port link-type access
port default vlan 90
int vlanif90
ip add 172.16.11.2 24
quit
ip route-static 0.0.0.0 0.0.0.0 172.16.11.1
dhcp enable
dhcp server group DHCP10
dhcp-server 172.16.9.2
interface vlanif10
ip add 172.16.1.254 24
dhcp select relay
dhcp relay server-select DHCP10
dhcp server group DHCP20
dhcp-server 172.16.9.2
interface vlanif20
ip add 172.16.2.254 24
dhcp select relay
dhcp relay server-select DHCP20
dhcp server group DHCP30
dhcp-server 172.16.9.2
interface vlanif30
ip add 172.16.3.254 24
dhcp select relay
dhcp relay server-select DHCP30
dhcp server group DHCP40
dhcp-server 172.16.9.2
interface vlanif40
ip add 172.16.4.254 24
dhcp select relay
dhcp relay server-select DHCP40
dhcp server group DHCP50
dhcp-server 172.16.9.2
interface vlanif50
ip add 172.16.5.254 24
dhcp select relay
dhcp relay server-select DHCP50
stp enable
stp mode mstp
stp region-configuration
region-name zhanshen
instance 1 vlan 10 to 30
instance 2 vlan 40 to 70
active region-configuration
quit
stp instance 2 root primary
stp instance 1 root secondary
quit
int eth-trunk 1
int g0/0/9
eth-trunk 1
int g0/0/10
eth-trunk 1
int eth-trunk 1
port link-type trunk
port trunk allow-pass vlan all
quit
int vlanif10
vrrp vrid 1 virtual-ip 172.16.1.253
int vlanif20
vrrp vrid 2 virtual-ip 172.16.2.253
int vlanif30
vrrp vrid 3 virtual-ip 172.16.3.253
int vlanif40
vrrp vrid 4 virtual-ip 172.16.4.253
vrrp vrid 4 priority 150
vrrp vrid 4 preempt-mode timer delay 5
vrrp vrid 4 track interface g0/0/8 reduced 80
vrrp vrid 4 track interface g0/0/11 reduced 80
int vlanif50
vrrp vrid 5 virtual-ip 172.16.5.253
vrrp vrid 5 priority 150
vrrp vrid 5 preempt-mode timer delay 5
vrrp vrid 5 track interface g0/0/8 reduced 80
vrrp vrid 5 track interface g0/0/11 reduced 80
int vlanif60
vrrp vrid 6 virtual-ip 172.16.6.253
vrrp vrid 6 priority 150
vrrp vrid 6 preempt-mode timer delay 5
vrrp vrid 6 track interface g0/0/8 reduced 80
vrrp vrid 6 track interface g0/0/11 reduced 80
int vlanif70
vrrp vrid 7 virtual-ip 172.16.7.253
vrrp vrid 7 priority 150
vrrp vrid 7 preempt-mode timer delay 5
vrrp vrid 7 track interface g0/0/8 reduced 80
vrrp vrid 7 track interface g0/0/11 reduced 80
quit
ospf router-id 1.1.1.1
area 0
network 172.16.11.0 0.0.0.255
quit
ospf router-id 3.3.3.3
area 2
network 172.16.1.0 0.0.0.255
network 172.16.2.0 0.0.0.255
network 172.16.3.0 0.0.0.255
network 172.16.4.0 0.0.0.255
network 172.16.5.0 0.0.0.255
network 172.16.6.0 0.0.0.255
network 172.16.7.0 0.0.0.255
ospf router-id 4.4.4.4
area 3
network 172.16.9.0 0.0.0.255
1.4.防火墙配置:
FW:
u t m
sys
sysname firewall
int g0/0/1
ip add 172.16.10.1 24
int g0/0/2
ip add 172.16.11.1 24
int g0/0/3
ip add 202.101.224.100 24
int g0/0/4
ip add 182.84.89.100 24
quit
firewall zone trust
add interface GigabitEthernet0/0/1
add interface GigabitEthernet0/0/2
quit
firewall zone untrust
add interface GigabitEthernet0/0/3
add interface GigabitEthernet0/0/4
quit
ospf 1.1.1.1
area 0
network 172.16.10.0 0.0.0.255
network 172.16.11.0 0.0.0.255
quit
ip route-static 172.16.0.0 16 172.16.10.2
ip route-static 172.16.0.0 16 172.16.11.2
ip route-static 0.0.0.0 0.0.0.0 202.101.224.68
ip route-static 0.0.0.0 0.0.0.0 182.84.89.171
nat address-group 1 202.101.224.101 202.101.224.105
nat address-group 2 182.84.89.101 182.84.89.105
nat-policy interzone trust untrust outbound
policy 1
action source-nat
policy source 172.16.1.0 0.0.0.255
policy source 172.16.2.0 0.0.0.255
policy source 172.16.3.0 0.0.0.255
policy source 172.16.4.0 0.0.0.255
policy source 172.16.5.0 0.0.0.255
address-group 1
quit
policy 1 enable
quit
policy interzone trust untrust outbound
policy 1
action permit
policy source 172.16.1.0 0.0.0.255
policy source 172.16.2.0 0.0.0.255
policy source 172.16.3.0 0.0.0.255
policy source 172.16.4.0 0.0.0.255
policy source 172.16.5.0 0.0.0.255
policy destination any
quit
policy 1 enable
quit
nat-policy interzone trust untrust outbound
policy 2
action source-nat
policy source 172.16.6.0 0.0.0.255
policy source 172.16.7.0 0.0.0.255
policy source 172.16.8.0 0.0.0.255
policy source 172.16.9.0 0.0.0.255
address-group 2
quit
policy 2 enable
quit
policy interzone trust untrust outbound
policy 2
action permit
policy source 172.16.6.0 0.0.0.255
policy source 172.16.7.0 0.0.0.255
policy source 172.16.8.0 0.0.0.255
policy source 172.16.9.0 0.0.0.255
policy destination any
quit
policy 2 enable
quit
policy interzone trust untrust inbound
policy 2
action permit
policy destination 172.16.8.0 0.0.0.255
policy destination 172.16.9.0 0.0.0.255
quit
policy 1 enable
quit
nat server 1 protocol tcp global 202.101.224.68 ftp inside 172.16.8.2 ftp
nat server 2 protocol tcp global 182.84.89.100 www inside 172.16.9.2 www
1.5.电信联通:
R2:
u t m
sys
sys dianxin
int g0/0/1
ip add 202.101.224.68 24
R3:
u t m
sys
sys liantong
int g0/0/1
ip add 182.84.89.171 24

应用服务的功能配置
一、CentOS 6.5下的dhcp服务:
1、安装CentOS6.5:
修改网卡地址为静态
#vi /etc/sysconfig/network-scripts/ifcfg-eth0
ONBOOT=yes
IPADDR=192.168.177.177
PREFIX=16
GATEWAY=192.168.198.2
BOOTPROTO=static
DNS1=202.101.224.68
#service network restart
#service iptables stop
#sed -I ‘SELINUX=enforcing/SELINUX=disabled/g’ /etc/selinux/config
1、查询并安装DHCP服务

rpm -qa | grep dhcp

#yum -y install dhcp*
2、修改DHCP的配置文件
#cp -p /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcpd.conf
cp:overwrit’/etc/dhcp/dhcp.conf’? y
#vi /etc/dhcp/dhcpd.conf //在命令模式下,按下G 到最后一行,添加:

subnet 172.16.1.0 netmask 255.255.255.0 {
range 172.16.1.1 172.16.1.253;
option domain-name-servers 202.101.224.68;
option domain-name “zhanshenwangka.com”;
option routers 172.16.1.254;
option broadcast-address 172.16.1.255;
default-lease-time 600;
max-lease-time 7200;
}
subnet 172.16.2.0 netmask 255.255.255.0 {
range 172.16.2.1 172.16.2.253;
option domain-name-servers 202.101.224.68;
option domain-name “zhanshenwangka.com”;
option routers 172.16.2.254;
option broadcast-address 172.16.2.255;
default-lease-time 600;
max-lease-time 7200;
}
subnet 172.16.3.0 netmask 255.255.255.0 {
range 172.16.3.1 172.16.3.253;
option domain-name-servers 202.101.224.68;
option domain-name “zhanshenwangka.com”;
option routers 172.16.3.254;
option broadcast-address 172.16.3.255;
default-lease-time 600;
max-lease-time 7200;
}
subnet 172.16.4.0 netmask 255.255.255.0 {
range 172.16.4.1 172.16.4.253;
option domain-name-servers 202.101.224.68;
option domain-name “zhanshenwangka.com”;
option routers 172.16.4.254;
option broadcast-address 172.16.4.255;
default-lease-time 600;
max-lease-time 7200;
}
subnet 172.16.5.0 netmask 255.255.255.0 {
range 172.16.5.1 172.16.5.253;
option domain-name-servers 202.101.224.68;
option domain-name “zhanshenwangka.com”;
option routers 172.16.5.254;
option broadcast-address 172.16.5.255;
default-lease-time 600;
max-lease-time 7200;
}
3、启动DHCP服务,查询相关进程和端口
修改完配置文件后,需要重启DHCP服务
#service dhcpd restart //重启DHCP的服务
#chkconfig --level 35 dhcpd on //配置在相关的运行级别上启动DHCP
#ps -aux | grep dhcpd //查询DHCP进程
#netstat -aultp | grep dhcpd //查询DHCP服务端口号 服务器端 67
#pgrep dhcpd //客户端 68
4、DHCP客户端验证
设置DHCP主机网络连接模式为VMnet1,再用一台主机设置网络连接模式为VMnet1,编辑网卡配置
#vi /etc/sysconfig/network-scripts/ifcfg-eth0
ONBOOT=yes
BOOTPROTO=dhcp
其他的不用加,然后
#ifconfig -a
就能看到获取到的IP了。
在windows主机的网卡上设置,自动获取IP和自动获取DNS
或者 c:>ipconfig /release
ipconfig /renew
服务器端查询地址租约数据库
#cat /var/lib/dhcpd/dhcpd.leases
#tail -n 10 /var/lib/dhcp/dhcpd.leases
二、流媒体服务安装
yum -y install gcc gcc-c++ glibc glibc-devel make nasm pkgconfig lib-devel openssl-devel expat-devel gettext-devel libtool mhash.x86_64 perl-Digest-SHA1.x86_64 git wget autoconf automake
#cd /usr/local/src
用wget 添加下面的网址
下载nginx http://nginx.org/download/nginx-1.6.2.tar.gz下载pcre (支持nginx伪静态)
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.36.tar.gz
下载openssl(nginx扩展) http://www.openssl.org/source/openssl-1.0.1j.tar.gz
下载zlib(nginx扩展) http://zlib.net/zlib-1.2.8.tar.gz
#git clone https://github.com/arut/nginx-rtmp-module.git 我是直接用下载好的镜像包安装的
1、安装pcre

cd /usr/local/src

mkdir /usr/local/pcre

mkdir /usr/local/pcre

tar zxvf pcre-8.36.tar.gz

cd pcre-8.36

#./configure --prefix=/usr/local/pcre && make && make install
2、安装openssl
#cd /usr/local/src
#mkdir /usr/local/openssl
#tar zxvf openssl-1.0.1j.tar.gz
#cd openssl-1.0.1j
#./config --prefix=/usr/local/openssl && make && make install
#vi /etc/profile
#export PATH=$PATH:/usr/local/openssl/bin
#source /etc/profile
2、安装zlib
#cd /usr/local/src
#mkdir /usr/local/zlib
#tar zxvf zlib-1.2.8.tar.gz
#cd zlib-1.2.8
#./configure --prefix=/usr/local/zlib && make && make install
4、安装nginx
#cd /usr/local/src
#tar zxvf nginx-1.6.2.tar.gz
#cd nginx-1.6.2
#./configure --prefix=/usr/local/nginx --without-http_memcached_module --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-openssl=/usr/local/src/openssl-1.0.1j --with-zlib=/usr/local/src/zlib-1.2.8 --with-pcre=/usr/local/src/pcre-8.36 --add-module=/usr/local/src/nginx-rtmp-module
注意:–with-openssl=/usr/local/src/openssl-1.0.1j --with-zlib=/usr/local/src/zlib-1.2.8 --with-pcre=/usr/local/src/pcre-8.36指向的是源码包解压的路径,而不是安装的路径,否则报错
#make && make install
#/usr/local/nginx/sbin/nginx //启动Nginx
设置nginx开机启动
#vi /etc/rc.d/init.d/nginx //编辑启动文件添加下面内容
#!/bin/sh

#nginx - this script starts and stops the nginx daemon

#chkconfig: - 85 15
#description: Nginx is an HTTP(S) server, HTTP(S) reverse \
#proxy and IMAP/POP3 proxy server
#processname: nginx
#config: /etc/nginx/nginx.conf
#config: /usr/local/nginx/conf/nginx.conf
#pidfile: /usr/local/nginx/logs/nginx.pid
#Source function library.
. /etc/rc.d/init.d/functions
#Source networking configuration.
. /etc/sysconfig/network
#Check that networking is up.
[ “KaTeX parse error: Expected 'EOF', got '&' at position 22: …KING" = "no" ] &̲& exit 0 nginx…(basename KaTeX parse error: Expected 'EOF', got '&' at position 88: …config/nginx ] &̲& . /etc/syscon…nginx -V 2>&1 | grep “configure arguments:” | sed ‘s/[*]*–user=([ ])./\1/g’ -if [ -z "grep $user /etc/passwd" ]; then useradd -M -s /bin/nologin $user fi options=$nginx -V 2>&1 | grep 'configure arguments:'for opt in $options; do if [echo $opt | grep '.*-temp-path’]; then value=echo opt∣cut−d"="−f2‘if[!−d"opt | cut -d "=" -f 2` if [ ! -d "opt∣cut−d"="−f2‘if[!−d"value” ]; then
#echo “creating” $value
mkdir -p $value && chown -R $user $value
fi
fi
done
}
start() {
[ -x $nginx ] || exit 5
[ -f $NGINX_CONF_FILE ] || exit 6
make_dirs
echo -n $"Starting $prog: "
daemon $nginx -c NGINXCONFFILEretval=NGINX_CONF_FILE retval=NGINXC​ONFF​ILEretval=?
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
}
stop() {
echo -n $"Stopping $prog: "
killproc prog−QUITretval=prog -QUIT retval=prog−QUITretval=?
echo
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
}
restart() {
#configtest || return $?
stop
sleep 1
start
}
reload() {
#configtest || return $?
echo -n $"Reloading $prog: "
killproc nginx−HUPRETVAL=nginx -HUP RETVAL=nginx−HUPRETVAL=?
echo
}
force_reload() {
restart
}
configtest() {
$nginx -t -c $NGINX_CONF_FILE
}
rh_status() {
status $prog
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
case “$1” in
start)
rh_status_q && exit 0
$1
;;
stop)
rh_status_q || exit 0
$1
;;
restart|configtest)
$1
;;
reload)
rh_status_q || exit 7
$1
;;
force-reload)
force_reload
;;
status)
rh_status
;;
condrestart|try-restart)
rh_status_q || exit 0
;;
*)
echo $“Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}”
exit 2
esac
#chmod 775 /etc/rc.d/init.d/nginx //赋予文件执行权限
#chkconfig nginx on //设置开机启动
#/etc/rc.d/init.d/nginx restart //重启
#vi /usr/local/nginx/conf/nginx.conf
在浏览器中打开服务器IP地址:192.168.177.177,可以看到下面的结果。

编辑原有的nginx.conf中加入如下配置:
#vi /usr/local/nginx/conf/nginx.conf
rtmp {
server {
listen 192.168.177.177:1935;
chunk_size 4000;
#HLS
# For HLS to work please create a directory in tmpfs (/tmp/app here)
# for the fragments. The directory contents is served via HTTP (see
# http{} section in config)
#
# Incoming stream must be in H264/AAC. For iPhones use baseline H264
# profile (see ffmpeg example).
# This example creates RTMP stream from movie ready for HLS:
#
# ffmpeg -loglevel verbose -re -i movie.avi -vcodec libx264
# -vprofile baseline -acodec libmp3lame -ar 44100 -ac 1
# -f flv rtmp://localhost:1935/hls/movie
#
# If you need to transcode live stream use ‘exec’ feature.
#
application hls {
live on;
hls on;
hls_path /usr/local/nginx/html/hls;
hls_fragment 5s;
}
}
}
http {
server {
listen 8080;
location /hls {
# Serve HLS fragments
types {
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}
root html;
expires -1;
}
}
}

其中rtmp部分与原有的http部分在同一个级别,但是下面的http部分要放到已有的http部分中,也就是增加一个server部分。
然后运行如下命令检查nginx.conf是否有语法错误
service nginx configtest
重新加载配置文件
service nginx reload
运行下面的命令查看nginx状态
service nginx status
注意,这里reload并不能开启这几个服务,需要使用
service nginx restart
将rtmp服务和hls服务的端口1935和8080都打开
然后查看端口
netstat -nlp
一定要关闭防火墙,不然obs连不上
5.下载一个obs程序用于推流,或者在安装的时候添加安装FFmpeg用于推流
方法:在设置-串流里填上:rtmp://192.168.177.177:1935/hls,密钥就填你要推送的文件或电影名,我填的是:movie,然后就在浏览器里输入:http://192.168.177.177:8080/hls/movie.m3u8 ,就能看到推送的东西了。

网咖网络规划与安装流媒体服务器相关推荐

  1. 计算机网络中型网吧规划设计,中小型网咖网络规划设计开题报告

    [1]陈孝如.计算机无线网络安全技术应用研究[J].计算机产品与流通,2019(10):14+83. [2]刘宗凡,邱元阳,倪俊杰,杨磊,金琦.深入了解无线路由器[J].中国信息技术教育,2019(1 ...

  2. windows server 2008R2服务端上安装流媒体服务器

    服务器配置: 什么是流媒体服务呢. 所谓流媒体是指采用流式传输的方式在Internet播放的媒体格式, 与需要将整个视频文件全部下载之后才能观看的传统方式相比, 流媒体技术是通过将视频文件经过特殊的压 ...

  3. rtsp转rtmp服务linux,ubuntu安装流媒体服务器(nginx+rtmp,rtsp转rtmp,rtsp转m3u8)

    在 ubuntu server 14 安装流程 1.先下载安装  nginx 和 nginx-rtmp 编译依赖工具 sudo apt-get install build-essential libp ...

  4. 家用无盘服务器打游戏,开20台的电竞网咖酒店,无盘服务器用千兆网卡够用吗?...

    日前,电竞酒店的网咖模式发展迅速,很多萌新甚至是老司机想试水一波电竞酒店模式的网咖,或者说就电竞网咖模式的酒店吧.咱们先不说这个经营模式哈,咱们今天要讨论的是一般电竞网咖,酒店模式,电脑不会多吧.可能 ...

  5. 在阿里云ECS上安装流媒体服务器软件Ti Top Streamer

    一.产品概述 Ti Top Streamer是一个流媒体服务器软件,支持多种视频流传输协议.支持多协议分发和转推,拥有漂亮而优雅的管理界面,支持中英双语切换,具备丰富的Http Rest API. T ...

  6. 监控摄像头接入流媒体服务器的几种方式

    为什么要接入流媒体服务器 我们知道,在一些小的应用场合,如社区.中小企业.商超店铺等,布置监控系统并不需要流媒体服务器,直接将摄像头接入硬盘录像机即可. 但是,在一些大型应用场合或一些新型应用场景中, ...

  7. 阿里云搭建流媒体服务器

    最近不少人问是否能够将云视睿博流媒体服务器NTV Media Server G3搭建在阿里云服务器上,答案是肯定的,而且我们大部分客户都是这样用的,利用流媒体服务器的视频处理和播出能力,以及阿里云的基 ...

  8. NTV Media Server G3流媒体服务器搭建经验

    系统要求 最低要求: 操作系统:  64位CentOS 6.4或更高版本 / Red Hat Enterprise Linux Server CPU:      Intel双核 2.0GHz 内存: ...

  9. crtmpserver 配置说明_crtmpserver 流媒体服务器 集群 安装配置

    red5单机还是比较不错的,但是官方网站没有文档,不知道集群怎么配置,网查找了半天,只有red5 0.8版本有集群配置.以后的版本看了一下,有集群的插件,但是不知道怎么装插件,就算装好了插件,怎么配置 ...

最新文章

  1. python提升计算速度的方法
  2. python输入hello*3_Python3基础(一) Hello World
  3. Android StageFrightMediaScanner源码解析
  4. OpenCASCADE:拓扑 API之简介
  5. 怎么用python读取大文件_使用Python读取大文件的方法
  6. 基于Consul的分布式锁实现
  7. Oracle 创建表空间、用户、权限_(plsql)
  8. 东莞 小学计算机编程大赛,关于举办第二十一届东莞市中小学电脑制作活动的通知...
  9. asp/php招聘,招聘ASP与PHP相关岗位的笔经
  10. ArcGIS 后台服务器抛出异常
  11. Unity3D 2018安装教程
  12. webx框架升级springboot遇到的问题及解决方案
  13. 不是局域网计算机远程桌面连接,开启局域网远程桌面连接不上怎么办
  14. Unicode中文和特殊字符的编码范围 及部分正则
  15. 传感器课程实验:Pt100 铂电阻测温特性实验
  16. 什么是ARM开发板及其硬件特性介绍
  17. spring boot大学体育赛事管理系统 毕业设计-附源码180923
  18. 荒野行动8月1日服务器维护,荒野行动手游12月21日服务器维护到几点 12月21日具体开服时间公告...
  19. 负对数似然 交叉熵 mse mae的区别
  20. 超详细的AD8031ARZ介绍,就在这里

热门文章

  1. mysql要求cpu主频还是核数_CPU主频和核数哪个重要 CPU高主频好还是多核数好
  2. 极限运算中的一个经典例题
  3. Java一个16进制字符占多少个字节
  4. Marble Map
  5. 阿里云国际站版注册教程
  6. cocos2dx游戏开发——微信打飞机学习笔记(七)——Enemy的搭建
  7. 算法复杂度分析中的符号(大Θ符号、大Ο符号...)
  8. win10清理_win10的这款独立清理工具,太好用了!
  9. Book——电力系统规划与可靠性
  10. java初级atm取款机,java基础:模拟ATM取款机