Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm not 100% sure I'm using the correct terminology in the title, so if someone knows better than I do please amend it.

I'm trying to replicate a malicious script that I've seen in the wild for the purposes of testing my options to respond to it. It binds to a bunch of ip addresses on an IPv6 /64 and is then used to flood IRC from hundreds or thousands of different ip addresses. The fact that it's able to bind to different addresses allows it to bypass some automatic per-hostname throttling and cause trouble despite existing measures in place.

Basically, the problem I'm trying to solve boils down to this. I'm using a test machine running Ubuntu Server 13.10:

$ uname -a
Linux sandbox 3.11.0-12-generic #19-Ubuntu SMP Wed Oct 9 16:12:00 UTC 2013 i686 i686 i686 GNU/Linux

My network is setup in the following manner:

$ ifconfig
eth0      Link encap:Ethernet  HWaddr 00:18:f8:0d:c0:d5
          inet addr:192.168.2.100  Bcast:192.168.2.255  Mask:255.255.255.0
          inet6 addr: fe80::218:f8ff:fe0d:c0d5/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:9184009 errors:0 dropped:751 overruns:0 frame:57518
          TX packets:1143073 errors:12057087 dropped:0 overruns:0 carrier:23942906
          collisions:0 txqueuelen:1000
          RX bytes:1475317803 (1.4 GB)  TX bytes:287318593 (287.3 MB)

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:4007947 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4007947 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:663390993 (663.3 MB)  TX bytes:663390993 (663.3 MB)

The inet6 line of the eth0 listing indicates to me that the entire /64 upon which the listed address resides is allocated as link-local to this machine, but I'm not 100% sure this is true. In any case, the following command I'm using to test connectivity is failing to work as I expect:

$ telnet -6 -b fe80::1234:1234:1234:1234%eth0 fe80::218:f8ff:fe0d:c0d5%eth0 6667
telnet: bind: Cannot assign requested address

Am I incorrect in assuming that the entire /64 is allocated to this one machine? If it's not, how can I configure something that will allow this to work (a Host-only solution is fine since this is only for testing)? Otherwise, what should I be doing instead to correctly bind to this address?

share|improve this question
    
Why are you trying to specify the interface at the end of the address? fe80::1234:1234:1234:1234 %eth0 I don't think you need that for either the bind or host. –  heavyd Dec 3 '13 at 20:37
    
@heavyd: it's the scope id, which you need to specify for link local addresses since, theoretically, each different interface could have conflicting link-local addresses on it. Googling has indicated that you can specify this with %[number], where number is the number of a physical interface, but some systems will allow you to use %[interface name, such as eth0] instead. That's why that's there, and it fails to bind even to the listed address if it's not present. –  Wug Dec 3 '13 at 21:12
add comment

1 Answer

up vote 0 down vote accepted

fe80::/64 is the link-local prefix for the entire Ethernet LAN that eth0 is connected to. To give your machine another address on that network, you need to use something like ifconfig to tell your IPv6 stack to use that address before you can tell telnet to bind to it.

I don't recall the exact ifconfig syntax off the top of my head, but look at the add and alias subcommands in the man page.

share|improve this answer
    
OK, after using ifconfig eth0 add [address] I'm able to bind to whatever address I added. What use exactly is the cidr mask though? I seem to be able to specify any arbitrary cidr mask to the ifconfig line, and it will go through but only allow me to bind to whichever address is actually specified. Is this documented somewhere? My knowledge of the inner workings of IPv6 local networks is somewhat limited and I'd like to rtfm. –  Wug Dec 3 '13 at 21:06
    
The prefix length determines which addresses are on the link, which can be delivered directly. For all other addresses the packet is sent to the default gateway. It does not mean that your machine has multiple addresses in that prefix. –  Sander Steffann Dec 3 '13 at 22:52
    
@Wug For most intents and purposes, a single Ethernet LAN has a single /64, so you should just keep using /64. –  Spiff Dec 3 '13 at 23:49
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.