• [01]FREEBSD SSH、dns、netmask、gateway 网络配置


     

    环境为wm8.0+freebsd9.2+ssh2

    让FreeBSD的root用户能够SSH登陆

    测试环境,共两到电脑

    PC1:win7(192.168.1.120) +vm8.1+freebsd  9.2(192.168.1.5)

    PC2:win8(192.168.1.100) +ssh 工具SecureCRTSecureFX_HH_x86_7.0.0.326_PortableSoft

      第一步:VM设置,把网络设置为“桥接”,如果没有network adapter 要点add添加,如图:

        

    选择第一种为桥接方式

    第二步,在freebsd下,临时设置IP

      ifconfig em0 192.168.1.5 netmask 255.255.255.0 up

          ping -c2 192.168.1.100 ok

      但是

          ping -c2 www.baidu.com不通,原因是还没有配置dns

        

    下面为freebsd配置dns,由于局域网内ip已经能ping通,为方便操作,打开sshd,通过远程终端进行配置,

    刚装好FreeBSD,默认是不允许root用户登录SSH的,如果登陆结果就会如下:
    用PuTTY登陆时,总提示:
    login as: root
    Using keyboard-interactive authentication.
    Password:
    Access denied

    这个时候需要编辑其配置文件,输入以下命令进行修改:
    ee /etc/ssh/sshd_config
    然后进行修改.


    找到
    #PasswordAuthentication no
    修改为:
    PasswordAuthentication yes
    这段的意思是,让SSH使用密码验证登陆.

    找到
    #PermitRootLogin no
    修改为
    PermitRootLogin yes
    这段的意思是,让SSH准许root用户登录.一般来说,为了安全起见,这一段还是不要允许的好.不过安全要求不高,可以这样做.

    找到
    #PermitEmptyPasswords no
    修改为
    PermitEmptyPasswords no
    这段的意思是,使得允许空密码成为不可用,换句话说就是,不允许空密码登陆.

    检查是否在/etc/inetd.conf 中打开了,请把它注释掉:
    ssh stream tcp nowait root /usr/sbin/sshd sshd -i -4
    改成
    #ssh stream tcp nowait root /usr/sbin/sshd sshd -i -4
    保存、重启

    /etc/ssh/sshd restart 

    这样就root用户就可以用SSH客户端远程登陆FreeBSD了.

    FreeBSD设置IP地址、网关、DNS

    说明:
    IP:192.168.21.100
    子网掩码:255.255.255.0
    网关:192.168.1.1
    DNS:211.161.45.222
    8.8.4.4
    1、设置IP地址、网关

    ee /etc/rc.conf #编辑
    ifconfig_em0="inet 192.168.1.100netmask 255.255.255.0" #设置IP地址,子网掩码
    defaultrouter="192.168.1.1" #设置网关
    hostname="FreeBSD" #设置主机名字
    esc 回车,再按a保存
    系统运维 温馨提醒:qihang01原创内容版权所有,转载请注明出处及原文链接
    2、设置DNS
    ee /etc/resolv.conf #编辑

    nameserver 8.8.8.8
    nameserver 8.8.4.4

    nameserver 211.161.45.222

    esc 回车,再按a保存
    sh /etc/rc #重启网络
    /etc/netstart #重启网络

    win8下ipconfig -a如下图:

    ee /etc/rc.conf设置ip,掩码,网关

    ee /etc/resolv.conf 设置dns,esc->回车->a 保存

    sh /etc/rc

    etc /netstart

    ping -c5 www.beidasoft.com

    到此,设置完成

  • 相关阅读:
    Smart TV Alliance SDK2.0简介
    为字符串数组排序。每个字符串可能包含数字,字母,汉字
    为数组添加自定义函数,可完成执行[1,2,3,4,5].twoself() 输出新数组[1,2,3,4,5,1,2,3,4,5]
    vueJS 解决VSCode 中 报错"You may use special comments to disable some warnings. Use // eslint-disable-next-line to ignore the next line. Use /* eslint-disable */ to ignore all warnings in a file."
    table-一列细分为多列(合并单元格)
    利用闲暇时间帮朋友做一个小页面
    保护url时效性和安全性的一种解决方案
    highcharts-3d.js实现饼状图
    eclipse 遇到的问题及解决思路
    git初步使用
  • 原文地址:https://www.cnblogs.com/fuckcn/p/3662399.html
Copyright © 2020-2023  润新知