私のDebian 9コンピュータには3つのインターフェースがあります。システム全体のデフォルトパスを永久に設定する必要があります。別の方法で/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パス"これは機能します。インターネットにpingを送信できますが、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
ゲートウェイケーブルは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
オプションではありません。使用する必要があります構成ファイルの解析この目的のために(または上書きされた場合はネットワーク管理者も可能です)。