RouterOS导入key登陆ssh

Linux或者Mac OS生成一个key

ssh-keygen -t rsa

用scp上传到Mikrotik

scp -P端口 ~/.ssh/id_rsa.pub [email protected]:id_rsa.pub

在Mikrotik内导入key

[[email protected]] > /user ssh-keys import public-key-file=id_rsa.pub user=admin

打印查看

[[email protected]] > /user ssh-keys print
Flags: R - RSA, D - DSA        
 #   USER                       BITS KEY-OWNER        
 0 R admin                      2048 XXXXXXX

RouterOS软路由常用命令

修改用户密码

[[email protected]]>/user                               #进入操作路径
[[email protected]]/user>print                           #显示RouterOS用户
[[email protected]]/user>set admin password=123456        #修改admin用户密码为123456
[[email protected]] /user> /                              #返回根目录

在当前用户下修改密码

[[email protected]]>password                             #修改本目录用户密码备份命令

阅读剩余部分...

dd安装Routeros

wget http://download2.mikrotik.com/routeros/6.43.8/chr-6.43.8.img.zip -O chr.img.zip && \

gunzip -c chr.img.zip > chr.img && \

mount -o loop,offset=33554944 chr.img /mnt && \

ADDRESS0=`ip addr show eth0 | grep global | cut -d' ' -f 6 | head -n 1` && \

GATEWAY0=`ip route list | grep default | cut -d' ' -f 3` && \

echo "/ip address add address=$ADDRESS0 interface=[/interface ethernet find where name=ether1]

/ip route add gateway=$GATEWAY0

" > /mnt/rw/autorun.scr && \

umount /mnt && \

echo u > /proc/sysrq-trigger && \

dd if=chr.img bs=1024 of=/dev/vda && \

reboot