eth0がデフォルトパスを追加できないようにブロック

eth0がデフォルトパスを追加できないようにブロック

私は私のLinuxシステムのデフォルトルーティングテーブルにデフォルトパスを追加するのを防ぐ方法を探しています。私はDebianディストリビューション(Jessie - 8.0)を持っており、/etc/network/interfaces現在の設定は次のとおりです。

設定されている場合

eth0      Link encap:Ethernet  HWaddr b8:27:eb:4b:f4:9e  
          inet addr:172.16.2.82  Bcast:172.16.3.255  Mask:255.255.252.0
          inet6 addr: fe80::ba27:ebff:fe4b:f49e/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2311 errors:0 dropped:0 overruns:0 frame:0
          TX packets:203 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:187402 (183.0 KiB)  TX bytes:22251 (21.7 KiB)

ppp0      Link encap:Point-to-Point Protocol  
          inet addr:10.178.142.185  P-t-P:192.200.1.21  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:36 errors:0 dropped:0 overruns:0 frame:0
          TX packets:56 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3 
          RX bytes:2918 (2.8 KiB)  TX bytes:3426 (3.3 KiB)

/etc/ネットワーク/インターフェース

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp
post-up /sbin/route del default dev eth0

IP ルート表示テーブルマスター

default dev ppp0  scope link 
default via 172.16.0.40 dev eth0  metric 202 
10.64.64.65 dev ppp1  proto kernel  scope link  src 10.181.104.9 
169.254.0.0/16 dev wlan0  proto kernel  scope link  src 169.254.23.201  metric 303 
169.254.0.0/16 dev wwan0  proto kernel  scope link  src 169.254.62.145  metric 305 
172.16.0.0/22 dev eth0  proto kernel  scope link  src 172.16.2.160  metric 202 
192.168.42.0/24 dev wlan0  proto kernel  scope link  src 192.168.42.1 
192.200.1.21 dev ppp0  proto kernel  scope link  src 10.179.96.79 

残念ながら、この方法はケーブルを物理的に接続してIPを割り当てるときは機能せず、ifup eth0を使用してインターフェイスを呼び出すときにのみ機能します。それにもかかわらず、このアプローチはデフォルトのエントリを削除せず、ifupでは次のエラーが発生します。

    Internet Systems Consortium DHCP Client 4.3.1
    Copyright 2004-2014 Internet Systems Consortium.
    All rights reserved.
    For info, please visit https://www.isc.org/software/dhcp/

    Listening on LPF/eth0/b8:27:eb:4b:f4:9e
    Sending on   LPF/eth0/b8:27:eb:4b:f4:9e
    Sending on   Socket/fallback
    DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 6
    DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 11
    DHCPREQUEST on eth0 to 255.255.255.255 port 67
    DHCPOFFER from 172.16.0.8
    DHCPACK from 172.16.0.8
    eminstBootdpxeboot.com option - discarded
    eminstBootdpxeboot.com option - discarded
    bound to 172.16.2.82 -- renewal in 12663 seconds.
    SIOCDELRT: No such process
    Failed to bring up eth0.

eth0を介してデフォルトパスが追加されないようにする正しい方法を知りたいです。いいえeth0は手動で起動する必要がありifup(ポストアップを利用するために)、代わりに起動時に初期化されるeth0が使用されます。

ベストアンサー1

DHCP クライアントがアドレスとともにデフォルトのルート設定を要求しないように、ステートメントを編集して/etc/dhcp/dhclient.conf削除します。routersrequest

おすすめ記事