내 Debian 9 컴퓨터에는 세 개의 인터페이스가 있습니다. 전체 시스템에 대한 기본 경로를 영구적으로 설정해야 합니다. 다른 방법으로 /etc/network/interfaces 파일에 추가해 보았지만 올바른 옵션을 찾을 수 없는 것 같습니다. 인터페이스 섹션과 파일 하단에 다운링크를 넣었지만 그 중 아무 것도 작동하지 않는 것 같습니다. 올바른 구문은 무엇입니까? 모든 경로는 ens256에서 나와야 하며 모든 로컬 경로는 다른 인터페이스에서 나와야 합니다.
# The primary network interface
allow-hotplug ens192
iface ens192 inet static
address 10.21.30.10
netmask 255.255.255.0
gateway 10.21.30.254
down route del default gw 10.21.30.254
allow-hotplug ens224
iface ens224 inet static
address 10.21.10.10
netmask 255.255.255.0
gateway 10.21.10.254
down route del default gw 10.21.10.254
allow-hotplug ens256
iface ens256 inet static
address 1.2.3.157
netmask 255.255.255.248
gateway 1.2.3.153
dns-nameservers 4.2.2.2 8.8.8.8
up route add default gw 1.2.3.153
게시물 구성을 파일 끝에 넣으면. "1.2.3.153 dev ens256 추가 기본값을 통한 post-up /bin/ip 경로" 이것은 작동합니다. 인터넷에 핑을 보낼 수는 있지만 apt-get을 실행할 수 없는 것 같습니다. 이것을 실행하면 다음 오류가 발생합니다.
Ign:1 http://security.debian.org/debian-security stretch/updates InRelease
Err:2 http://security.debian.org/debian-security stretch/updates Release
Connection failed [IP: 199.232.32.204 80]
Ign:3 http://ftp.us.debian.org/debian stretch InRelease
Ign:4 http://ftp.us.debian.org/debian stretch-updates InRelease
Err:5 http://ftp.us.debian.org/debian stretch Release
Connection failed [IP: 208.80.154.15 80]
Err:6 http://ftp.us.debian.org/debian stretch-updates Release
Connection failed [IP: 64.50.233.100 80]
Reading package lists... Done
E: The repository 'http://security.debian.org/debian-security stretch/updates Release' does no longer have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'http://ftp.us.debian.org/debian stretch Release' does no longer have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'http://ftp.us.debian.org/debian stretch-updates Release' does no longer have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
답변1
게이트웨이 케이블은 하나만 있어야 한다고 생각합니다.
답변2
나는 다음과 같은 것을 가지고 있습니다여기
allow-hotplug ens192
iface ens192 inet static
address 10.21.30.10/24
gateway 10.21.30.254
down /bin/ip route del default via 10.21.30.254
allow-hotplug ens224
iface ens224 inet static
address 10.21.10.10/24
gateway 10.21.10.254
down /bin/ip route del default via 10.21.10.254
allow-hotplug ens256
iface ens256 inet static
address 1.2.3.157/29
up /bin/ip route add default via 1.2.3.153 dev ens256
up
또는 지시문 뒤에 post-up
실제로 원하는 명령을 추가할 수 있습니다. 이 경우에는/bin/ip route
.
귀하의 질문은 주로 메소드의 구문에 관한 것입니다 static
. 이게 뭐야?man interfaces
가능한 것에 대해 이야기해야합니다.
IFACE OPTIONS
The following "command" options are available for every family and
method. Each of these options can be given multiple times in a single
stanza, in which case the commands are executed in the order in which
they appear in the stanza. (You can ensure a command never fails by
suffixing them with "|| true".)
pre-up command
Run command before bringing the interface up. If this command
fails then ifup aborts, refraining from marking the interface as
config‐ured, prints an error message, and exits with status 0. This
behavior may change in the future.
up command
post-up command
Run command after bringing the interface up. If this command fails
then ifup aborts, refraining from marking the interface as configured
(even though it has really been configured), prints an error message,
and exits with status 0. This behavior may change in the future.
down command
pre-down command
Run command before taking the interface down. If this command fails
then ifdown aborts, marks the interface as deconfigured (even though
it has not really been deconfigured), and exits with status 0. This
behavior may change in the future.
post-down command
Run command after taking the interface down. If this command fails
then ifdown aborts, marks the interface as deconfigured, and exits
with status 0. This behavior may change in the future.
description name
Alias interface by name
The static Method
This method may be used to define Ethernet interfaces with statically
allocated IPv4 addresses.
Options
address address
Address (dotted quad/netmask) required
netmask mask
Netmask (dotted quad or number of bits) deprecated
broadcast broadcast_address
Broadcast address (dotted quad, + or -) deprecated.
Default value: "+"
metric metric
Routing metric for default gateway (integer)
gateway address
Default gateway (dotted quad)
pointopoint address
Address of other end point (dotted quad). Note the spelling
of "point-to".
hwaddress address
Link local address or "random".
mtu size
MTU size
scope Address validity scope. Possible values: global, link, host
route
이는 옵션이 아님 을 알 수 있습니다 . 이렇게 하려면 또는 를 사용해야 합니다 /bin/ip route
. gateway
또한, dns-nameservers
선택 사항이 아닙니다. 당신은 사용해야합니다구성 파일 구문 분석이를 위해(또는 재정의된 경우 네트워크 관리자도 가능).