linux搭建挂机宝教程,nokvm – 单ip搭建挂机宝详细教程
nokvm 介紹:
全國首家免費的私有云計算虛擬化管理系統一款強大的基于Web的虛擬化控制面板。 管理員可以通過點擊按鈕即時創建主機,用戶可以使用非常高級的基于Web的GUI來啟動,停止,重新啟動和管理他們的主機。 用戶和管理員可以更好地管理其資源。下面教大家如果搭建單ip掛機寶。
單ip掛機寶和開一臺轉發機步驟類似:
雙ip掛機寶教程請移步:
單ip掛機寶 如果被ddos 母雞會直接癱瘓。建議選擇高防ip,
1、首先開一臺轉發機,設定的ssh密碼一定要和宿主機ssh密碼一致。
2、強制關閉這臺轉發機器電源(用不到了但是也不可以刪除)。
3、登錄宿主機執行 virsh autostart –disable ****? (****是你第一個機器名字 比如我們測試機名字是:ecs-heTqk 就輸入?virsh autostart –disable?ecs-heTqk) (取消開機自啟動)
4、ssh登錄主控,連接control數據庫,修改ip_address表 找到分配給這臺轉發機的ip 修改為宿主機的ip (這樣 ip 和 密碼都和宿主機一致了 也就相當于ssh遠程連接到宿主機執行命令)
1)查看數據庫密碼?cat /home/wwwroot/control/.env?DB_PASSWORD 字段就是數據庫密碼
2)連接數據庫?mysql -uroot -p
然后輸入上面查詢到密碼
3)進入到control表?use control; (;一定要輸入)
4)修改轉發機ip為宿主機ip?查看表數據 : select * from ip_address;?(;一定要輸入)
update ip_address set ip='宿主機ip' where id=xxx;? (Id=xxx? xxx是IP ID 我是剛搭建的所以ID是 1??update ip_address set ip='宿主機ip' where id=1;)??(;一定要輸入)
(以下操作還在實驗中 ,上面的成功了 但是不能遠程 機器里面能上網)
5、在宿主機虛擬機數據目錄中(/home/nokvm/resource/轉發機名/change.sh),拷貝轉發機目錄的change.sh 并修改其內容 (網段不一定要按照我的來 可以自己劃分網段,使vps的網關指定為br0:0配置的ip地址)
cd /home/nokvm/resource/ecs-xxx/
cp change.sh modify.sh
// 修改過的樣例:
# cat modify.sh
ncf2=/etc/sysconfig/network-scripts/ifcfg-br0:0
/usr/bin/rm -rf $ncf2
/usr/bin/echo DEVICE=br0:0 >>$ncf2
/usr/bin/echo TYPE=Ethernet >>$ncf2
/usr/bin/echo BOOTPROTO=static >>$ncf2
/usr/bin/echo IPADDR=172.16.0.1 >>$ncf2
/usr/bin/echo NETMASK=255.255.248.0 >>$ncf2
/usr/bin/echo ONBOOT=yes >>$ncf2
systemctl restart network
ulimit -n 65535
/usr/bin/echo 'root soft nofile 65535' >> /etc/security/limits.conf
/usr/bin/echo 'root hard nofile 65535' >> /etc/security/limits.conf
/usr/bin/echo '* soft nofile 65535' >> /etc/security/limits.conf
/usr/bin/echo '* hard nofile 65535' >> /etc/security/limits.conf
/usr/bin/echo '* soft nproc 65535' >> /etc/security/limits.conf
/usr/bin/echo '* hard nproc 65535' >> /etc/security/limits.conf
/usr/bin/echo '* soft nofile 65535' >> /etc/security/limits.conf
/usr/bin/echo '* hard nofile 65535' >> /etc/security/limits.conf
/usr/bin/echo net.ipv4.ip_forward=1 >> /etc/sysctl.conf
/usr/sbin/sysctl -p
/usr/bin/wget -O /root/iptables-1.4.21-28.el7.x86_64.rpm http://down.tasiyun.com/soft/iptables-1.4.21-28.el7.x86_64.rpm
/usr/bin/wget -O /root/iptables-services-1.4.21-28.el7.x86_64.rpm http://down.tasiyun.com/soft/iptables-services-1.4.21-28.el7.x86_64.rpm
/usr/bin/rpm -i /root/iptables-1.4.21-28.el7.x86_64.rpm --nodeps
/usr/bin/rpm -i /root/iptables-services-1.4.21-28.el7.x86_64.rpm --nodeps
systemctl stop firewalld
systemctl disable firewalld
systemctl enable iptables
systemctl start iptables
iptables -F
iptables -X
iptables -Z
iptables -I INPUT -p tcp --dport 80 -j ACCEPT
iptables -I INPUT -p tcp --dport 8088 -j ACCEPT
iptables -I INPUT -p tcp --dport 443 -j ACCEPT
iptables -I INPUT -p tcp --dport 22 -j ACCEPT
iptables -t nat -A POSTROUTING -s 172.16.0.0/21 -o br0 -j MASQUERADE
iptables -A FORWARD -s 172.16.0.0/21 -o br0 -j ACCEPT
iptables -A FORWARD -d 172.16.0.0/21 -m state --state ESTABLISHED,RELATED -i br0 -j ACCEPT
service iptables save
/usr/bin/wget -O /root/nginx-1.16.0-1.el7.ngx.x86_64.rpm http://down.tasiyun.com/soft/nginx-1.16.0-1.el7.ngx.x86_64.rpm
/usr/bin/rpm -i /root/nginx-1.16.0-1.el7.ngx.x86_64.rpm --nodeps
/usr/bin/rm -rf /etc/nginx/nginx.conf
/usr/bin/rm -rf /root/nginx-1.16.0-1.el7.ngx.x86_64.rpm
/usr/bin/wget -O /etc/nginx/nginx.conf http://down.tasiyun.com/soft/nginx.conf
/usr/bin/systemctl start nginx
/usr/bin/systemctl enable nginx
6、在母雞執行修改過的腳本。
7、后面就是添加vps的ip池 網關指定br0:0的ip 子網自行劃分。
總結
以上是生活随笔為你收集整理的linux搭建挂机宝教程,nokvm – 单ip搭建挂机宝详细教程的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Note For Linux By Je
- 下一篇: ECharts 创建中国气泡地图和定位图