service networking restart //重啓網絡服務 stop: Job failed while stopping start: Job is already running: networking
tail -f /var/log/upstart/networking.log //查看錯誤日誌 Stopping or restarting the networking job is not supported. Use ifdown & ifup to reconfigure desired interface.
從以上日誌內容能夠看出,傳統的service重啓和中止網絡已經再也不支持了,須要經過使用ifdown & ifup來實現相應的操做。網絡
- 重啓指定網卡
ifdown eth0 && ifup eth0
- 重啓除lo網卡的全部網卡
ifdown --exclude=lo -a && sudo ifup --exclude=lo -a
- 配置橋接
# apt-get install bridge-utils # cat /etc/network/interfaces auto lo iface lo inet loopback auto eth0 iface eth0 inet manual auto br0 iface br0 inet static address 192.168.0.10 netmask 255.255.255.0 gateway 192.168.0.1 bridge_ports eth0 bridge_stp off bridge_fd 0 bridge_maxwait 0 dns-nameservers 192.168.0.1 # ifup br0 # brctl show bridge name bridge id STP enabled interfaces br0 8000.02000a0080e1 no eth0