标签 reboot 下的文章

开启telnet

1.把光猫背后的光纤线拔掉,不然无法 telnet 进路由器
访问 http://192.168.1.1/hidden_version_switch.gch
在页面里 Version type 旁边的下拉框选择 Default version 点 submit ,这时光猫会重启
然后同样的操作再一次切换版本,这次切换到你所在的省份的版本,四川就选 SiChuan Version 以此类推
光猫重启好以后打开命令行客户端进行TELNET连接
用户名 root, 密码 Zte521(四川 Zte521@SC)

2.

sendcmd 1 DB set TelnetCfg 0 Lan_EnableAfterOlt 1 # 设置插上光纤后不自动关闭telnet)(这条一定要修改)
sendcmd 1 DB save # 保存设置
reboot # 重启光猫

关闭光猫注册界面

sendcmd 1 DB set PDTCTUSERINFO 0 tForcePushFlg 0
sendcmd 1 DB set PDTCTUSERINFO 0 Result 1
sendcmd 1 DB set CltLmt 8 Enable 0
sendcmd 1 DB set DevAuthInfo 0 Enable 1
sendcmd 1 DB save
reboot # 重启光猫生效

参考:

  1. https://gist.github.com/Malayke/d9636339af97132d1c0d5bcfbea2ec14
  2. https://www.right.com.cn/forum/forum.php?mod=redirect&goto=findpost&ptid=8251129&pid=17403160

1.查看分割区的编号
parted里面执行print

(parted) print                                                            
Model: QEMU QEMU HARDDISK (scsi)
Disk /dev/sda: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type      File system     Flags
 1      1049kB  4295MB  4294MB  primary   ext4            boot
 2      4296MB  9999MB  5703MB  extended
 5      4296MB  5368MB  1072MB  logical   linux-swap(v1)

2.删除多余的分割区

(parted) rm 2                                                             
Warning: Partition /dev/sda2 is being used. Are you sure you want to continue?
Yes/No? yes                                                               
Error: Partition(s) 5 on /dev/sda have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use.  As a result,
the old partition(s) will remain in use.  You should reboot now before making further changes.
Ignore/Cancel? Ignore                                                     
#再次查看分割区
(parted) print                                                            
Model: QEMU QEMU HARDDISK (scsi)
Disk /dev/sda: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  4295MB  4294MB  primary  ext4         boot

3.调整磁盘大小

(parted) resizepart                                                       
Partition number? 1                                                       
Warning: Partition /dev/sda1 is being used. Are you sure you want to continue?
Yes/No? yes                                                               
End?  [4295MB]? 100%                                                      
Error: Error informing the kernel about modifications to partition /dev/sda1 -- 设备或资源忙.  This means Linux won't know about any changes you made to /dev/sda1 until you
reboot -- so you shouldn't mount it or use it in any way before rebooting.
Ignore/Cancel? Ignore                                                     
Error: Partition(s) 5 on /dev/sda have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use.  As a result,
the old partition(s) will remain in use.  You should reboot now before making further changes.
Ignore/Cancel? Ignore

4.查看磁盘信息

root@:~# fdisk -l
Disk /dev/sda: 10 GiB, 10737418240 bytes, 20971520 sectors
Disk model: QEMU HARDDISK   
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xe0afa735

Device     Boot Start      End  Sectors Size Id Type
/dev/sda1  *     2048 20971519 20969472  10G 83 Linux
#/dev/sda1 已经由5G变成10G了

5.重启服务器
reboot
6.resize2fs /dev/sda1

root@:~# resize2fs /dev/sda1
resize2fs 1.44.5 (15-Dec-2018)
Filesystem at /dev/sda1 is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 2
The filesystem on /dev/sda1 is now 2621184 (4k) blocks long.

7.df -h

root@:~# df -h
文件系统        容量  已用  可用 已用% 挂载点
udev            480M     0  480M    0% /dev
tmpfs            99M  2.9M   96M    3% /run
/dev/sda1       9.8G  1.4G  8.0G   15% /
tmpfs           494M     0  494M    0% /dev/shm
tmpfs           5.0M     0  5.0M    0% /run/lock
tmpfs           494M     0  494M    0% /sys/fs/cgroup
tmpfs            99M     0   99M    0% /run/user/0

前端搭建

https://docs.v2board.com/deploy/aapanel.html
按照官方教程操作
避免出现问题 最好使用全新重装的系统按步骤操作 大佬随意
出现玄学的问题reboot重启vps也许就解决了

每次修改 .env 文件后需要执行以下命令重建缓存
php artisan config:cache

500错误尝试重新给予目录权限 在站点域名目录下执行
chown -R www:www *

后端搭建

https://github.com/ColetteContreras/v2ray-poseidon/wiki/0201-%E5%AF%B9%E6%8E%A5-V2board-%E6%95%99%E7%A8%8B

#一键脚本
curl -L -s https://raw.githubusercontent.com/ColetteContreras/v2ray-poseidon/master/install-release.sh | bash
#删除配置文件
rm /etc/v2ray/config.json
编辑配置文件
vi /etc/v2ray/config.json
重启v2ray
service v2ray restart

