ubuntu临时修改ip,mac的方法示例

ifconfig eth0 down
ifconfig eth0 154.84.28.148 netmask 255.255.255.0
route add default gw 154.84.28.254
ifconfig eth0 hw ether AA:AA:AA:AA:AA:AA
ifconfig eth0 up

然后将这个脚本保存成一个文件,我这里假设取名为test.sh。
则在命令行执行sudo bash test.sh来生效。

posted @ 2018-03-03 20:34  zifeiy  阅读(637)  评论(0编辑  收藏  举报