Forked from soheilsec/Install CHR mikrotik on Ubuntu
Created
December 12, 2024 10:32
-
-
Save Tesla2550/244cf6921ce5b647ab8eaef9d5ef5073 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| echo "install routeros on linux ubuntu 20" | |
| wget https://download.mikrotik.com/routeros/6.44.6/chr-6.44.6.img.zip -O chr.img.zip && \ | |
| gunzip -c chr.img.zip > chr.img && \ | |
| mount -o loop,offset=512 chr.img /mnt && \ | |
| ADDRESS=`ip addr show eth0 | grep global | cut -d' ' -f 6 | head -n 1` && \ | |
| GATEWAY=`ip route list | grep default | cut -d' ' -f 3` && \ | |
| echo "/ip address add address=$ADDRESS interface=[/interface ethernet find where name=ether1] | |
| /ip route add gateway=$GATEWAY | |
| /ip service disable telnet | |
| /user set 0 name=root password=$pass | |
| " > /mnt/rw/autorun.scr && \ | |
| umount /mnt && \ | |
| echo u > /proc/sysrq-trigger && \ | |
| dd if=chr.img bs=1024 of=/dev/vda && \ | |
| echo "sync disk" && \ | |
| echo s > /proc/sysrq-trigger && \ | |
| echo "Sleep 5 seconds" && \ | |
| sleep 5 && \ | |
| echo "Ok, we're rebooting.." && \ | |
| echo b > /proc/sysrq-trigger |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
👯♀️