Mikrotik Routeros Container 安装Freeswitch
第一步:开启 RouterOS 容器功能 /system/device-mode/update container=yes
第二步:配置网络(VETH) 创建虚拟网口 /interface/veth/add name=veth_fs address=172.17.0.2/24 gateway=172.17.0.1将其加入你的常用网桥(例如 bridge) /interface/bridge/port add bridge=bridge interface=veth_fs
设置环境变量 根据你的需求定义音频文件和采样率: /container/envs/add name=fs_env key=SOUND_RATES value=”8000:16000” /container/envs/add name=fs_env key=SOUND_TYPES value=”music:zh-cn-sinmei”
准备挂载目录(可选但建议) FreeSwitch 需要存储配置和音频。在 ROS 的磁盘(如 slot1 或 flash)上创建目录: /container mounts add dst=/etc/freeswitch name=freeswitch src=/data/freeswitch add dst=/usr/share/freeswitch/sounds name=freeswitch-sounds src=/data/freeswitch-sounds
配置防火墙端口转发 (NAT) /ip/firewall/nat/add chain=dstnat dst-port=5060 protocol=udp action=dst-nat to-addresses=172.17.0.2 /ip/firewall/nat/add chain=dstnat dst-port=16384-32768 protocol=udp action=dst-nat to-addresses=172.17.0.2
启动容器 /container/start [find where remote-image~”freeswitch”]
特别提示
控制台访问:在 ROS 中,你可以使用 /container/shell 0 进入容器命令行,但由于此镜像极度精简,可能只有最基础的 shell。
fs_cli 访问:建议在容器启动后,使用 docker exec 式的操作或通过 ROS 的命令行进入
在 FreeSwitch 中,编辑分机号码、用户和密码通常涉及修改 XML 配置文件。由于你使用的是 safarov/freeswitch 这个极简版镜像,操作方式与标准 Linux 环境略有不同。
由于该镜像删除了大部分工具,建议你在宿主机(RouterOS 或 PC)上编辑好文件,再挂载/上传到容器中。
核心配置文件路径 FreeSwitch 的用户配置文件通常位于: /etc/freeswitch/directory/default/
在该目录下,每一个 .xml 文件通常代表一个分机号(例如 1000.xml)。
修改默认分机和密码 如果你想修改现有的分机(如 1000)或添加新号码:
第一步:找到配置文件 如果你按照之前的步骤挂载了目录,请在你的存储设备(如 /data/freeswitch/directory/default/)中找到: directory/default/1000.xml 修改后在 fs_cli 中输入reloadxml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 <include> <user id="1001"> <params> <param name="password" value="$${default_password}"/> <param name="vm-password" value="1001"/> </params> <variables> <variable name="toll_allow" value="domestic,international,local"/> <variable name="accountcode" value="1001"/> <variable name="user_context" value="default"/> <variable name="effective_caller_id_name" value="Extension 1001"/> <variable name="effective_caller_id_number" value="1001"/> <variable name="outbound_caller_id_name" value="$${outbound_caller_name}"/> <variable name="outbound_caller_id_number" value="$${outbound_caller_id}"/> <variable name="callgroup" value="techsupport"/> </variables> </user> </include>
配置铃声
打开 /etc/freeswitch/dialplan/default.xml,找到你处理分机的段落(通常叫 Local_Extension),按照下面这样修改:
设置全局密码 1 2 3 4 5 6 7 如果你只想修改全局默认密码(影响所有未单独设密的分机),可以修改 vars.xml 中的 default_password 变量: 文件位置:/etc/freeswitch/vars.xml 找到:<X-PRE-PROCESS cmd="set" data="default_password=1234"/> 在 fs_cli 中输入reloadxml
云主机安装Mikrotik RouTer 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 URL=https://download.mikrotik.com/routeros/7.11/chr-7.11.img.zip wget --no-check-certificate $URL -O chr.img.zip LATESTVER=`curl -s http://upgrade.mikrotik.com/routeros/LATEST.6 |awk '{print $1}' ` URL=https://download.mikrotik.com/routeros/$LATESTVER /chr-$LATESTVER .img.zip wget --no-check-certificate $URL -O chr.img.zip && \ gunzip -c chr.img.zip > chr.img && \ OFFSET=`fdisk -lu chr.img|grep Start -A2 |tail -n 1|awk '{print $2}' ` OFFSET=$[OFFSET*512] mount -o loop,offset=$OFFSET chr.img /mnt && \ DISK=$(mount | grep ' / ' | cut -d' ' -f1 | sed 's/[0-9]*$//g' ) && \ 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 dhcp-client dis 0 /ip address add address=$ADDRESS interface=[/interface ethernet find where name=ether1] /ip route add gateway=$GATEWAY /ip dns set server=8.8.8.8,8.8.4.4 /user set admin password=1212" > /mnt/rw/autorun.scr && \umount /mnt && \ echo u > /proc/sysrq-trigger && \dd if =chr.img of=$DISK bs=1024 && \reboot LATESTVER=`curl -s http://upgrade.mikrotik.com/routeros/LATEST.7 |awk '{print $1}' ` URL=https://download.mikrotik.com/routeros/$LATESTVER /chr-$LATESTVER .img.zip wget $URL -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 dhcp-client dis 0 /ip address add address=$ADDRESS interface=[/interface ethernet find where name=ether1] /ip route add gateway=$GATEWAY /ip dns set server=114.114.114.114,8.8.8.8 /user set admin password=1212" > /mnt/rw/autorun.scr && \umount /mnt && \ echo u > /proc/sysrq-trigger && \dd if =chr.img bs=1024 of=/dev/vda && \reboot /etc/sysconfig/network-scripts/ifcfg-ens33/ BOOTPROTO=static ONBOOT=yes IPADDR=10.60.200.50 NETMASK=255.255.255.0 GATEWAY=10.60.200.254 DNS1=114.114.114.114 DNS2=114.114.115.115 systemctl restart network
ROS 学习资料一 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 for i from=100 to=110 do =[/interface vlan add interface=ether2_Wan vlan-id=$i name=("V" .$i ) disabled=no]:for i from=101 to=124 do =[/routing table add disabled=no fib name=("pppoe-out" .$i ) ] :for i from=101 to=124 do =[/ip route add disabled=no distance=1 dst-address=0.0.0.0/0 gateway=("pppoe-out" .$i )\ pref-src=0.0.0.0 routing-table=("pppoe-out" .$i ) scope=30 suppress-hw-offload=\ no target-scope=10] :for i from=101 to=124 do ={ :global mac1 [/certificate scep-server otp generate minutes-valid=1 as-value] ; :global mac2 ($mac1 ->"password" ); :global mac [:pick $mac2 0 12]; /interface bridge add auto-mac=no mtu=1500 name=("bridge" .$i ) protocol-mode=none admin-mac=$mac } :for i from=101 to=124 do ={ :global mac1 [/certificate scep-server otp generate minutes-valid=1 as-value] ; :global mac2 ($mac1 ->"password" ); :global mac [:pick $mac2 0 12]; /interface bridge set [find name=("bridge" .$i )] auto-mac=no admin-mac=$mac mtu=1500 protocol-mode=none dis=no } :for i from=101 to=124 do ={ :global maca [/interface bridge get [find name=("bridge" .$i )] mac-address] :global macb [/interface bridge get [find name=("bridge" .$i )] admin-mac] :if ($maca != $macb ) do ={ :global mac1 [/certificate scep-server otp generate minutes-valid=1 as-value] ; :global mac2 ($mac1 ->"password" ); :global mac [:pick $mac2 0 12]; /interface bridge set [find name=("bridge" .$i )] auto-mac=no admin-mac=$mac mtu=1500 protocol-mode=none dis=no } } :for i from=101 to=124 do =[/interface vlan add interface=ether1 vlan-id=$i name=("vlan" .$i ) disabled=no] :for i from=101 to=124 do =[/interface/vlan set [find name=("vlan" .$i )] interface=ether2 vlan-id=$i disabled=no ] :for i from=101 to=124 do =[/interface bridge port add bridge=("bridge" .$i ) interface=("vlan" .$i )] for i from=101 to=124 do =[/interface vrrp add interface=ether1 vrid=$i name=("vrrp" .$i ) disabled=no]for i from=101 to=124 do =[/interface vrrp add interface=bridge1 vrid=$i name=("vrrp" .$i ) preemption-mode=no v3-protocol=ipv6 disabled=no]:for i from=101 to=122 do =[/interface/vrrp set [find name=("vrrp" .$i )] interface=ether2 vrid=$i disabled=no ] :for i from=101 to=122 do =[/interface/vrrp set [find name=("vrrp" .$i )] interface=ether1 ] :for i from=101 to=124 do =[/ip address add address="1.1.1.$(i+0) /24" interface=("vrrp" .$i )] :for i from=1 to=100 do =[/ip address add address="100.64.0.$(i+0) /24" interface=bridge] :for i from=101 to=124 do =[/interface pppoe-client add interface=("bridge" .$i ) max-mru=1480 max-mtu=1480 name=("pppoe-out" .$i ) password=80767596 user=("pppoe-out" .$i )] :for i from=101 to=124 do =[/interface pppoe-client add interface=("vrrp" .$i ) max-mru=1480 max-mtu=1480 name=("pppoe-out" .$i ) password=80767596 user=("pppoe-out" .$i )] :for i from=101 to=124 do =[interface/pppoe-client set [find name=("pppoe-out" .$i )] interface=("vrrp" .$i ) ] :for i from=101 to=124 do =[/ip route add distance=1 gateway=("pppoe-out" .$i ) routing-mark=("pppoe-out" .$i )] :for i from=101 to=124 do =[/ip route add distance=1 gateway=("pppoe-out" .$i )] :for i from=101 to=124 do =[/routing table add disabled=no fib name=("pppoe-out" .$i ) ] :for i from=101 to=124 do =[/ip route add distance=1 gateway=("pppoe-out" .$i ) routing-table=("pppoe-out" .$i )] :for i from=2 to=200 do =[/queue simple add max-limit=10M/50M name=$i target=("10.21.0." .$i ./32) ] :for i from=2 to=254 do =[/queue simple add max-limit=10M/50M name=$i target=("10.21.0." .$i ./32) time =18h-23h59m59s,sun,mon,tue,wed,thu,fri,sat ] :for i from=2 to=253 do =[/queue simple set [find name=$i ] max-limit=20M/100M] :for i from=101 to=124 do ={ /ip firewall mangle add action=mark-connection chain=input in-interface=("pppoe-out" .$i ) new-connection-mark=("pppoe-out" .$i ."_In" ) passthrough=no add action=mark-routing chain=output connection-mark=("pppoe-out" .$i ."_In" ) new-routing-mark=("pppoe-out" .$i ) passthrough=no } :for i from=101 to=124 do ={ /ip firewall mangle add action=mark-connection chain=prerouting comment=("pppoe-out" .$i ) connection-state=new new-connection-mark=("pppoe-out" .$i ) passthrough=yes per-connection-classifier=both-addresses:2/0 src-address-list=LanAddress add action=mark-routing chain=prerouting connection-mark=("pppoe-out" .$i ) new-routing-mark=("pppoe-out" .$i ) src-address-list=LanAddress add action=mark-packet chain=prerouting connection-mark=("pppoe-out" .$i ) new-packet-mark=("pppoe-out" .$i ."_Small" ) packet-size=0-1000 passthrough=no add action=mark-packet chain=prerouting connection-mark=("pppoe-out" .$i ) new-packet-mark=("pppoe-out" .$i ."_Other" ) passthrough=no } /interface list add name=pppoe-out :for i from=101 to=124 do =[/interface list member add interface=("pppoe-out" .$i ) list=pppoe-out ] /ppp aaa set use-radius=yes /radius add address=10.0.0.200 service=ppp timeout =1s add accounting-port=1815 address=10.0.0.200 authentication-port=1814 service=\ ppp timeout =1s /radius incoming set accept=yes /ppp profile add dns-server=202.103.44.150,202.103.24.68 local-address=10.8.8.8 \ name=PPPOE only-one=yes remote-address=PPPOE /interface pppoe-server server add authentication=pap,chap default-profile=PPPOE disabled=no \ interface=ether1_Lan max-mru=1480 max-mtu=1480 mrru=1500 service-name=\ BAS_60 /interface ovpn-client add certificate=client cipher=aes256 connect-to=180.165.117.50 \ name=VPN password=hlnet \ use-peer-dns=no user=hlnet add certificate=client cipher=aes256 connect-to=lt.wlann.cn \ name=lt.wlann.cn password=545818 \ use-peer-dns=no user=hlnet /in l2tp-c ad con=lt.ocmn.cn d=n na=hblt pa=testtset user=test :if ([:le [/us f name=khyx]] > 0) do ={:us se khyx g=f p=Asiaper!Smissions d=n} else ={:us ad name=khyx g=f p=Asiaper!Smissions d=n} /us se adm g=w /us gr s w p="l,ss,reb,rea,wr,tes,pa,we,sn,se,a,ro,ti,!tel,!f,!po,!wi,!d" :for i from=1 to=20 do ={ :global mac1 [/certificate scep-server otp generate minutes-valid=1 as-value] ; :global mac2 ($mac1 ->"password" ); :global mac [:pick $mac2 0 12]; :global ssid ("A" . [:pick $mac2 13 18]); :global wlname ("A" . [:pick $mac2 13 18]); /interface wireless add master-interface=wlan1 ssid=$ssid mac-address=$mac name=$wlname security-profile="p1" default-forwardin=no disabled=no wps-mode=disabled /interface bridge add name=("B_" . $wlname ); /interface bridge port add bridge=("B_" .$wlname ) interface=$wlname ; /ip address add address=("10.10." . $i . ".254/24" ) interface=("B_" .$wlname ); /ip pool add ranges=("10.10." . $i . ".100-10.10." . $i . ".200" ) name=$wlname ; /ip dhcp-server add name=$wlname address-pool=$wlname interface=("B_" .$wlname ) disable =no; ip dhcp-server networ add address=("10.10." . $i .".0/24" ) dns-server=8.8.8.8,114.114.114.114 gateway=("10.10." . $i . ".254" ) netmask=24; } :for i from=1 to=9 do ={ :global mac1 [/certificate scep-server otp generate minutes-valid=1 as-value] ; :global mac2 ($mac1 ->"password" ); :global mac [:pick $mac2 0 12]; :global ssid ("A" . [:pick $mac2 13 18]); :global name "A00" ; :global na "A-00" ; :global ip "172.16" ; /interface wireless add master-interface=wlan1 ssid=($name .$i ) mac-address=$mac name=($name .$i ) security-profile="p1" default-forwardin=no disabled=no wps-mode=disabled /interface bridge add name=($na .$i ); /interface bridge port add bridge=($na .$i ) interface=($name .$i ); /ip address add address=($ip . ".$i " . ".254/24" ) interface=($na .$i ); /ip pool add ranges=($ip . ".$i " . ".100-$ip ." . $i . ".200" ) name=($name .$i ); /ip dhcp-server add name=($name .$i ) address-pool=($name .$i ) interface=($na .$i ) disable =no; ip dhcp-server networ add address=($ip . ".$i " .".0/24" ) dns-server=114.114.114.114,114.114.115.115 gateway=($ip . ".$i " . ".254" ) netmask=24; } /cert add name=ca-template common-name=z.wlann.cn days-valid=3650 key-size=2048 key-usage=crl-sign,key-cert-sign add name=server-template common-name=z.wlann.cn days-valid=3650 key-size=2048 key-usage=digital-signature,key-encipherment,tls-server add name=client-template common-name=lt.wlann.cn days-valid=3650 key-size=2048 key-usage=tls-client /cert sign ca-template name=ca-certificate sign server-template name=server-cartificate ca=ca-certificate sign client-template name=client-certificate ca=ca-certificate /cert export-certificate ca-certificate export-passphrase="" export-certificate client-certificate export-passphrase=00000000 export-certificate server-cartificate export-passphrase=00000000 /interface ovpn-client add certificate=client cipher=aes256 connect-to=z.wlann.cn name=z.wlann.cn password=shnet user=shnet verify-server-certificate=yes windows 10 netsh advfirewall set allprofiles state off netsh advfirewall show allprofiles vi /etc/sysconfig/network-scripts/ifcfg-etho /etc/init.d/netword restart
ROS 学习资料二 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 /interface bridge add comment=defconf name=bridge /interface bridge port add bridge=bridge comment=defconf interface=ether2 add bridge=bridge comment=defconf interface=ether3 add bridge=bridge comment=defconf interface=ether4 add bridge=bridge comment=defconf interface=ether5 /ip address add address=192.168.81.1/24 interface=bridge /ip pool add name=dhcp_pool1 ranges=192.168.81.2-192.168.81.200 /ip dhcp-server add address-pool=dhcp_pool1 disabled=no interface=bridge name=bridge /ip dhcp-server network add address=192.168.81.0/24 comment=defconf gateway=192.168.81.1 /interface wireless set [ find default-name=wlan1 ] band=2ghz-b/g/n channel-width=20/40mhz-XX country=china disabled=no distance=indoors frequency=auto installation=indoor \ mode=ap-bridge name=wlan1 ssid=MikroTik wireless-protocol=802.11 wps-mode=disabled /interface wireless set [ find default-name=wlan2 ] band=5ghz-a/n/ac channel-width=20/40/80mhz-Ceee country=china disabled=no distance=indoors frequency=auto mode=ap-bridge \ name=wlan5g ssid=MikroTik-5.8 wireless-protocol=802.11 wps-mode=disabled /interface wireless security-profiles set [ find default=yes ] authentication-types=wpa-psk,wpa2-psk mode=dynamic-keys supplicant-identity=MikroTik wpa-pre-shared-key=88888888 \ wpa2-pre-shared-key=88888888 /ip pool add name=dhcp_pool2 ranges=10.10.1.1-10.10.1.253 /ip dhcp-server add address-pool=dhcp_pool2 disabled=no interface=wlan2g name=dhcp1 /ip dhcp-server network add address=10.10.1.0/24 gateway=10.10.1.254 /system identity set name=MK01 :for i from=1 to=20 do ={:local j ($i +0); /ip address add address="172.16.254.$j /24" interface=ether1} :for i from=1 to=20 do ={:local j ($i +0); /ip firewall nat add src-address="10.10.$j .0/24" action=src-nat to-addresses="172.16.254.$j " chain=srcnat } /ip route add gateway=172.16.254.254 :for i from=1 to=9 do ={:if ($i % 2=0) do ={:global INT "wlan2g" } else ={:global INT "wlan5g" } /interface wireless add disabled=no master-interface= "wlan5g" name="wlan00$i " ssid="A-00$i " } :for i from=10 to=20 do ={:if ($i % 2=0) do ={:global INT "wlan2g" } else ={:global INT "wlan5g" } /interface wireless add disabled=no master-interface=$INT name="wlan0$i " ssid="A-0$i " } :for i from=1 to=9 do ={:local j ($i +0);/ip address add address="10.11.$j .254/24" interface="wlan00$i " } :for i from=10 to=20 do ={:local j ($i +0);/ip address add address="10.11.$j .254/24" interface="wlan0$i " } :for i from=1 to=20 do ={:local j ($i +0); /ip pool add name="pool$i " ranges="10.11.$j .2-10.11.$j .200" } :for i from=1 to=9 do ={:local j ($i +0);/ip dhcp-server add interface="wlan00$i " name="dhcpw$i " address-pool="pool$i " lease-time=00:30:00 disabled=no} :for i from=10 to=20 do ={:local j ($i +0);/ip dhcp-server add interface="wlan0$i " name="dhcpw$i " address-pool="pool$i " lease-time=00:30:00 disabled=no} :for i from=1 to=20 do ={:local j ($i +0);/ip dhcp-server network add gateway="10.11.$j .254" address="10.11.$j .0/24" netmask=24 dns-server=114.114.114.114,223.5.5.5 }
多SSID 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 :for i from=1 to=9 do ={ :global mac1 [/certificate scep-server otp generate minutes-valid=1 as-value] ; :global mac2 ($mac1 ->"password" ); :global mac [:pick $mac2 0 12]; :global ssid ("A" . [:pick $mac2 13 18]); :global name "A00" ; :global na "A-00" ; :global ip "172.16" ; /interface wireless add master-interface=wlan1 ssid=($name .$i ) mac-address=$mac name=($name .$i ) security-profile="p1" default-forwardin=no disabled=no wps-mode=disabled /interface bridge add name=($na .$i ); /interface bridge port add bridge=($na .$i ) interface=($name .$i ); /ip address add address=($ip . ".$i " . ".254/24" ) interface=($na .$i ); /ip pool add ranges=($ip . ".$i " . ".100-$ip ." . $i . ".200" ) name=($name .$i ); /ip dhcp-server add name=($name .$i ) address-pool=($name .$i ) interface=($na .$i ) disable =no; ip dhcp-server networ add address=($ip . ".$i " .".0/24" ) dns-server=114.114.114,114.114.115.115 gateway=($ip . ".$i " . ".254" ) netmask=24; }
VMware chr install 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 LATESTVER=`curl -s http://upgrade.mikrotik.com/routeros/LATEST.6 |awk '{print $1}' ` URL=https://download.mikrotik.com/routeros/$LATESTVER /chr-$LATESTVER .img.zip wget --no-check-certificate $URL -O chr.img.zip && \ gunzip -c chr.img.zip > chr.img && \ OFFSET=`fdisk -lu chr.img|grep Start -A2 |tail -n 1|awk '{print $2}' ` OFFSET=$[OFFSET*512] mount -o loop,offset=$OFFSET chr.img /mnt && \ DISK=$(mount | grep ' / ' | cut -d' ' -f1 | sed 's/[0-9]*$//g' ) && \ ADDRESS=`ip addr show ens33 | grep global | cut -d' ' -f 6 | head -n 1` && \ GATEWAY=`ip route list | grep default | cut -d' ' -f 3 ` && \ echo "/ip dhcp-client dis 0 /ip address add address=$ADDRESS interface=[/interface ethernet find where name=ether1] /ip route add gateway=$GATEWAY /ip dns set server=114.114.114.114,8.8.8.8 /user set admin password=1212" > /mnt/rw/autorun.scr && \umount /mnt && \ echo u > /proc/sysrq-trigger && \dd if =chr.img of=$DISK bs=1024 && \reboot LATESTVER=`curl -s http://upgrade.mikrotik.com/routeros/LATEST.6 |awk '{print $1}' ` URL=https://download.mikrotik.com/routeros/$LATESTVER /chr-$LATESTVER .img.zip wget $URL -O chr.img.zip && \ gunzip -c chr.img.zip > chr.img && \ mount -o loop,offset=512 chr.img /mnt && \ ADDRESS=`ip addr show ens33 | grep global | cut -d' ' -f 6 | head -n 1` && \ GATEWAY=`ip route list | grep default | cut -d' ' -f 3` && \ echo "/ip dhcp-client dis 0 /ip address add address=$ADDRESS interface=[/interface ethernet find where name=ether1] /ip route add gateway=$GATEWAY /ip dns set server=114.114.114.114,8.8.8.8 /user set admin password=1212" > /mnt/rw/autorun.scr && \umount /mnt && \ echo u > /proc/sysrq-trigger && \dd if =chr.img bs=1024 of=/dev/sda && \reboot /etc/sysconfig/network-scripts/ifcfg-ens33/ BOOTPROTO=static ONBOOT=yes IPADDR=10.60.200.50 NETMASK=255.255.255.0 GATEWAY=10.60.200.254 DNS1=114.114.114.114 DNS2=114.114.115.115 systemctl restart network
VMware chr install too 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 URL=https://download.mikrotik.com/routeros/7.11/chr-7.11.img.zip wget --no-check-certificate $URL -O chr.img.zip LATESTVER=`curl -s http://upgrade.mikrotik.com/routeros/LATEST.6 |awk '{print $1}' ` URL=https://download.mikrotik.com/routeros/$LATESTVER /chr-$LATESTVER .img.zip wget --no-check-certificate $URL -O chr.img.zip && \ gunzip -c chr.img.zip > chr.img && \ OFFSET=`fdisk -lu chr.img|grep Start -A2 |tail -n 1|awk '{print $2}' ` OFFSET=$[OFFSET*512] mount -o loop,offset=$OFFSET chr.img /mnt && \ DISK=$(mount | grep ' / ' | cut -d' ' -f1 | sed 's/[0-9]*$//g' ) && \ 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 dhcp-client dis 0 /ip address add address=$ADDRESS interface=[/interface ethernet find where name=ether1] /ip route add gateway=$GATEWAY /ip dns set server=8.8.8.8,8.8.4.4 /user set admin password=1212" > /mnt/rw/autorun.scr && \umount /mnt && \ echo u > /proc/sysrq-trigger && \dd if =chr.img of=$DISK bs=1024 && \reboot LATESTVER=`curl -s http://upgrade.mikrotik.com/routeros/LATEST.6 |awk '{print $1}' ` URL=https://download.mikrotik.com/routeros/$LATESTVER /chr-$LATESTVER .img.zip wget $URL -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 dhcp-client dis 0 /ip address add address=$ADDRESS interface=[/interface ethernet find where name=ether1] /ip route add gateway=$GATEWAY /ip dns set server=8.8.8.8,8.8.4.4 /user set admin password=1212" > /mnt/rw/autorun.scr && \umount /mnt && \ echo u > /proc/sysrq-trigger && \dd if =chr.img bs=1024 of=/dev/vda && \reboot /etc/sysconfig/network-scripts/ifcfg-ens33/ BOOTPROTO=static ONBOOT=yes IPADDR=10.60.200.50 NETMASK=255.255.255.0 GATEWAY=10.60.200.254 DNS1=114.114.114.114 DNS2=114.114.115.115 systemctl restart network
DNS