putty连接CentOS

Posted on 2017-10-25 23:56  EVA21  阅读(228)  评论(0编辑  收藏  举报

1.虚拟机网络设置里选择eth1 那设置ip的时候也写eth1,
同理选择的是eth0,那配置静态ip时也就是写eht0s

 

2.配合ip 端口 防火墙
#ifconfig eth0 192.168.2.21 netmask 255.255.255.0
--配置静态ip

cd /etc/sysconfig/network-scripts
cp ifcfg-eth0 ifcfg-eth0.20171025.bak --备份
vi ifcfg-eth0
# Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)
##网络名字
DEVICE=eth0
##静态ip dhcp动态ip
BOOTPROTO=static
##mac地址
HWADDR=00:0C:29:C7:EB:BB
IPV6INIT=no
IPV6_AUTOCONF=yes
##开机自启动
ONBOOT=yes
##dns(域名解析)
DNSI=192.168.2.1
##ip地址
IPADDR=192.168.2.21
##子网掩码
NETMASK=255.255.255.0
##网关
GATEWAY=192.168.2.1

重启网络服务。service network restart或/etc/init.d/network restart

#iptables -I INPUT -p tcp --dport 22 -j ACCEPT

#service iptalbes stop

3.开启ssh服务
#rpm -qa |grep ssh

#service sshd start

 

在windows桌面运行 putty.exe,输入ip,连接,在弹出的终端窗口中输入用户名密码,即可登陆linux。

 


------关机命令
shutdown -h now
shutdown -h 10 ‘it will be shutdown after 10 minutes’