码迷,mamicode.com
首页 > 系统相关 > 详细

linux学习 网卡配置   putty密钥登陆

时间:2015-04-03 19:42:52      阅读:190      评论:0      收藏:0      [点我收藏+]

标签:配置文件   linux   ip地址   网卡   

一、 linux配置网卡

  1)自动获得ip 

     假如是DHCP用户端使用dhclient获得ip地址

  2)手动配置

   [root@localhost ~]#ifconfig    #查看ip地址

   [root@localhost ~]#vim /etc/sysconfig/network-scripts/ifcfg-eth0   #打开网卡配置文件

     修改如下:

      ONBOOT=no              改成yes            #开机启动

      BOOTPROTO=dhcp         改成static         #自动获得改成静态获得

     添加行:

      IPDAAR=192.168.X.X                        #桥接模式下与真机一个ip地址

      NETMASK=255.255.255.0                     #子网掩码

      GATEWAY=192.1.1.1                         #网关地址

      PEERDNS=no                                #防止dhcp修好dns

      DNS1=8.8.8.8                              #DNS地址

      DNS2=4.4.4.4                              #DNS地址

   [root@localhost ~]#cat /etc/resolv.conf      #查看dns是否生效

   [root@localhost ~]#/etc/init.d/network restart  

   [root@localhost ~]#service network  restart  #重启网卡


二、putty密钥登陆

  1)在用户家目录下创建.ssh目录 [root@localhost ~]#mkdir ./ssh

  2)在.ssh目录下创建authorized_keys文件   [root@localhost ~]#touch ./ssh/authorized_keys

  3)修改.ssh目录权限为700,文件authourizd_keys为600 

  4)用PUTTYGEN 生成密钥对  保存私钥  复制公钥到文件authorized_keys

  5)关闭防火墙[root@localhost ~]#setenforce 0 (临时关闭) 永久关闭编辑 /etc/selinux/config

    内SELINUX=enforcing 改为disabled 

  6)打开putty 保存私钥到session中ssh的auth中,open

  










本文出自 “linux” 博客,请务必保留此出处http://1038457789.blog.51cto.com/10025869/1627971

linux学习 网卡配置   putty密钥登陆

标签:配置文件   linux   ip地址   网卡   

原文地址:http://1038457789.blog.51cto.com/10025869/1627971

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!