静看光阴荏苒
不管不顾不问不说也不念

在Linode上使用Proxmox开只有IPv6的LXC小小鸡

前段时间找Linode客服搞了一个/64的IPv6拿来搭了个NAT64+DNS64,玩腻了,现在重新利用下这些v6。。

看到最近很多国外商家频繁推出IPv6 Only小鸡,我也想自己试试看能不能生几只这样的小鸡出来。

首先在Linode的账号设置界面把这个Network Helper给关了,否则每次重启的时候它会自动还原你的网卡配置:

安装PVE6.X,装完之后重启:

echo "deb http://download.proxmox.com/debian/pve buster pve-no-subscription" > /etc/apt/sources.list.d/pve-install-repo.list
wget http://download.proxmox.com/debian/proxmox-ve-release-6.x.gpg -O /etc/apt/trusted.gpg.d/proxmox-ve-release-6.x.gpg
apt -y update && apt -y full-upgrade
apt -y install proxmox-ve postfix open-iscsi
reboot

开IPv6转发(很重要,否则待会小鸡分配的v6地址没网)

echo "net.ipv6.conf.all.forwarding = 1" >> /etc/sysctl.conf && sysctl -p

Linode默认的网卡配置是使用的DHCP,这里要改为静态,否则每次重启后DNS的设置会被DHCP自动还原。

编辑网卡配置文件:

nano /etc/network/interfaces

我的配置:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
iface eth0 inet static
        address 173.255.244.90 # VPSIPv4地址
        gateway 173.255.244.1 # VPSIPv4网关

iface eth0 inet6 static
        address 2600:3c01::f03c:92ff:fe60:07e3/64 # VPSIPv6地址
        gateway fe80::1 # VPSIPv6网关

auto vmbr0
iface vmbr0 inet static
        address 192.168.0.1
        netmask 255.255.255.0
        bridge_ports none
        bridge_stp off
        bridge_fd 0
        post-up echo 1 > /proc/sys/net/ipv4/ip_forward
        post-up iptables -t nat -A POSTROUTING -s '192.168.0.0/24' -o eth0 -j MASQUERADE
        post-down iptables -t nat -D POSTROUTING -s '192.168.0.0/24' -o eth0 -j MASQUERADE

auto vmbr1
iface vmbr1 inet6 static
        address 2600:3c01:e000:0396::1/64 # 你找Linode申请的IPv6Pool,拿出来一个地址做vmbr1的网关
        bridge_ports none
        bridge_stp off
        bridge_fd 0

这里有个坑,由于安装Proxmox之前网卡是使用的DHCP模式,Linode会自动给你分配一个hostname。

格式类似这样:li254-90.members.linode.com

Proxmox安装完成之后的WEBUI会根据这个hostname生成一个自签名的证书,现在改为静态地址后hostname不在了,Proxmox就找不到地址了,导致Proxmox的WEB界面打不开。

所以这里修改机器的hostname:

hostnamectl set-hostname li254-90

这个hostname在Linode每台机器的网络界面可以查的到:

当然你也可以在安装Proxmox之前就先把网卡配置成静态地址,之后再安装Proxmox这样就不会存在这个问题了,只是我比较懒,拿之前水这篇文章的机器直接操作的233:

Proxmox的LXC容器内运行Docker

做完上面的配置之后,重启一下机器:

reboot

现在安装RADVD让小鸡支持SLAAC,实现无状态自动分配IPv6地址:

apt -y install radvd

新建RADVD的配置文件:

nano /etc/radvd.conf

写入如下配置:

interface vmbr1 # 网卡名
{
        AdvSendAdvert on;
        MinRtrAdvInterval 30;
        MaxRtrAdvInterval 100;
        prefix 2600:3c01:e000:0396::/64 # 你找Linode申请的IPv6Pool
        {
                AdvOnLink on;
                AdvAutonomous on;
                AdvRouterAddr on;
        };
};

重启RADVD/设置开机自启:

systemctl restart radvd
systemctl enable radvd

接下来打开Proxmox的WEBUI,在DNS这里修改一个IPv6的DNS:

现在我们就可以来开IPv6 Only小鸡了,创建的时候,网络选择桥接vmbr1,IPv4留空,IPv6地址直接选择SLAAC即可:

启动小鸡测试一下,RADVD可以分配IPv6地址,并且网络是通的:

在别的小鸡上测试下:

赞(4)
未经允许不得转载:荒岛 » 在Linode上使用Proxmox开只有IPv6的LXC小小鸡
分享到: 更多 (0)

