麒麟操作系统修改网卡配置文件与ssh连接失败解决
麒麟系统安装后默认为桌面图标设置网络,且为图形设置方式,对于非图形界面与修改、批量设置时候很不友好;可以编写对应的网卡配置文件解决此问题3、配置DNS4、重启服务,启动配置二、解决ssh远程失败问题ssh登录某些服务器,会发生等待时间过长问题才能到输入密码阶段,或者XShell远程时提示22端口连接失败等问题;可以修改对应远程客户端配置解决此问题,有两个方法2.修改身份验证三.修改超时时间默认超时
·
目录
一、修改网卡配置文件
1、介绍
麒麟系统安装后默认为桌面图标设置网络,且为图形设置方式,对于非图形界面与修改、批量设置时候很不友好;可以编写对应的网卡配置文件解决此问题
2、编写网卡配置文件
root@kylin:~# ifconfig #查看网卡名
root@kylin:~# vim /etc/network/interfaces #修改网卡配置文件
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
auto enaphyt4i0 #开机自动生效
iface enaphyt4i0 inet static #配置类型为静态
address 192.168.2.98 #配置IP地址
netmask 255.255.255.0 #配置子网掩码
gateway 192.168.2.254 #配置网关
3、配置DNS
root@kylin:~# sed -i "/#DNS=/ c DNS=114.114.114.114" /etc/systemd/resolved.conf
#修改DNS配置文件,地址可以根据需要自己替换DNS服务器地址
修改后文件如下:
root@kylin:~# cat /etc/systemd/resolved.conf
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See resolved.conf(5) for details
[Resolve]
DNS=114.114.114.114
#FallbackDNS=
#Domains=
#LLMNR=no
#MulticastDNS=no
#DNSSEC=allow-downgrade
#DNSOverTLS=no
#Cache=yes
#DNSStubListener=yes
#ReadEtcHosts=yes
4、重启服务,启动配置
root@kylin:~# systemctl daemon-reload #重新加载配置
root@kylin:~# systemctl restart systemd-resolved #重启服务
然后cat /etc/resolv.conf会发现DNS信息已经更新进去
root@kylin:~# systemctl restart networking #重启网卡服务
二、解决ssh远程失败问题
ssh登录某些服务器,会发生等待时间过长问题才能到输入密码阶段,或者XShell远程时提示22端口连接失败等问题;可以修改对应远程客户端配置解决此问题,有两个方法
1.取消DNS反向解析
root@kylin:~# sed -i '/#UseDNS/ s/#//' /etc/ssh/sshd_config #取消DNS解析
root@kylin:~# systemctl restart sshd #重启服务使配置生效
2.修改身份验证
root@kylin:~# sed -i "/[^#]...GSSAPI/ s/yes/no/" /etc/ssh/ssh_config
root@kylin:~# systemctl restart ssh #重启服务
三.修改超时时间
默认超时连接时间比较短,这是出去安全考虑,但是长时间使用的用户比较麻烦,每次都要重新连接,可以修改特定参数时间
root@kylin:~# sed -i "/Client/ s/0/10/" /etc/ssh/sshd_config #修改超时时间
root@kylin:~# systemctl restart sshd #重启服务使配置生效
这样超过10s没有动作的情况下,sshd服务才会中断连接
更多推荐
所有评论(0)