RouterOS配置MGMT管理VRF
/ip address add address={管理IP地址}/24 interface=ether1
/ip route add distance=1 gateway={网关IP地址} routing-mark=MGMT
/ip route rule add src-address={管理IP地址}/32 table=MGMT
/ip route vrf add interfaces=ether1 routing-mark=MGMT
/ip address add address={管理IP地址}/24 interface=ether1
/ip route add distance=1 gateway={网关IP地址} routing-mark=MGMT
/ip route rule add src-address={管理IP地址}/32 table=MGMT
/ip route vrf add interfaces=ether1 routing-mark=MGMT
/ip firewall nat add chain=srcnat src-address=内网IP段/24 protocol=tcp action=masquerade add action=dst-nat chain=dstnat dst-address=公网IP dst-port=80,443,5900 protocol=tcp to-addresses=内网IP to-ports=0-65535 add action=dst-nat chain=dstnat dst-address=公网IP dst-port=623 protocol=udp to-addresses=内网IP to-ports=0-65535
怕忘记了,懒得到处找.
Linux或者Mac OS生成一个key
ssh-keygen -t rsa
用scp上传到Mikrotik
scp -P端口 ~/.ssh/id_rsa.pub [email protected]:id_rsa.pub
在Mikrotik内导入key
[admin@MikroTik] > /user ssh-keys import public-key-file=id_rsa.pub user=admin
打印查看
[admin@MikroTik] > /user ssh-keys print
Flags: R - RSA, D - DSA
# USER BITS KEY-OWNER
0 R admin 2048 XXXXXXX
#/user set 0 name=NEW-admin #将admin用户更名 /user set 0 password=密码 /user ssh-keys import public-key-file=id_rsa.pub user=admin /ipv6 nd set [find] disabled=yes /ip neighbor discovery-settings set discover-interface-list=none /ip dns set servers=8.8.8.8 /ip ssh set strong-crypto=yes /ip service disable telnet,ftp,api,api-ssl /ip service set www port=3000 set ssh port=3001 set api port=3003 set winbox port=3002 /ip firewall mangle add action=change-mss chain=postrouting new-mss=1420 passthrough=yes protocol=tcp tcp-flags=syn tcp-mss=!0-1420 #关闭ddns动态解析 /ip cloud set ddns-enabled=no update-time=no /system clock set time-zone-name=Asia/Shanghai /system identity set name=ROS-Name #关闭ppp系列 /interface l2tp-server server set enabled=no /interface pptp-server server set enabled=no /interface sstp-server server set enabled=no /interface ovpn-server server set enabled=no
修改用户密码
[admin@MikroTik]>/user #进入操作路径 [admin@MikroTik]/user>print #显示RouterOS用户 [admin@MikroTik]/user>set admin password=123456 #修改admin用户密码为123456 [admin@MikroTik] /user> / #返回根目录
在当前用户下修改密码
[admin@MikroTik]>password #修改本目录用户密码备份命令
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
https://download.mikrotik.com/routeros/7.1beta2/chr-7.1beta2.img.zip