우분투 14.04에서는 sudo service networking restart도 sudo /etc/init.d/networking restart도 더 이상 아무것도 하지 않는다. 둘 다 코드 1로 종료됩니다. 무언가가 분명히 바뀌었지만 나는 무엇을 찾을 수 없다. 이로 인해 원격 네트워크 재구성 및 Ansible과 같은 도구에 문제가 발생하는 것이 분명합니다.
$ sudo bash -x /usr/sbin/service networking restart
[sudo] password for wirehive:
++ basename /usr/sbin/service
+ VERSION='service ver. 0.91-ubuntu1'
++ basename /usr/sbin/service
+ USAGE='Usage: service < option > | --status-all | [ service_name [ command | --full-restart ] ]'
+ SERVICE=
+ ACTION=
+ SERVICEDIR=/etc/init.d
+ OPTIONS=
+ '[' 2 -eq 0 ']'
+ cd /
+ '[' 2 -gt 0 ']'
+ case "${1}" in
+ '[' -z '' -a 2 -eq 1 -a networking = --status-all ']'
+ '[' 2 -eq 2 -a restart = --full-restart ']'
+ '[' -z '' ']'
+ SERVICE=networking
+ shift
+ '[' 1 -gt 0 ']'
+ case "${1}" in
+ '[' -z networking -a 1 -eq 1 -a restart = --status-all ']'
+ '[' 1 -eq 2 -a '' = --full-restart ']'
+ '[' -z networking ']'
+ '[' -z '' ']'
+ ACTION=restart
+ shift
+ '[' 0 -gt 0 ']'
+ '[' -r /etc/init/networking.conf ']'
+ which initctl
+ grep -q upstart
+ initctl version
+ case "${ACTION}" in
+ stop networking
stop: Job failed while stopping
+ :
+ exec start networking
start: Job is already running: networking
Ubuntu 14.04 Server에서 원격으로 네트워킹을 다시 시작하는 올바른 방법은 무엇입니까?
이것은 "특징"인 것으로 밝혀졌습니다. Ubuntu Server에서 인터페이스를 다시 시작하는 *** 유일한 방법은 'sudo ifdown eth0 &&sudo ifup eth0'입니다.
https://bugs.launchpad.net/ubuntu/+source/ifupdown/+bug/1301015
달라진 점은 그들이 더 이상 네트워크 폭주를 원하지 않는다는 것입니다. 멈추고, 시작하고, 여전히 일하고 있습니다. 다시 시작이 더 이상 작동하지 않습니다. 저는 방금 이 문제를 해결했는데, 다시 말해 예전 행동을 되찾았다는 뜻입니다. 이전 동작으로 되돌리려면: 13.10 /etc/init/networking.conf 파일을 가져와 14.04 파일로 대체합니다. (편집: 어떤 것이 어떤 것을 대체하는지 명확히 함)
프로세스는 다음과 같습니다.
(Just before this, I configured my /etc/network/interfaces for eth1 on a 192.168.117.x address)
"/etc/network/interfaces" 16L, 413C written
root@1404-Anode:~# service networking restart
stop: Job failed while stopping
start: Job is already running: networking
root@1404-Anode:~# echo "hmm, wth?"
hmm, wth?
root@1404-Anode:~# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0c:29:d6:a8:19
inet addr:192.168.115.105 Bcast:192.168.115.255 Mask:255.255.255.0
inet6 addr: 2002:4077:9050:1234:a08c:29c1:ce9b:a57b/64 Scope:Global
inet6 addr: fe80::20c:29ff:fed6:a819/64 Scope:Link
inet6 addr: 2002:4077:9050:1234:20c:29ff:fed6:a819/64 Scope:Global
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:646 errors:0 dropped:0 overruns:0 frame:0
TX packets:531 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:58748 (58.7 KB) TX bytes:75465 (75.4 KB)
(lo removed here)
root@1404-Anode:~# cd /etc/init
root@1404-Anode:/etc/init# diff networking.conf.1310 networking.conf.1404
13c13
< and (stopped udevtrigger or container)) or runlevel [2345]
---
> and (stopped udevtrigger or container)) or runlevel [2345] or stopped networking >RESULT=failed PROCESS=post-stop EXIT_STATUS=100
16a17,20
> if [ "$UPSTART_EVENTS" = "stopped" ] && [ "$UPSTART_JOB" = "networking" ] && [ "$EXIT_STATUS" = "100" ]; then
> exit 0
> fi
>
21a26,31
> if [ -z "$UPSTART_STOP_EVENTS" ]; then
> echo "Stopping or restarting the networking job is not supported."
> echo "Use ifdown & ifup to reconfigure desired interface."
> exit 100
> fi
root@1404-Anode:/etc/init#
/etc/init.d/networking.conf 파일이 참조/호출하는 /etc/init.d/networking 스크립트에 대해서도 동일하게 수행합니다.
root@1404-Anode:/etc/init# cp networking.conf.1310 networking.conf
root@1404-Anode:/etc/init# cd ../init.d
root@1404-Anode:/etc/init.d# diff networking.1404 networking.1310
15d14
< STATEDIR="$RUN_DIR/state"
21a21,27
> # Make sure that it's clear to the user that they shouldn't use this
> # script under upstart
> if init_is_upstart; then
> echo "ERROR: Calling a sysvinit script on a system using upstart isn't supported. Please use the 'service' command instead."
> exit 1
> fi
>
52,54d57
< if ! chown root:netdev "$RUN_DIR" ; then
< log_warning_msg "can't chown $RUN_DIR"
< fi
160,162d162
< if init_is_upstart; then
< exit 1
< fi
166c166
< state=$(ifquery --state)
---
> state=$(cat /run/network/ifstate)
root@1404-Anode:/etc/init.d# cp networking.1310 networking
root@1404-Anode:/etc/init.d# service networking restart
networking stop/waiting
networking start/running
root@1404-Anode:/etc/init.d# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0c:29:d6:a8:19
inet addr:192.168.115.105 Bcast:192.168.115.255 Mask:255.255.255.0
inet6 addr: 2002:4077:9050:1234:a08c:29c1:ce9b:a57b/64 Scope:Global
inet6 addr: fe80::20c:29ff:fed6:a819/64 Scope:Link
inet6 addr: 2002:4077:9050:1234:20c:29ff:fed6:a819/64 Scope:Global
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3398 errors:0 dropped:0 overruns:0 frame:0
TX packets:2545 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:318654 (318.6 KB) TX bytes:418804 (418.8 KB)
eth1 Link encap:Ethernet HWaddr 00:0c:29:d6:a8:23
inet addr:192.168.117.105 Bcast:192.168.117.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fed6:a823/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:98 errors:0 dropped:58 overruns:0 frame:0
TX packets:15 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:20055 (20.0 KB) TX bytes:1226 (1.2 KB)
(lo removed)
root@1404-Anode:/etc/init.d# echo "hah, it works! *8^)"
Hah, it works! *8^)
root@1404-Anode:/etc/init.d#
(note: the steps where I scp'd the 1310 versions into the 1404 system are omitted for brevity).
분명히 거기에 방어용 출구를 설치한 이유가 있지만, 그들은 실제로 무슨 일이 일어나고 있는지 잘 보여주려고 애쓰지 않는다.
시도하면 /var/log/upstart/networking.log에 다음과 같은 항목이 들어갑니다.
Stopping or restarting the networking job is not supported.
Use ifdown & ifup to reconfigure desired interface.
그러나 서비스 네트워킹을 다시 시작할 때 대화 메시지로 출력할 수 있습니다. 아, 뭐. 그걸 알아냈고 심지어 옛날 방식도 알아냈죠
편집: 이로 인해 /etc/init/failsafe.conf에 의해 제어되는 스크립트가 의도하지 않게 트리거된다는 것을 발견했습니다. 이 스크립트는 모든 부팅에서 120초의 시간 초과 지연을 유발하므로 바람직하지 않습니다... 또한 이러한 지연의 출현이 시사하는 실제 잘못된 구성/네트워크 문제를 은폐할 수도 있지만 이미 항상 나타나고 있습니다. (예: /etc/fstab에 매핑된 네트워크 파일 공유에 액세스할 수 있도록 하는 분리 케이블)
어쨌든, 나는 이것이 항상 타임아웃에 도달하는 원인이 무엇인지 알아내서 내가 그것을 발견하면 수정 사항을 게시할 것이다.
나는 이 스크립트: 을 추가하십시오에서 이 스크립트"/etc/network/경우입니다.d"
cd /etc/network/if-down.d
vim ifdown
콘텐츠:
#!/bin/bash
for I in /sys/class/net/*
do
ifname=$(basename $I)
if [ $ifname != "lo" ] ; then
ip addr flush $ifname
fi
done
그리고 마지막으로:
chmod +x ifdown
지금 당신은 당신 ip 주소를 변경할 수 있습니다 그리고 다시 시작 네트워킹 서비스 systemctl 또는 서비스의 명령입니다. *참고:이 스크립트가 너무 간단하고처리하지 않**vm,탭,교량,...인터페이스가 있습니다. 실제로 넘치는 모든 인터페이스를 제외 lo(루프백).