传输协议 伪装域名和路径的配置示例

{
    "path": "/路径",
    "headers": {
      "Host": "域名"
    }
}

换源

vi /etc/apt/sources.list

deb https://mirrors.ustc.edu.cn/debian stretch main contrib non-free
deb https://mirrors.ustc.edu.cn/debian stretch-updates main contrib non-free
deb https://mirrors.ustc.edu.cn/debian stretch-backports main contrib non-free
deb https://mirrors.ustc.edu.cn/debian-security/ stretch/updates main contrib non-free

apt-get update && apt-get upgrade

安装宝塔

https://www.feiji.work/2019/20.html
wget https://www.feiji.work/n1/bt/6.9.4/install.sh && sudo bash install.sh
安装完成可能有错误提示 直接reboot重启
查看面板入口:/etc/init.d/bt default

安装nginx

https://www.feiji.work/2019/41.html

打开ssh(注:如果以下步骤提示缺少文件,可以在宝塔后台执行一次安装Nginx,在下载完脚本后直接取消安装即可。)

cd /www/server/panel/install #如果目录存在nginx 先rm
wget https://www.feiji.work/n1/bt/nginx.sh 下载nginx.sh
sh nginx.sh install #直接安装

安装Nginx出现checking for GD library ... not found错误
https://de.lib.im/linux-gd.html
apt-get -y install libgd2-xpm-dev build-essential重新安装

报错Starting nginx... nginx: [emerg] getpwnam("www") failed in /www/server/nginx/conf/nginx.conf:1
https://blog.csdn.net/rebel_yangke/article/details/58601731
修改/www/server/nginx/conf/nginx.conf 两个www改成root 再重启

pppoe宽带拨号

https://xaolong.com/post/279.html
https://malagege.github.io/blog/2019/01/26/Linux%E4%BD%BF%E7%94%A8pppoe%E9%80%A3%E7%B7%9A%E6%96%B9%E6%B3%95%E5%B0%8F%E8%A8%98/

apt install pppoeconf -y
apt install isc-dhcp-server -y

vi /etc/default/isc-dhcp-server
#将INTERFACESv4=""修改为INTERFACESv4="br0"
#在INTERFACESv6=""的前面加个#,修改为#INTERFACESv6=""

mv /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf.bak

vi /etc/dhcp/dhcpd.conf  ###里面的所有内容
###
option domain-name "phicomm-n1";
option domain-name-servers 119.29.29.29;
subnet 192.168.1.0 netmask 255.255.255.0 {
    range 192.168.1.101 192.168.1.254;
    option subnet-mask 255.255.255.0;
    option broadcast-address 192.168.1.255;
    option routers 192.168.1.2;
    option domain-name-servers 119.29.29.29;
}
default-lease-time 600;
max-lease-time 7200;
authoritative;
###

vi /etc/network/interfaces
#iface eth0 inet dhcp 改为iface eth0 inet manual 后面增加以下内容 ###里面的全部 见图一
###
auto br0
iface br0 inet static
bridge_ports eth0
address 192.168.1.2
broadcast 192.168.1.255
network 192.168.1.0
netmask 255.255.255.0
gateway 192.168.1.2
bridge_stp off              
bridge_waitport 0           
bridge_fd 0
###

vi /etc/sysctl.conf
#去掉net.ipv4.ip_forward=1前面的#号

sysctl -p

vi  /etc/rc.local
#在 exit 0 前一行加以下内容
iptables -t nat -A POSTROUTING -j MASQUERADE

reboot

批注 2019-12-29 185147.png

n1接光猫 #n1已经固定IP 192.168.1.2

pppoeconf #进入拨号向导
#第一个选no
#删除username 输入宽带账号
#输入宽带密码
#之后全部 yes

poff -a # 關閉全部pppoe

查看状态
plog
ip addr show ppp0

开机自动拨号
vi /etc/rc.local #在 exit 0 前一行加一句:
pon dsl-provider

账号密码配置文件地址/etc/ppp/pap-secrets

动态域名解析dns

https://github.com/NewFuture/DDNS

git clone https://github.com/NewFuture/DDNS
cd DDNS
./run.py #运行一次 生成config.json配置文件
vi config.json #修改 id 域名 token
./task.sh

说明:inner-ss失效了,发现是dns解析的问题,ping域名的话直接unknown host。试了很多修改方法,reboot后就重置回去了。下面分享暂且有效的一种
vi /etc/resolv.conf直接修改这个文件重启就失效

nameserver 100.100.2.136
nameserver 100.100.2.138

甲骨文Debian 9 禁用DHCP分配的dns
参考:https://unix.stackexchange.com/questions/136117/ignore-dns-from-dhcp-server-in-ubuntu

vi /etc/dhcp/dhclient.conf
#最后添加一行
supersede domain-name-servers 1.1.1.1, 8.8.8.8;
dhclient

阿里云学生机Debian 8修改dns
vi /etc/network/interfaces #编辑文件
dns-nameservers 223.5.5.5 119.29.29.29 #添加一行DNS信息,两个dns之间空格隔开
service networking restart #重启网络