评论 15

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
  1. #1

    能打开面板了 哈哈

    pony4年前 (2020-04-08) Google Chrome 78.0.3904.108 Google Chrome 78.0.3904.108 Windows 7 x64 Edition Windows 7 x64 Edition回复
  2. #2

    lala明天来机房上班 :oops:

    橘子4年前 (2020-04-08) Google Chrome 77.0.3833.83 Google Chrome 77.0.3833.83 Windows 10 Windows 10回复
    • 上鸡儿班 :neutral:

      LALA4年前 (2020-04-10) Google Chrome 81.0.4044.92 Google Chrome 81.0.4044.92 Windows 10 x64 Edition Windows 10 x64 Edition回复
  3. #3

    lala你博客的毒鸡汤怎么弄的?

    Foliage4年前 (2020-04-09) Chrome 80.0.3987.95 Chrome 80.0.3987.95 iPhone iOS 13.4 iPhone iOS 13.4回复
    • 底下那个一言吗?用的这个:https://hitokoto.cn/

      LALA4年前 (2020-04-10) Google Chrome 81.0.4044.92 Google Chrome 81.0.4044.92 Windows 10 x64 Edition Windows 10 x64 Edition回复
      • 不是很明白,是不是要用他的开源搭建?

        Foliage4年前 (2020-04-10) Google Chrome 81.0.4044.92 Google Chrome 81.0.4044.92 Windows 10 x64 Edition Windows 10 x64 Edition回复
  4. #4

    服务器分配了/48的ipv6,怎么找一个地址做vmbr1的网关额 :cry:

    Yalisiting3年前 (2021-02-05) Google Chrome 78.0.3904.108 Google Chrome 78.0.3904.108 Windows 10 x64 Edition Windows 10 x64 Edition回复
    • 抱歉回复的比较晚,最近没咋看博客,随便找一个地址都可以的,只要在你的这个网段内就行,天马行空的想象力发挥一下 :neutral:

      LALA3年前 (2021-02-11) Google Chrome 86.0.4240.198 Google Chrome 86.0.4240.198 Windows 10 x64 Edition Windows 10 x64 Edition回复
      • IPv6是2604:5040:a388::/48,但是客服说要用2604:5040:a388::2/32(网关2604:5040::1),我用2604:5040:a388:0396::1/64做vmbr1的网关,将2604:5040:a388::/48写在radvd.conf中,但是radvd启动失败,提示
        /etc/radvd.conf:1 error: syntax error, unexpected STRING, expecting T_INTERFACE
        radvd[6698]: exiting, failed to read config file
        这怎么搞吖 :cry: 。谢谢!

        Yalisiting3年前 (2021-04-12) Google Chrome 86.0.4240.198 Google Chrome 86.0.4240.198 Windows 10 x64 Edition Windows 10 x64 Edition回复
  5. #5

    大佬 eth0 inet6 该怎么写啊,我抄你的行不行 :cry:
    我试过把我的::2/64写进去 网关我写::1
    vmbr1 inet6 我也写了::1/64
    RADVD写了完整的::1/64 然后小鸡获取到ipv6,但是不通外网 :eek: :eek: :cry:
    大佬帮我解解惑

    meilinhost3年前 (2021-09-13) Google Chrome 92.0.4515.131 Google Chrome 92.0.4515.131 Android 10 Android 10回复
    • 能获取到ipv6那只能说明radvd是在正常工作的,不通外网应该还是你配置哪里有问题,如果你也用的linode直接抄我的配置应该就行了,要不行的话那这种问题评论里面也说不清楚,得实际看你的网络情况和机器里面的配置。。

      LALA3年前 (2021-09-14) Google Chrome 93.0.4577.63 Google Chrome 93.0.4577.63 Windows 10 x64 Edition Windows 10 x64 Edition回复
      • 我不是linode,我是虚幻家杜甫,求帮助大佬,我已经折腾3天了 :cry: 我留个tg可否Meilinhost

        meilinhost3年前 (2021-09-14) Google Chrome 92.0.4515.131 Google Chrome 92.0.4515.131 Android 10 Android 10回复
        • 抱歉回复晚了,不是linode的话那得看商家的网络是怎么配置的,我这个配置只在linode上测试可用。。

          LALA3年前 (2021-09-22) Google Chrome 86.0.4240.198 Google Chrome 86.0.4240.198 Windows 10 x64 Edition Windows 10 x64 Edition回复
  6. #6

    我這邊是用 hetzner 服務器的,用你這個方案會有一個問題,就是 Mac 地址會暴露,然後 Hetzner 就會發訊息過來要求我刪除 Mac 地址。有沒有辦法好像 isc-dhcp-server + nat 那樣去直接跑內遊路來防止這個問題?

    L2年前 (2022-07-15) Firefox 102.0 Firefox 102.0 Windows 10 x64 Edition Windows 10 x64 Edition回复

分享创造快乐

广告合作资源投稿