Question

I am trying to port my application to ipv6 and my current code brings up alias IP addresses dynamically as shown:

eth0      Link encap:Ethernet  HWaddr 00:16:35:68:21:5B
          inet addr:192.168.1.245  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::216:35ff:fe68:215b/64 Scope:Link
          UP BROADCAST RUNNING  MTU:1500  Metric:1
          RX packets:278885750 errors:0 dropped:0 overruns:0 frame:0
          TX packets:68117973 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:68976932662 (64.2 GiB)  TX bytes:39384521280 (36.6 GiB)
          Interrupt:169

eth0:1    Link encap:Ethernet  HWaddr 00:16:35:68:21:5B
          inet addr:192.168.1.246  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING  MTU:1500  Metric:1
          Interrupt:169

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:16436  Metric:1
          RX packets:6060179 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6060179 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:2366257047 (2.2 GiB)  TX bytes:2366257047 (2.2 GiB)

eth0:1 will be added dynamically by the application. It uses ioctl to do this. I want to do the same for IPV6 address. I tried this Assign ipv6 address using ioctl. But the example code is adding IPV6 address to the existing interface eth0 instead of eth0:1 or eth0:2 even if I specify the interface name as eth0:1. Can anyone please help since I am new to IPV6.

Was it helpful?

Solution

This is normal behaviour. In IPv4 each interface could have only one address. To add more addresses you had to create 'fake' interfaces like eth0:1. IPv6 always has multiple addresses per interface so work-arounds like eth0:1 are not used for IPv6.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top