Netplan ipv6“没有路由到主机”

问题描述 投票:-1回答:1

我显然配置了我的ipv6侦听器地址。问题1:我需要有人发现错误。还有一个奖励问题2:删除下面的“ / sbin / ip地址添加”命令是否有任何风险?

这是在ubuntu 18.04虚拟机上。

这是curl命令,显示ipv6路由设置不正确:

curl -vvv -L "http://[2600:1303:d000:1::17c3:4571]"
*   Trying 2600:1303:d000:1::17c3:4571...
* TCP_NODELAY set
* Immediate connect fail for 2600:1303:d000:1::17c3:4571: No route to host
* Closing connection 0
curl: (7) Couldn't connect to server

[以前,程序启动时,它发出了本机“ / sbin / ip地址添加”。事实证明这是有问题的,因为重置网络接口时,路由将丢失。

所以,我添加了/ etc / netplan,因为配置ipv6路由可以在网络重启后幸存下来。但是,我没有在启动时删除“ ip addr add”。当前,有两个命令用于设置路由:netplan和“ / sbin / ip地址添加”。这是执行命令的顺序:

1.  Manual one-time command of "/etc/netplan apply" which didn't return any errors.  

2.  "ip addr add" every time the server starts.  So, at least once since the manual netplan command.

这里是它正在监听的ipv6地址:

netstat -anp | grep redir | grep LISTEN
tcp6       0      0 2600:1303:d000:1::17:80 :::*                    LISTEN      3187/my-service
tcp6       0      0 2600:1303:d000:1::17:80 :::*                    LISTEN      3187/my-service
tcp6       0      0 2600:1303:d000:1::17:80 :::*                    LISTEN      3187/my-service
tcp6       0      0 2600:1303:d000:1::17:80 :::*                    LISTEN      3187/my-service
tcp6       0      0 2600:1303:d000:1::17:80 :::*                    LISTEN      3187/my-service

这是我希望它在听的内容:[2600:1303:c000:1 :: 15d4:456f]:80“[2600:1303:d000:1 :: 17c3:4570]:80“[2600:1303:d000:1 :: 17c3:4571]:80“[2600:1303:d000:1 :: 17c3:4572]:80“

这里是“ ip address add”命令。注意,我正在使用“ / 24”,我想知道这是否是问题。也许同时使用“ ip addr add”和netplan不能按预期工作。这是一个旧应用程序,因为我在这方面的网络技能不强,所以我不确定删除“ ip addr add”是否安全。我认为保留“ ip addr add”命令不会有任何伤害,但也许我错了。

out, e = exec.Command("/sbin/ip", "-6", "addr", "add", ip + "/24", "dev", "eth0").CombinedOutput()

这是我的netplan配置文件。注意,这只是文件的一部分;出于安全原因,我不包括mac地址,名称服务器或网关。但是,它们是正确的,因为我的ipv4地址有效。另外,出于安全原因,我也没有发布真正的ipv6地址。

root@ubuntu:~# cat /etc/netplan/50-cloud-init.yaml
# This file is generated from information provided by
# the datasource.  Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
    version: 2
    ethernets:
        eth0:
            addresses: [ '2600:1303:d000:1::17c3:456e/24', '2600:1303:d000:1::17c3:4570/24', '2600:1303:d000:1::17c3:4572/24', '2600:1303:d000:1::17c3:4571/24', '2600:1303:d000:1::17c3:456f/24' ]

预先感谢;)

linux networking ip ipv6 netplan
1个回答
0
投票

有两个问题:

  1. 没有网关6。
  2. 位掩码应该是“ / 64”而不是“ / 24”

Netplan不会删除旧路由。我必须执行以下步骤:

1.  ip -6 addr del 2600:1303:d000:1::17c3:456f/24 dev eth0
2.  netplan apply
© www.soinside.com 2019 - 2024. All rights reserved.