0

I have /64 subnet ipv6 addresses. My intent is to use them as different outgoing ip addresses for cURL.

When I add following line to "/etc/network/interfaces" it works like a charm but when the file increases like eth0:65000 the server breaks down and I can not connect it anymore from ssh.

auto eth0:1
iface eth0:1 inet6 static 
address 2001:db8:5555:6666:0000:0000:0000:0000 
netmask 64 
gateway 2001:db8:5555:6666:0000:0000:0000:0000 
autoconf 0 
dns-nameservers 2001:4860:4860::8844 2001:4860:4860::8888 8.8.8.8 
post-up ip -6 addr add 2001:db8:5555:6666:0000:0000:0000:0000/64 dev 

Is there a way to use each of the ipv6 address as an outgoing ip address?

if it helps sysctl.conf file content

net.ipv6.conf.all.autoconf = 0
net.ipv6.conf.default.autoconf = 0
net.ipv6.conf.eth0.autoconf = 0
net.ipv6.conf.all.accept_ra = 0
net.ipv6.conf.default.accept_ra = 0
net.ipv6.conf.eth0.accept_ra = 0
net.core.somaxconn = 4096

Thanks.

Cory Knutson
  • 1,866
  • 12
  • 20
kylngr
  • 1
  • With IPv6, all addresses in a block are valid addresses, including the all-zeroes address, which you are assigning. There are some addresses reserved for special things (see _[RFC 2526, Reserved IPv6 Subnet Anycast Addresses](https://tools.ietf.org/rfc/rfc2526.txt)_), and the all-zeroes address is reserved as the router anycast address (see IANA _[Internet Protocol Version 6 (IPv6) Anycast Addresses](https://www.iana.org/assignments/ipv6-anycast-addresses/ipv6-anycast-addresses.xhtml)_).. – Ron Maupin May 28 '17 at 16:45

1 Answers1

0

You can use parameter --interface on curl to use a specific interface IP.

Configure each ip you need to use as a subinterface of eth0, and, call curl with --interface parameter. If you need to use all configured IPs, use a while.

Sakura Kinomoto
  • 113
  • 1
  • 8