突然想到为什么服务器的MySQL的3306端口一直无法在外网连接到,然后排查了腾讯云的安全策略组后发现问题并不在那里。
接着,我去看了下MySQL服务监听的端口,结果查出来的是在监听0.0.0.0:3306,很显然,问题也不在这。
于是我将目光投向了iptables以及ufw,但是在弄了好久以后都没效果。(因为我在centos上都是这么干的)
(这里就要向各位dalao们求救,到底在Ubuntu下,iptables和ufw应该如何优雅地开放端口)
于是我就一气之下,直接 apt remove iptables 然后执行完,准备美滋滋地重启服务器的时候,群里一个dalao跟我说了声
于是,在重启后的几分钟,我尝试ssh连接上服务器的时候,开始出现了问题
于是,登录腾讯云的后台一看,服务器正在正常运行着,woc,妈卖批啊。
在使用腾讯云的VNC登陆后,ifconfig一看,只有网络中只有lo网卡,eth0没了。
这时候我就开始方了,有点熟悉,上次Asttear捣鼓我服务器的时候,在编辑防火墙无果后(不知道他弄了啥),也是跟现在一样,在ifconfig中eth0网卡没了,而使用service networking start 尝试重启网卡服务的时候,就报错了。
此时因为无法访问网络已经无法使用 apt install 重新安装防火墙或者其他服务了。
此时就轮到腾讯云小哥登场了。
于是,在工单道清错误后,腾讯云小哥给了我一个解决方案。
1、vnc登录子机;
2、执行 ifconfig {腾讯云内网IP} 255.255.192.0 (子网掩码)
将eth0网卡手动指定ip
3、执行 route add default gw {内网默认路由地址}
添加默认路由
4、此时子机网络已经临时恢复,执行 yum install NetworkManager -y 或者 apt install network-manager 重新安装networkmanager
5、重新安装完毕后网络即彻底恢复.可尝试重启确认
然后就恢复了hh
还有这个F12真尼玛骚
每次提交后如果出错,直接忽视即可(我每次都是正常的说)
当然骚
我从来都是iptables开放所有端口,然后在母鸡上NAT需要用的端口【穷的租不起多IP
还有你站HTTPS打叉了,有从HTTP加载的脚本
怕是CNZZ的统计脚本导致的,但是部分地区又正常
我从来都是iptables开放所有端口,然后在母鸡上NAT需要用的端口【穷的租不起多IP
这样把iptables全部放通应该可以
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
service iptables save
ufw的话更简单
ufw default allow
哦,我试试,我当时已经用ufw allow 3306了都不行
Debian9,或许腾讯云的问题和netfilter有关?
[email protected]:~# apt remove iptables
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following packages were automatically installed and are no longer required:
libip6tc0 libiptc0 libnetfilter-conntrack3
Use ‘apt autoremove’ to remove them.
The following packages will be REMOVED:
iptables
0 upgraded, 0 newly installed, 1 to remove and 10 not upgraded.
After this operation, 1,565 kB disk space will be freed.
Do you want to continue? [Y/n]
这是啥,Debian下remove防火墙?
https://packages.ubuntu.com/zesty/network-manager network-manager并不依赖iptables
[email protected]:~# apt remove iptables
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following packages will be REMOVED:
iptables lxd ubuntu-standard ufw
0 upgraded, 0 newly installed, 4 to remove and 1 not upgraded.
After this operation, 6,793 kB disk space will be freed.
估计一开始是没装Networkmanager还是怎样的吧,网卡服务真的不清楚
iptables -F&systemctl disable iptables.service, ufw disable,不建议直接卸载,避免出现脑残的包关联导致删错东西
已经翻车233