постоянный маршрут по умолчанию в Debian 9

Вы можете использовать унисон, но вместо этого попробуйте использовать 2 целевых корня, вы можете установить две конфигурации унисона, определить второй профиль с другим именем, например dc2, вы можете создать файл с именем profile.prf и вызвать унисон с именем профиля.

vi ~/.unison/default.prf
vi ~/.unison/dc2.prf


/usr/bin/unison 
/usr/bin/unison dc2
0
10.11.2020, 00:08
2 ответа

Я полагаю, что у вас должна быть только одна линия шлюза.

0
18.03.2021, 22:51

У меня было нечто подобное здесь

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тоже не вариант. Вам нужно будет использовать resolv.conf для этого (или, возможно, сетевой менеджер, если он перезаписывает его ).

0
18.03.2021, 22:51

Теги

Похожие вопросы