linux – 关闭Raspbian上的网络
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了linux – 关闭Raspbian上的网络,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1859字,纯文字阅读大概需要3分钟。
内容图文
![linux – 关闭Raspbian上的网络](/upload/InfoBanner/zyjiaocheng/958/d89cdb16ad2946fb9c816a54e29d8af2.jpg)
我正在尝试设置cron来在我的Raspberry Pi上关闭网络(从23:00到8:00).
问题是这些命令都不能完成这项任务:
$sudo service networking stop
$sudo ifconfig eth0 down
$sudo ifdown eth0
从输出看起来命令有效,但界面仍然正常(我可以ping 8.8.8.8并且它出现在ifconfig中).
这是/ etc / network / interfaces的内容
auto lo
iface lo inet loopback
auto eth0
allow-hotplug eth0
iface eth0 inet manual
auto wlan0
allow-hotplug wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
auto wlan1
allow-hotplug wlan1
iface wlan1 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
ifconfig的输出(掩码MAC)
eth0 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx
inet addr:192.168.1.102 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1545 errors:0 dropped:0 overruns:0 frame:0
TX packets:1054 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:117138 (114.3 KiB) TX bytes:156391 (152.7 KiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:8 errors:0 dropped:0 overruns:0 frame:0
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1104 (1.0 KiB) TX bytes:1104 (1.0 KiB)
路径输出-n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 202 0 0 eth0
192.168.1.0 0.0.0.0 255.255.255.0 U 202 0 0 eth0
有帮助吗?
解决方法:
在这里问到并解决了:https://raspberrypi.stackexchange.com/questions/33703/cant-turn-off-network#comment44003_33703
# service ifplugd stop && ifconfig eth0 down
在cron我通过sudo crontab -e添加
0 23 * * * /usr/sbin/service ifplugd stop && /sbin/ifconfig eth0 down
0 8 * * * /usr/sbin/service ifplugd start && /sbin/ifconfig eth0 up
内容总结
以上是互联网集市为您收集整理的linux – 关闭Raspbian上的网络全部内容,希望文章能够帮你解决linux – 关闭Raspbian上的网络所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。