用户操作
[留言]  [发消息]  [加为好友] 
订阅我的博客
XML聚合    FeedSky
订阅到鲜果
订阅到Google
订阅到抓虾
hailongchang的公告
<center> <a href="http://www3.clustrmaps.com/counter/maps.php?url=http://blog.csdn.net/hailongchang" id="clustrMapsLink"><img src="http://www3.clustrmaps.com/counter/index2.php?url=http://blog.csdn.net/hailongchang" style="border:0px;" alt="Locations of visitors to this page" title="Locations of visitors to this page" id="clustrMapsImg" onError="this.onError=null; this.src='http://www2.clustrmaps.com/images/clustrmaps-back-soon.jpg'; document.getElementById('clustrMapsLink').href='http://www2.clustrmaps.com'" /> </a></center> <br><br> <h5>最近在读...</h5><br> <center> <a href="http://www.amazon.com/Structure-Interpretation-Computer-Programs-Engineering/dp/0262011530/sr=8-1/qid=1164689869/ref=pd_bbs_1/002-5995427-4320807?ie=UTF8&s=books"> <img title='Structure and Interpretation of Computer Programs' width=175px height=150px src="http://ec1.images-amazon.com/images/P/0262011530.01._AA240_SCLZZZZZZZ_.jpg" border="0"> </a> <a href="http://www.amazon.com/o/ASIN/0072899050/ref=pd_rvi_gw_1/002-5995427-4320807"> <img title='Discrete Mathematics and its Apllications' width=175px height=150px src="http://ec1.images-amazon.com/images/P/0072899050.01._SS500_SCLZZZZZZZ_V1056416421_.jpg" border="0"> </a> <a href="http://www.amazon.com/Introduction-Algorithms-Thomas-H-Cormen/dp/0262032937"> <img title='Introduction to Algorithms' width=140px height=150px src="http://ec1.images-amazon.com/images/I/41WDWECWVCL._AA240_.jpg" border="0"> </a> <a href="http://www.china-pub.com/computers/common/info.asp?id=24853"> <img title='微积分和数学分析引论' width=120px height=150px src="http://www.china-pub.com/computers/ebook20001-25000/24853/zcover.gif" border="0"> </a></center>
文章分类
Linux&Unix
兰州大学开源社区
Mathematics
Mathematica Tutorial
博士家园论坛
Programming
CodeProject
存档

原创  用shell脚本批量连续更改FreeBSD主机ip 收藏

年前写过一个自动投票的小程序,因为对方的网站限制为一个ip地址一天只能投10票,所以这个自动投票的程序在设计初期主要是通过代理服务器投票,后来同事提供了局域网内的30个ip地址,虽然自动投票的代码已经完成了,但是在windows下手动更改ip,真的很累人,而windows的WMI编程又不会,最后找到一台不用的FreeBSD机器,写了个脚本,并配置为每天凌晨12点后运行,效果很好。

更改ip地址的脚本名为cip_vote,可以这样调用:
./cipvote fxp0 iptable.txt

其中fxp0是网卡的名称,iptable.txt是可以更改的ip地址列表,其格式为:

210.77.79.201        255.255.255.128        210.77.79.255
210.77.79.202        255.255.255.128        210.77.79.255
...

第一列为需要更改的IP地址,第二列为子网掩码,第三列为广播(broadcast)地址。

具体的更改ip的命令,可以参考ifconfig的在线手册,这里就不赘述了,下面是源代码:


发表于 @ 2009年02月03日 12:01:00 | 评论( loading... ) | 编辑| 举报| 收藏

旧一篇:Unix下UTF-8和GB2312互相转换的函数 | 新一篇:用程序网上投票参赛获奖

  • 发表评论
  • 评论内容:
  •  
Copyright © hailongchang
Powered by CSDN Blog