Using the dummy0 interface for a local-only service to be broadcasted by Avahi

Stéphane Graber stgraber at ubuntu.com
Thu Dec 29 18:31:57 UTC 2016


On Thu, Dec 29, 2016 at 04:14:52PM -0200, Till Kamppeter wrote:
> On 12/29/2016 02:37 PM, Stéphane Graber wrote:
> > > How can I assign a different name to a dummy interface? Can I freely choose
> > > a name somehow, for example "ippusbxd"? Or have I to use "dummy1", "dummy2",
> > > ... (loading the dummy kernel module with an option to support more than one
> > > interface)?
> > 
> > root at castiana:~# ip link add ippusbxd type dummy
> > root at castiana:~# ip link set ippusbxd up
> > root at castiana:~# ifconfig ippusbxd
> > ippusbxd: flags=195<UP,BROADCAST,RUNNING,NOARP>  mtu 1500
> >         inet6 fe80::3004:2dff:feb6:b5c7  prefixlen 64  scopeid 0x20<link>
> >         ether 32:04:2d:b6:b5:c7  txqueuelen 1000  (Ethernet)
> >         RX packets 0  bytes 0 (0.0 B)
> >         RX errors 0  dropped 0  overruns 0  frame 0
> >         TX packets 2  bytes 140 (140.0 B)
> >         TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
> > 
> > 
> > Which gets you your own dummy device with its IPv6 link-local address.
> 
> Thank you very much. I copied and pasted the commands and got an ifconfig
> output similar to yours, only with different IP and MAC addresses and
> different values in the statistics.
> 
> Then I tried to bind to the IPv6 IP address of this entry, on port 60000 and
> this did not work.
> 
> Do I have to create an additional IP address? If yes, how? Do I have to run
> additional commands (route?)? Which ones?
> 
>    Till

Link-local addresses are slightly special in that they are indeed link local.

So you can't bind fe80::3004:2dff:feb6:b5c7 as you could in theory have
the same address on multiple interfaces. Instead, you need to tell
bind() what interface to bind on. This is typically indicated as
fe80::3004:2dff:feb6:b5c7%ippusbxd.


For example:

stgraber at castiana:~$ nc -l fe80::3004:2dff:feb6:b5c7 1234
nc: Invalid argument

^ Fails because the kernel doesn't know what interface you want.

stgraber at castiana:~$ nc -l fe80::3004:2dff:feb6:b5c7%ippusbxd 1234

^ Works

-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/ubuntu-devel/attachments/20161229/f1ddb00f/attachment.pgp>


More information about the ubuntu-devel mailing list