Solairs 变更IP 及 SSH 问题

机器换机房 IP 变更。

2台Solaris 10的测试机需要变更IP。

修改/etc/hosts 
将原来的
192.168.16.xxxs hostname loghost
改为
192.168.8.xxx hostname  loghost

2.需要设置网关才可以访问
其中一台机器配置过网关 一台未配置
配置过的 需要修改 /etc/defaultrouter
将原来的  192.168.16.xxx 改为192.168.8.1
未配置过的 删除了/etc/notrouter
vi /etc/defaultrouter  新增一行 192.168.8.1

reboot 就OK了

其中有个小插曲 。原先其中一台机器的 IP是 192.168.16.230 后改为192.168.8.230后 
在自己的机器ping 192.168.8.230  时断时续  。
ssh  root上去 提示 密码不对
我对ssh 不熟悉 以为是 换了IP 连key 都变了 于是便删除了 /etc/ssh/ssh_host*的文件。看看重新连接能不能重建。
等再尝试连接的时候 报错 no kex alg ……

于是需要重新生成 这些文件
    * /etc/ssh/ssh_host_dsa_key
    * /etc/ssh/ssh_host_dsa_key.pub
    * /etc/ssh/ssh_host_key
    * /etc/ssh/ssh_host_key.pub
    * /etc/ssh/ssh_host_rsa_key
    * /etc/ssh/ssh_host_rsa_key.pub
下面附上脚本

#!/bin/sh
# sshd-key-gen.sh
# post-apply script. that properly manages ssh authentication keys
# Install in /var/radmind/postapply

SSHKEYGEN=/usr/bin/ssh-keygen

if [ ! -s /etc/ssh/ssh_host_key -o ! -s /etc/ssh/ssh_host_key.pub ]; then
    if [ -f /etc/ssh/ssh_host_key ]; then
        rm /etc/ssh/ssh_host_key
    fi
    if [ -f /etc/ssh/ssh_host_key.pub ]; then
        rm /etc/ssh/ssh_host_key.pub
    fi
    $SSHKEYGEN -q -t rsa1 -f /etc/ssh/ssh_host_key -N "" \
        -C "" < /dev/null > /dev/null 2> /dev/null
    echo "Created /etc/ssh/ssh_host_key"
fi

if [ ! -s /etc/ssh/ssh_host_rsa_key -o ! -s /etc/ssh/ssh_host_rsa_key.pub ]; then
    if [ -f /etc/ssh/ssh_host_rsa_key ]; then
        rm /etc/ssh/ssh_host_rsa_key
    fi
    if [ -f /etc/ssh/ssh_host_rsa_key.pub ]; then
        rm /etc/ssh/ssh_host_rsa_key.pub
    fi
    $SSHKEYGEN -q -t rsa  -f /etc/ssh/ssh_host_rsa_key -N "" \
        -C "" < /dev/null > /dev/null 2> /dev/null
    echo "Created /etc/ssh/ssh_host_rsa_key"
fi

if [ ! -s /etc/ssh/ssh_host_dsa_key -o ! -s /etc/ssh/ssh_host_dsa_key.pub ]; then
    if [ -f /etc/ssh/ssh_host_dsa_key ]; then
        rm /etc/ssh/ssh_host_dsa_key
    fi
    if [ -f /etc/ssh/ssh_host_dsa_key.pub ]; then
        rm /etc/ssh/ssh_host_dsa_key.pub
    fi
    $SSHKEYGEN -q -t dsa -f /etc/ssh/ssh_host_dsa_key -N "" \
        -C "" < /dev/null > /dev/null 2> /dev/null
    echo "Created /etc/ssh/ssh_host_dsa_key"
fi

exit 0


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/21818314/viewspace-682666/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/21818314/viewspace-682666/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值