Конфигурация статического IP

Debian / Ubuntu

если

Отредактируйте / etc / network / interfaces:

auto eth0
iface eth0 inet static
        address <your IPv4 address>
        netmask 255.255.255.255
        gateway 172.31.1.1
        pointopoint 172.31.1.1
        dns-nameservers 213.133.98.98 213.133.99.99 213.133.100.100


iface eth0 inet6 static
        address <one IPv6 address from your subnet, e.g. 2001:db8:0:3df1::1>
        netmask 64
        gateway fe80::1

netplan

Отредактируйте /etc/netplan/50-cloud-init.yaml

network:
  version: 2
  renderer: networkd
  ethernets:
    eth0:
      addresses:
        - <your IPv4 address>/32
        - <one IPv6 address from your subnet, e.g. 2001:db8:0:3df1::1>/64
      routes:
        - to: 0.0.0.0/0
          via: 172.31.1.1
          on-link: true
      gateway6: fe80::1

Deaktivieren der cloud-init Netzwerkanpassungen

Добавьте файл /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg:

network:
  config: disabled

Выполните следующую команду

 rm /etc/network/interfaces.d/50-cloud-init.cfg

Fedora / CentOS

Отредактируйте /etc/cloud/cloud.cfg.d/98-disable-network.cfg:

network:
  config: disabled

Отредактируйте / etc / sysconfig / network-scripts / ifcfg-eth0:

BOOTPROTO=static
DEVICE=eth0
HWADDR=<keep the HWADDR as is!!>
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
IPADDR=<your IPv4 address>
NETMASK=255.255.255.255
DNS1=213.133.98.98
DNS2=213.133.99.99
IPV6ADDR=<one IPv6 address from your subnet, e.g. 2001:db8:0:3df1::1>/64
IPV6INIT=yes
IPV6_DEFAULTGW=fe80::1%eth0
IPV6_DEFAULTDEV=eth0

Отредактируйте / etc / sysconfig / network-scripts / route-eth0:

 172.31.1.1/32 dev eth0
 default via 172.31.1.1 dev eth0

FreeBSD

Отредактируйте /etc/rc.conf

ifconfig_vtnet0="inet <your IPv4 address>/32"
static_routes="hetzner_cloud_gw"
route_hetzner_cloud_gw="172.31.1.1/32 -iface vtnet0"
defaultrouter="172.31.1.1"
ifconfig_vtnet0_ipv6="inet6 <one IPv6 address from your subnet, e.g. 2001:db8:0:3df1::1>/64"
ipv6_defaultrouter="fe80::1%vtnet0"

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *