0

I'm new to IPv6 and I'm trying to figure out how to send request from a different IPv6 address. How do I do that?

I have bought a test VPS which says they give /112 IPv6 range. First of all, what exactly /112 means? I understand it as they giving some IPv6 range and the owner of VPS (me) is able to select which IPv6 he wants to use. Therefore there should be many IPv6 possibilities and I want to test it. If I make this curl request curl http://v4v6.ipv6-test.com/api/myip.php the result is 2a00:1630:66:d7::ae4c. Same with curl --interface 2a00:1630:66:d7::ae4c http://v4v6.ipv6-test.com/api/myip.php.

Now if my VPS has an IP range of many IPv6 possibilities, how can I choose another IPv6 to send the request from, so that the destination server also sees another IPv6? Which symbols of 2a00:1630:66:d7::ae4c can I edit that my VPS would be able to bind to? Not sure if my explanation makes sense, so here is what I tried:

curl --interface 2a00:1630:66:d7:1111:ae4c http://v4v6.ipv6-test.com/api/myip.php           
curl: (45) Couldn't bind to '2a00:1630:66:d7:1111:ae4c'        

The output of ifconfig is as follows:

lo        Link encap:Local Loopback                                                                          
          inet addr:127.0.0.1  Mask:255.0.0.0                                                                
          inet6 addr: ::1/128 Scope:Host                                                                     
          UP LOOPBACK RUNNING  MTU:65536  Metric:1                                                           
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0                                                 
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0                                               
          collisions:0 txqueuelen:0                                                                          
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)                                                             

venet0    Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00                          
          inet addr:127.0.0.2  P-t-P:127.0.0.2  Bcast:0.0.0.0  Mask:255.255.255.255                          
          inet6 addr: 2a00:1630:66:d7::ae4c/64 Scope:Global                                                  
          UP BROADCAST POINTOPOINT RUNNING NOARP  MTU:1500  Metric:1                                         
          RX packets:11896 errors:0 dropped:0 overruns:0 frame:0                                             
          TX packets:1446 errors:0 dropped:0 overruns:0 carrier:0                                            
          collisions:0 txqueuelen:0                                                                          
          RX bytes:17548894 (16.7 MiB)  TX bytes:113342 (110.6 KiB)                                          

venet0:0  Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00                          
          inet addr:192.168.1.237  P-t-P:192.168.1.237  Bcast:192.168.1.237  Mask:255.255.255.255            
          UP BROADCAST POINTOPOINT RUNNING NOARP  MTU:1500  Metric:1                        
2
  • Normally the IP address is agreed upon between you and the ISP. There are many possibilities, going from randomly assigned address to your choice via their console and even some require a call to their Support.
    – harrymc
    Commented Jun 13, 2018 at 10:29
  • @harrymc well I already have /112 ipv6 range, meaning I have 16bit of ipv6 combinations. I just don't know how to access them so that I could send requests from different ones in the same range
    – Gintas_
    Commented Jun 13, 2018 at 10:50

2 Answers 2

1

The /112 denotes the prefix for an address. It's also a common notation for IPv4. Essentially it's telling you that the number of bits are set to identify the network. The others are free to reference hosts on that network. Consider reading up on how subnetting works (there are questions on SU and plenty of online resources).

With IPv6 it depends on your configuration. Check your ifconfig or ip or ipconfig depending on system and you should be able to see your current network configuration. It should include information about your current IPv6 address(es).

As you get a whole net with IPv6 you can either set them up in a static fashion (common for servers) or you can look into something like the IPv6 privacy extension. Which does some magic in order to help your regular client to stay a bit more private.

6
  • ok, so could you just tell me steps of commands in order to be able to send requests from different ipv6 address? If I have /112, there are 16bits of ipv6 combinations I can use.
    – Gintas_
    Commented Jun 13, 2018 at 10:49
  • Yes, 16 bits are there to address hosts. Though you can't use all of them. I can't tell you what commands to because I don't know what OS you're using and as described there are multiple approaches. Also if you look at your output you will find you're running with a /64 subnet. For me the configuration looks a bit bogus with 127.0.0.2 assigned to an interface etc.
    – Seth
    Commented Jun 13, 2018 at 11:33
  • using linux, debian
    – Gintas_
    Commented Jun 13, 2018 at 12:39
  • In that case the debian wiki should have you covered. More recent would be the ip command which should also be available. The RFC has information about how the privacy extension works.
    – Seth
    Commented Jun 14, 2018 at 5:26
  • would you provide me a step by step example? I know these commands, that's why I'm writing here
    – Gintas_
    Commented Jun 14, 2018 at 6:06
0

Not sure if this is the problem:

The source IP address is taken from the network interface. If you have different hosts (or different network namespaces on one host), you can assign a different IP on each of those interfaces (or let the OS autoconfigure a different IP using the MAC address, if you set it up to do so, and if it gets the prefix). Then applications (e.g. ping) executed on differents hosts/namespaces will use this address.

Another option is to create several network interfaces with different IP address on the same host/namespace, or assign several IPv6 addresses to the same network interface. In that case, you will have to instruct your application to bind to the IP address you want to use (e.g. ping -S ...). Not all applications can do that.

If you have a single host for this IP range, I recommend using network namespaces, or you might use infrastructure that uses network namespaces (Docker etc.).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .