IPv6 address block assign/associate with an interface


 
Thread Tools Search this Thread
Special Forums IP Networking IPv6 address block assign/associate with an interface
# 1  
Old 05-01-2014
IPv6 address block assign/associate with an interface

Hello all,

I am trying to receive (tcp/udp/sctp) traffic from all IPs and, eventually, all ports of an IPv6 address block using as few sockets as possible short of implementing my own network stack.

One possible solution was to associate an IP block to an interface then bind to that interface, hence the question. I am open to other suggestions as well.

I know already that:
- it can be done by adding each IP individually to the interface via 'ip add' or in code using the IF API.
and, not necessarily regarding the question that:
- restrict bind to an interface via ioctl
- bind to ANY IP to 1 PORT

The problem with first approach is that it is not scalable.

Thanks
# 2  
Old 05-01-2014
What's your system?
# 3  
Old 05-01-2014
I am working on a 12.04 LTS Ubuntu, but I prefer a generic approach on any NIX system with stable kernel (BSD-like or Linux, Solaris/Illumos if must, no comercial offerings).
# 4  
Old 05-01-2014
Hm. There are plenty of solutions for this but no portable ones that I know of. It's not something a generic socket's really designed to do. Network devices filter out traffic that's not theirs, all the way down at the hardware level.

I foresee another problem. In the old days, a hub just copied traffic to everyone and let them sort it out (which is why network cards often filter out traffic for others in hardware), but most networks these days are switched. A switch wouldn't bother sending you a copy. Any traffic that doesn't have you as the destination mac address, you just wouldn't get. (except for broadcasts and the like of course.)
# 5  
Old 05-01-2014
Thank you

Assuming only the traffic (which is destined to a contiguous address IPv6 block say a /64) reaches an interface (physical or virtual) by means of routing and/or filtering rules. The original question remains.

BTW: I know both BSD and Linux have ways of assigning IPs to an interface.

Let's stick with Linux for now.

I have a block of IPv6 addresess (say 1111::/64) that I routed and filtered such that only these addresses hit eth0.

then I know I can for instance say
Code:
ip addr add 1111::1/64 dev eth0
ip addr add 1111::2/64 dev eth0

and so on up to
Code:
ip addr add 1111::ffff:ffff:ffff:fffe dev eth0

which I believe it becomes unmanageable hence the original question.

Any other suggestion or hints besides using a raw socket and implementing my own stack which is doable but I do not really want to reinvent the wheel since all that is already in the kernel.

Thanks
# 6  
Old 05-02-2014
On Linux, you would use an ioctl to put the network device into "promiscuous mode", where it would receive all packets, and use raw mode to read them from there.

Other operating systems will handle this differently.

You might take a look at darkstat, which implements generic traffic counting over an entire interface on Linux, OSX, Solaris, and Windows, probably in four different ways.

This does not bypass the switching issue. On a switched network, you won't get sent packets which aren't destined for you at all!
# 7  
Old 05-02-2014
Hmm. Yeah assigning 18 quintillion addresses to an interface would take lots of time and RAM. I imagine it wouldn't work ..

I suppose with Linux you could use ip6tables and DNAT to rewrite the entire /64 to go to a single IP. You'd need a kernel more recent than 3.8 though. I believe ipv6 NAT was added in 3.9.0.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

How to assign IPv4 and IPv6 addresses with same interface?

Hello dears how to assign IPv4 and IPv6 addresses with same interface on solaris 10 (1 Reply)
Discussion started by: ttashman
1 Replies

2. UNIX for Dummies Questions & Answers

Assigning ipv6 to bonding interface - getting old as well as changed ipv6 in ifconfig output

Hi, I have created a bonding bond1 interface with 6 Eth , mode=4. Recently i have changed my old ipv6 to new one and tried to restart as well as reload network service. Post which i can see old as well as changed ipv6 in ifconfig command output. Below are few files and command output for your... (1 Reply)
Discussion started by: omkar.jadhav
1 Replies

3. UNIX for Advanced & Expert Users

C program to detect duplicate ip address if any after assigning ip address to ethernet interface

Hi , Could someone let me know how to detect duplicate ip address after assigning ip address to ethernet interface using c program (3 Replies)
Discussion started by: Gopi Krishna P
3 Replies

4. Shell Programming and Scripting

How to extract IPv6 address from string?

Hi All, Would anyone know how to modify the below, so only the IPv6 address (red) is printed, please? (in other words, what's between inet6 and the / sign) ipv6=`/sbin/ifconfig lo0:5 inet6 | grep 'inet6'` print $ipv6 Currently the output of the above script is: inet6... (7 Replies)
Discussion started by: chatguy
7 Replies

5. BSD

Link Local IPv6 Address

Hi, Am using FreeBSD7.4/i386 During IPv6 configuration, I added the following in rc.conf as Restarted IPv6 network using /etc/rc.d/network_ipv6 restart.. My problem is I need to set link local IPv6 address auto-configured.. Is my proceeding right?? I feel something missing to make... (0 Replies)
Discussion started by: Priya Amaresh
0 Replies

6. Solaris

Solaris 19 10/09 ipv6 interface configuration

Hi, anyone has had experience in a static setting an IPv6 interface?, I'm trying accordance with the admin guide (ipv6 network configuration tasks), configure one interface in the server, actually i can do ping to my default gateway and access the Internet in IPv6, the specific point is however,... (3 Replies)
Discussion started by: pabloluja
3 Replies

7. Solaris

IPMP + IPv6 test address

Hi, inspired by this article, I decided to implement IPMP + IPv6 in Solaris 10. It worked for me only this way: 1. Setup # cat /etc/hostname* 10.23.10.113/24 broadcast + group data failover up <- hostname.e1000g0 0.0.0.0/24 broadcast + group data -failover deprecated up standby... (3 Replies)
Discussion started by: masloff
3 Replies

8. IP Networking

assign mac address for virtual interface eth1:0

Hi , by default the physical interface (eth1) and virtual interface eth1:0 will be having same mac address, is there any way we can assign separate mac addresses for both the interfaces. would some one help me out in this. Thanks Gopi (1 Reply)
Discussion started by: Gopi Krishna P
1 Replies

9. Solaris

How to assign MAC address to N/W interface in solaris

I m having interface ce0 ce1 and its sub interfaces for that. I want to give MAC addresses for the same. How will I assign it. Please give solution for the same (4 Replies)
Discussion started by: sunray
4 Replies

10. Programming

validate IPV6 address in windows using c++

I know there is a function inet_tpon for unix platforms to validate ipv6 addresses.But i need an equivalent of windows.When i use this function with the header file <winsock2.h> the visual studio 2005 on win2003 issues an error saying identifier not found :confused: (3 Replies)
Discussion started by: guru13
3 Replies
Login or Register to Ask a Question