
저는 두 개의 인터페이스(DHCP로 구성된 eth0과 고정 IP 주소로 구성된 eth1)가 있는 Ubuntu 16.04 시스템을 가지고 있습니다.
/etc/network/interfaces 파일에는 다음 구성이 있습니다.
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet dhcp
# The Secondary network interface
auto eth1
iface eth1 inet static
address 10.10.1.10
netmask 255.255.255.0
dns-nameservers 74.82.42.42 4.2.2.2
## Virtual Interfaces for virtual hosts
auto eth1:11
iface eth1:11 inet static
address 10.10.1.11
netmask 255.255.255.0
auto eth1:12
iface eth1:12 inet static
address 10.10.1.12
netmask 255.255.255.0
auto eth1:13
iface eth1:13 inet static
address 10.10.1.13
netmask 255.255.255.0
문제는 eth0 링크에서 DHCP 서버를 사용할 수 없거나 eth0 링크가 다운된 경우 시스템이 5분 동안 중단되어 부팅 프로세스 속도가 크게 느려진다는 것입니다.
violet@ubuntu-xenial:~$ systemd-analyze blame
5min 241ms networking.service
1.529s nmbd.service
1.524s winbind.service
/etc/systemd/system/network-online.target.wants/networking.service 파일에서 시간을 줄여 네트워크 서비스를 기다리지 않고 시스템을 더 빠르게 부팅하려고 시도했지만 eth1에서 가상 인터페이스를 로드하지 못했습니다.
eth0 인터페이스의 전체 네트워크 구성 없이 시스템을 부팅하고 eth1의 모든 정적 네트워크 구성을 계속 로드할 수 있는 더 깔끔한 방법이 있습니까?
답변1
누군가가 클라이언트가 제때에 DHCP를 받지 못하는 것에 대해 편집증적인 것 같습니다.
이 파일을 편집 하고 다음과 같은 합리적인 값으로 /etc/dhcp/dhclient.conf
설정하십시오 .timeout
timeout 15
기본값인 300초는 너무 높습니다. 제안된 대체 값인 15가 테스트되었으며 정상적으로 작동합니다.
답변2
따라서 에서 /etc/network/interfaces
다음을 변경하세요.
# The primary network interface
auto eth0
iface eth0 inet dhcp
이에:
# The primary network interface
allow-hotplug eth0
iface eth0 inet dhcp
eth0
이는 부팅 시 인터페이스를 시작하는 대신 커널이 인터페이스에서 핫플러그 이벤트를 감지할 때(즉, 케이블을 연결할 때) 인터페이스를 시작합니다 .
답변3
에서 참조한 바와 같이네트워크 인터페이스를 높이기 위한 시간 초과 값을 변경할 수 있습니다(실행 중인 경우 systemd
).
터미널 창을 열고 다음 명령을 입력합니다.
sudo nano /etc/systemd/system/network-online.target.wants/networking.service
그런 다음 선을 TimeoutStartSec=5min
선택한 값으로 변경합니다. Ctrl+를 누른 o다음 Ctrl+를 눌러 파일을 저장합니다 x.
마지막으로 데몬을 다시 시작합니다.
sudo systemctl daemon-reload