# UPnP Setup- ifconfig allmulti Crashes Network



## Sephiroth (Apr 14, 2010)

Hey all,

I've been googling for a few days trying to figure this one out. I have a FreeBSD 7.2 box, humming away and working like a charm. It's configured with several service jails (via the Handbook's instructions), and everything is working swell. One of the jails, "login", is used as my access point for just about everything- ssh tunnels and Samba primarily. I use this jail to host my shared files. Recently, I have been working on getting a UPnP server, MediaTomb working on this server, so I can stream video via UPnP and not just SMB shares, so my PS3 can access them (no SMB access).

Anyway, I installed the port of Mediatomb into the jail, no problems. However, I can NOT browse the UPnP shares. I can ping everything, all the ports are open, there's no errors in the startup of the daemon. Everything looks groovy. Digging in, the only thing I can find is from the mediatomb faq (http://mediatomb.cc/pages/documentation#id2855464), section 4.1:

Some systems require a special setup on the network interface. If MediaTomb exits with UPnP Error -117, or if it does not respond to M-SEARCH requests from the renderer (i.e. MediaTomb is running, but your renderer device does not show it) you should try the following settings (the lines below assume that MediaTomb is running on a Linux machine, on network interface eth1):

`# route add -net 239.0.0.0 netmask 255.0.0.0 eth1`
`# ifconfig eth1 allmulti`

My install is not exiting, but it doesn't show up, so this sounds right up my alley. In the jail, I tried route add and the ifconfig command (my NIC is using the em driver, em0). No luck, permission denied. Chalk it up to the jails, still figuring out exactly what I can and can not do within them. I go to the host server for the jails, and I try it again, and that's when everything breaks.


```
# route add -net 239.0.0.0 netmask 255.0.0.0 em0
route: writing to routing socket: Network is unreachable
add net 239.0.0.0: gateway netmask: Network is unreachable

# ifconfig em0 allmulti
```


Nothing. All network connectivity is broken. SSH sessions broken, in jail and out. Can't ping it- unreachable. Fortunately, I have access to the server and can still get in and restart the box- rc.d/netif restart doesn't do the trick. From local on the box, I can't ping anything either.

ifconfig on the host box shows:


```
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	options=9b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM>
	ether 00:13:72:fe:32:4c
	inet6 fe80::213:72ff:fefe:324c%em0 prefixlen 64 scopeid 0x1 
	inet 192.168.13.30 netmask 0xffffff00 broadcast 192.168.13.255
	inet 192.168.13.31 netmask 0xffffffff broadcast 192.168.13.31
	inet 192.168.13.32 netmask 0xffffffff broadcast 192.168.13.32
	inet 192.168.13.33 netmask 0xffffffff broadcast 192.168.13.33
	inet 192.168.13.34 netmask 0xffffffff broadcast 192.168.13.34
	inet 192.168.13.35 netmask 0xffffffff broadcast 192.168.13.35
	inet 192.168.13.36 netmask 0xffffffff broadcast 192.168.13.36
	media: Ethernet autoselect (1000baseTX <full-duplex>)
	status: active
plip0: flags=108810<POINTOPOINT,SIMPLEX,MULTICAST,NEEDSGIANT> metric 0 mtu 1500
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
	inet6 ::1 prefixlen 128 
	inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3 
	inet 127.0.0.1 netmask 0xff000000
```

The extra addresses are for the jails, if that's not obvious! As you can see, the MULTICAST flag is set, but not the ALLMULTI flag.

After hours of searching and researching, I definately need some help here, this is over my head. Best I have found, I may have some defective hardware. I'm a programmer but I've never really worked with device drivers and the kernel, going into the code to figure this out myself is just not happening right now. What can I do to troubleshoot this problem? I'm not even sure this will solve the problem with UPnP but I'd like to know why trying to set this flag is effectively crashing my box. If anybody can explain why setting the multicast route doesn't work, that would also be cool.

Thanks for any help you can give me!


----------



## SirDice (Apr 14, 2010)

Sephiroth said:
			
		

> The extra addresses are for the jails, if that's not obvious! As you can see, the MULTICAST flag is set, but not the ALLMULTI flag.


That's because ALLMULTI is the linux equivalent of MULTICAST.


----------



## Sephiroth (Apr 14, 2010)

SirDice said:
			
		

> That's because ALLMULTI is the linux equivalent of MULTICAST.



That makes sense, thank you. I was confused by the lack of hits for ALLMULTI and FreeBSD. Any idea on why setting an illegal flag would take down the interface? However, that doesn't really matter.

Any ideas why adding the multicast route would be illegal? Are there issues with multicast sockets and jails? I have sysctl security.jail.allow_raw_sockets=1 set, and the devfs (enabled for CUPS and the LPT port) enabled for the jail, is there some other piece of the puzzle I'm missing?


----------



## SirDice (Apr 14, 2010)

I have tried to play with multicast before but never really got it working. At that time I couldn't find an internet resource that would actually make use of it so I could test it. 

I've also played a bit with mediatomb, UPnP and my eva8000. AFAIK UPnP works on broadcast, not multicast. Never really got MediaTomb working properly. IIRC net/ushare worked first time I tried it. In the end I did and still do everything using samba


----------



## Sephiroth (Apr 15, 2010)

I'll give ushare a shot- if I can at least get a UPnP client to recognize the server with it it would be a huge advancement.

Thanks for help so far!


----------



## Sephiroth (Apr 23, 2010)

So, turns out ushare, and probably MediaTomb, work great on the box- but not from inside the jail. I went ahead and bit the bullet and installed ushare on the base server, and it works great.

Damn! I hate when things work...

OK, all kidding aside, the problem seems to be running the UPnP system inside a jail... I'm going to start another thread to work out that particular issue.

Things to note for future reference: I never did get the ALLMULTI thing sorted out- I did get conflicting information about this. The other source said that ALLMULTI shows up when you have multicast routing enabled (mrouted). This lead me all the way to compiling a custom kernel (first time for everything) with "options mrouting" enabled. That didn't fix the jail problem. That may be why it works on the core box; I don't know and I'm not going backwards to find out.


----------



## zahgurin (Nov 30, 2010)

Hi

Excuse me reviving this thread but for the benefit of other people googling the same terms I was.

It's a bit of a hack but the following pf.conf on the "real" host allowed the jail to receive the required SSDP broadcasts so my mediatomb server could be discovered on the network:


```
set skip on lo0

rdr on em0 proto udp \
  from any \
  to 239.255.255.250 port 1900 -> 192.168.0.51 port 1900

pass all no state
```

... replace em0 with your LAN interface name and 192.168.0.51 with your jail IP.

Of course, this sucks and if anyone finds a nicer way I'd like to hear it.

Cheers
Si


----------

