2-在esxi中安装openWrt
开启OpenWrt的wan口访问和ssh
使用以下脚本,chmod +x 赋予权限后运行即可
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
| #!/bin/sh FILE="/etc/config/firewall" if echo -e "config rule" >>$FILE echo -e "\toption target 'ACCEPT'" >>$FILE echo -e "\toption src 'wan'" >>$FILE echo -e "\toption proto 'tcp'" >>$FILE echo -e "\toption dest_port '22'" >>$FILE echo -e "\toption name 'SSH'\n" >>$FILE then echo "firewall has been modified(SSH)" fi
if echo -e "config rule" >>$FILE echo -e "\toption target 'ACCEPT'" >>$FILE echo -e "\toption src 'wan'" >>$FILE echo -e "\toption proto 'tcp'" >>$FILE echo -e "\toption dest_port '80'" >>$FILE echo -e "\toption name 'wanuhttpd'" >>$FILE then echo "firewall has been modified(web)" fi
if /etc/rc.d/S19firewall restart then echo "firewall has been restart" fi
|