2

I have a /48 IPv6 and would like to chop these up into /112's that I can assign to my VPSes. I know how to assign them manually, e.g.

vzctl set 1 --ipadd ipv6IP --save

But how could I assign, for example, a full /112 at once?

Steven Monday
  • 13,599
  • 4
  • 36
  • 45
Daniel
  • 135
  • 1
  • 3
  • 17

2 Answers2

4

Use veth. In VE:

/sbin/ip -6 addr add IPv6_ADDR/112 dev eth0
alvosu
  • 8,437
  • 25
  • 22
0

That takes several steps:

  1. In the CT0 (the "host"), add a veth to the VE (the "VM"):

    vzctl set <CTID> --netif_add eth0
    
  2. In the CT0, enable IPv6 forwarding (net.ipv6.conf.all.forwarding=1 will do that, temporarily. Consult the docs of your OS for how to make that permanent.)

  3. In the CT0, add a route for the /112 to the VE's virtual interface. For example, assuming your VE has a CTID 1:

    ip -6 route add IP6_NET/112 dev veth1.0
    
  4. This concludes the setup in the CF0.

  5. Now, finally, in your VE add addresses you want to use (from the subnet) to the VE's eth0:

    ip -6 addr add IP6_IP dev eth0
    
earl
  • 2,971
  • 24
  • 16