配置网络以及远程连接虚拟机

配置网络以及远程连接虚拟机

cat /proc/version
Linux version 3.10.0-693.2.2.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC) ) #1 SMP Tue Sep 12 22:26:13 UTC 2017
yum安装redhat-lsb: lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch
Distributor ID: CentOS
Description:    CentOS Linux release 7.4.1708 (Core)
Release:        7.4.1708
Codename:       Core

一、配置网络

vi /etc/sysconfig/network-scripts/ifcfg-ens33

TYPE=”Ethernet”
PROXY_METHOD=”none”
BROWSER_ONLY=”no”
BOOTPROTO=”static”
DEFROUTE=”yes”
IPV4_FAILURE_FATAL=”no”
IPV6INIT=”yes”
IPV6_AUTOCONF=”yes”
IPV6_DEFROUTE=”yes”
IPV6_FAILURE_FATAL=”no”
IPV6_ADDR_GEN_MODE=”stable-privacy”
NAME=”ens33”
UUID=”d3c4ce19-6426-4ec0-b2aa-0df4d5a138ca”
DEVICE=”ens33”
ONBOOT=”yes”
IPADDR=”192.168.31.20”
NETMASK=”255.255.255.255”
GATEWAY=”192.168.31.1”
DNS1=”192.168.31.1”
DNS2=”114.114.114.114”

连接网络正常

二、Putty

a、下载地址Putty下载地址,选择最新putty 0.70

下载后连接IP始终连接不上,登入界面也没有显示login登入提示,并且cat /var/log/secure报错
Oct 18 02:05:58 localhost polkitd[491]: Unregistered Authentication Agent for unix-process:1101:76205 (system bus name :1.26, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)
猜测1、防火墙的问题 2、sshd config文件功能未开启 3、iptables做了限制
百度了很久,找到有关帖子但都没有解决,
主要有(
1、firewall-cmd --state #查看防火墙状态
关闭防火墙:
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
2、vi /etc/ssh/sshd-config #修改password登入
3、关闭: service iptables stop
查看防火墙状态: service iptables status
)

后来不经意ficonfig 看了下ip 看见netmask 255.255.255.255 broadcast 192.168.31.20 #广播地址和静态IP一样?
于是查看配置文件确实发现NETMASK="255.255.255.255" #所以改成NETMASK="255.255.255.0" 然后/etc/init.d/networdk restart
然后用putty连接,成功了,*粗心引起*

posted on 2017-10-18 02:41  游荡的鱼  阅读(977)  评论(0编辑  收藏  举报

导航