「Install Cloud Hosted Router on AliCloud」修訂間的差異

出自ChevyneWiki
跳至導覽 跳至搜尋
行 1: 行 1:
 
wget https://download.mikrotik.com/routeros/6.48.2/chr-6.48.2.img.zip -O chr.img.zip
Linux 雲主機
 
  +
https://download.mikrotik.com/routeros/6.48.2/chr-6.48.2.img.zip
 
 
gunzip -c chr.img.zip > chr.img
 
  +
wget https://download2.mikrotik.com/routeros/6.43.1/chr-6.43.1.img.zip -O chr1.img.zip && \
 
gunzip -c chr1.img.zip > chr.img && \
+
mount -o loop,offset=33554944 chr.img /mnt
  +
mount -o loop,offset=33554944 chr.img /mnt && \
 
ADDRESS=`ip addr show eth0 | grep global | cut -d' ' -f 6 | head -n 1` && \
+
ADDRESS=`ip addr show eth0 | grep global | cut -d' ' -f 6 | head -n 1`
  +
GATEWAY=`ip route list | grep default | cut -d' ' -f 3` && \
+
GATEWAY=`ip route list | grep default | cut -d' ' -f 3`
  +
 
echo "/ip address add address=$ADDRESS interface=[/interface ethernet find where name=ether1]
 
echo "/ip address add address=$ADDRESS interface=[/interface ethernet find where name=ether1]
 
/ip route add gateway=$GATEWAY
 
/ip route add gateway=$GATEWAY
" > /mnt/rw/autorun.scr && \
+
" > /mnt/rw/autorun.scr
  +
umount /mnt && \
+
umount /mnt
echo u > /proc/sysrq-trigger && \
 
  +
dd if=chr.img bs=1024 of=/dev/vda && \
 
 
echo u > /proc/sysrq-trigger
reboot
 
  +
 
 
dd if=chr.img bs=1024 of=/dev/vda
wget http://download2.mikrotik.com/routeros/6.36.4/chr-6.36.4.img.zip -O chr.img.zip && \
 
  +
gunzip -c chr.img.zip > chr.img && \
 
mount -o loop,offset=33554944 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
 
" > /mnt/rw/autorun.scr && \
 
umount /mnt && \
 
echo u > /proc/sysrq-trigger && \
 
dd if=chr.img bs=1024 of=/dev/vda && \
 
 
reboot
 
reboot
 
__NOTOC__
 
__NOTOC__

於 2021年4月14日 (三) 00:58 的修訂

wget https://download.mikrotik.com/routeros/6.48.2/chr-6.48.2.img.zip -O chr.img.zip

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

mount -o loop,offset=33554944 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
 " > /mnt/rw/autorun.scr

umount /mnt

echo u > /proc/sysrq-trigger

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

reboot