{"id":731,"date":"2008-11-24T20:19:36","date_gmt":"2008-11-25T01:19:36","guid":{"rendered":"http:\/\/nuxx.net\/blog\/?p=731"},"modified":"2009-01-06T23:03:06","modified_gmt":"2009-01-07T04:03:06","slug":"nxe-xbox-live-with-pf-and-miniupnpd-on-openbsd-42","status":"publish","type":"post","link":"https:\/\/nuxx.net\/blog\/2008\/11\/24\/nxe-xbox-live-with-pf-and-miniupnpd-on-openbsd-42\/","title":{"rendered":"NXE Xbox LIVE with pf and miniupnpd on OpenBSD 4.2"},"content":{"rendered":"<p><center><\/p>\n<table cellpadding=1>\n<tr>\n<td bgcolor=\"black\"><a href=\"https:\/\/nuxx.net\/gallery\/v\/acquired_stuff\/xbox_360\/IMG_2727.jpg.html?g2_imageViewsIndex=2\"><img decoding=\"async\" src=\"https:\/\/nuxx.net\/gallery\/d\/79877-2\/IMG_2727.jpg\" height=377 width=640 border=0 alt=\"New Xbox Experience (NXE) showing a successful Xbox Live test via NAT and UPnP on OpenBSD 4.3 with pf and miniupnpd.\"><\/a><\/td>\n<\/tr>\n<\/table>\n<p><\/center><\/p>\n<p>(<strong>UPDATE:<\/strong> This issue has been worked around \/ resolved. Please see <a href=\"https:\/\/nuxx.net\/blog\/2009\/01\/06\/xbox-live-open-nat-using-pf-on-openbsd\/\">Xbox Live Open NAT Using pf on OpenBSD<\/a>.)<\/p>\n<p>I rather enjoy turn-based artillery games like <a href=\"http:\/\/en.wikipedia.org\/wiki\/Worms_(series)\">Worms<\/a>, <a href=\"http:\/\/en.wikipedia.org\/wiki\/Scorched_Earth_(computer_game)\">Scorched Earth<\/a> (and <a href=\"http:\/\/www.scorch2000.com\/\">Scorch 2000<\/a> and <a href=\"http:\/\/www.scorched3d.co.uk\/\">Scorched 3D<\/a>), and <a href=\"http:\/\/en.wikipedia.org\/wiki\/Gorillas_(computer_game)\">GORILLA.BAS<\/a>, so when I found out that <a href=\"http:\/\/www.xbox.com\/en-US\/games\/w\/wormsxboxlivearcade\/\">Worms for Xbox Live Arcade<\/a> was available, I purchased it.<\/p>\n<p>A few months ago, before Microsoft released <a href=\"http:\/\/www.xbox.com\/en-US\/live\/nxe\/\">NXE, or the New Xbox Experience<\/a>, I had no problems playing Worms online when using <a href=\"https:\/\/nuxx.net\/wiki\/Trashwall\">my Trashwall<\/a> set up with the <a href=\"http:\/\/support.microsoft.com\/kb\/908874\">Microsoft proscribed forwards of 88\/udp, 3074\/udp, and 3074\/tcp<\/a>. However, after NXE was released it seemed to stop working. The Xbox LIVE test would consistently tell me that I have &#8220;Strict&#8221; NAT settings and that some things won&#8217;t work. I was unable to host private or public games. Xbox LIVE supposedly works best with either a direct internet connection or a firewall which implements <a href=\"http:\/\/en.wikipedia.org\/wiki\/Universal_Plug_and_Play\">UPnP<\/a>, so I set to implementing UPnP on my <a href=\"http:\/\/en.wikipedia.org\/wiki\/PF_(firewall)\">pf<\/a>-based firewall.<\/p>\n<p>In order to do so I compiled and set up <a href=\"http:\/\/miniupnp.free.fr\/\">miniupnpd<\/a> per the directions, but I ran into a whole bunch of weirdness along the way. I eventually got it working, getting an occasional successful Xbox LIVE test (as seen above) which indicates &#8220;Open&#8221; NAT, and I was able to play a private game against <lj user=\"glymph\"\/>, but things don&#8217;t seem right.<\/p>\n<p>Below the cut I&#8217;ll document what I&#8217;m been seeing.<\/p>\n<p><!--more-->First, I put compiled miniupnpd on the firewall and set up <tt>pf.conf<\/tt> for it:<\/p>\n<blockquote><p><tt>rdr-anchor \"miniupnpd\"<\/tt><br \/>\n<tt>anchor miniupnpd<\/tt><\/p><\/blockquote>\n<p>I then set up its config file, <tt>\/etc\/miniupnpd.conf<\/tt>:<\/p>\n<blockquote><p><tt># WAN network interface<\/tt><br \/>\n<tt>ext_ifname=gem0<\/tt><\/p>\n<p><tt># LAN network interfaces IPs \/ networks<\/tt><br \/>\n<tt># there can be multiple listening ips for SSDP traffic.<\/tt><br \/>\n<tt># should be under the form nnn.nnn.nnn.nnn\/nn<\/tt><br \/>\n<tt># HTTP is available on all interfaces<\/tt><br \/>\n<tt>listening_ip=192.168.0.1\/24<\/tt><\/p>\n<p><tt>#listening_ip=<\/tt><br \/>\n<tt># port for HTTP (descriptions and SOAP) traffic. set 0 for autoselect.<\/tt><br \/>\n<tt>port=0<\/tt><\/p>\n<p><tt># enable NAT-PMP support (default is no)<\/tt><br \/>\n<tt>enable_natpmp=no<\/tt><\/p>\n<p><tt># enable UPNP support (default is yes)<\/tt><br \/>\n<tt>enable_upnp=yes<\/tt><\/p>\n<p><tt># bitrates reported by daemon in bits per second<\/tt><br \/>\n<tt>bitrate_up=1000000<\/tt><br \/>\n<tt>bitrate_down=10000000<\/tt><\/p>\n<p><tt># \"secure\" mode : when enabled, UPnP client are allowed to add mappings only<\/tt><br \/>\n<tt># to their IP.<\/tt><br \/>\n<tt>secure_mode=no<\/tt><\/p>\n<p><tt># report system uptime instead of daemon uptime<\/tt><br \/>\n<tt>system_uptime=yes<\/tt><\/p>\n<p><tt># notify interval in seconds. default is 30 seconds.<\/tt><br \/>\n<tt>notify_interval=60<\/tt><\/p>\n<p><tt># unused rules cleaning.<\/tt><br \/>\n<tt># never remove any rule before this threshold for the number<\/tt><br \/>\n<tt># of redirections is exceeded. default to 20<\/tt><br \/>\n<tt>#clean_ruleset_threshold=10<\/tt><br \/>\n<tt># clean process work interval in seconds. default to 0 (disabled).<\/tt><br \/>\n<tt># a 600 seconds (10 minutes) interval makes sense<\/tt><br \/>\n<tt>clean_ruleset_interval=600<\/tt><\/p>\n<p><tt># make filter rules in pf quick or not. default is yes<\/tt><br \/>\n<tt># active when compiled with PF_ENABLE_FILTER_RULES (see config.h file)<\/tt><br \/>\n<tt>quickrules=yes<\/tt><\/p>\n<p><tt># uuid : generate your own with \"make genuuid\"<\/tt><br \/>\n<tt>uuid=767e113a-ba6c-11dd-908b-0002a5dae400<\/tt><\/p>\n<p><tt># serial and model number the daemon will report to clients<\/tt><br \/>\n<tt># in its XML description<\/tt><br \/>\n<tt>serial=12345678<\/tt><br \/>\n<tt>model_number=1<\/tt><\/p>\n<p><tt># UPnP permission rules<\/tt><br \/>\n<tt># (allow|deny) (external port range) ip\/mask (internal port range)<\/tt><br \/>\n<tt># A port range is <min port>-<max port> or <port> if there is only<\/tt><br \/>\n<tt># one port in the range.<\/tt><br \/>\n<tt># ip\/mask format must be nn.nn.nn.nn\/nn<\/tt><br \/>\n<tt># it is advised to only allow redirection of port above 1024<\/tt><br \/>\n<tt># and to finish the rule set with \"deny 0-65535 0.0.0.0\/0 0-65535\"<\/tt><br \/>\n<tt>allow 0-65535 192.168.0.0\/24 0-65535<\/tt><br \/>\n<tt>deny 0-65535 0.0.0.0\/0 0-65535<\/tt><\/p><\/blockquote>\n<p>This seemed to work fine, as I could add, list, and remove rules using the <a href=\"http:\/\/miniupnp.free.fr\/files\/download.php?file=upnpc-exe-win32-20080925.zip\">MiniUPnP client<\/a> for Windows from an XP VM. However, the first bit of weirdness I ran into was that I could not do so from my work laptop.<\/p>\n<p>I next tried the Xbox 360, and this is where the weirdness began. On the first Xbox Live test I saw no output from <tt>miniupnpd<\/tt> (running in debug mode), and the Xbox simply told me that the test failed, and I&#8217;m using &#8220;Strict&#8221; NAT. It then suggested that I reboot the router or modem. Immediately hitting OK would cause the test to run, I would then see output from <tt>miniupnpd<\/tt>, a forwarding rule would be set up, and the holy grail of Xbox LIVE testing, the success screen shown above, would be displayed. This screen indicates that NAT is what is known as &#8220;Open&#8221;, or as permissible as possible, with UPnP working.<\/p>\n<p>What&#8217;s even stranger is that running the test again, it would fail. After this second test I was offered the previous suggestion, which was to reboot the router or modem. Again choosing the option to indicate that I did this resulted in a successful test. However, this time the output from <tt>miniupnpd<\/tt> indicated that the rule already existed so it wasn&#8217;t added.<\/p>\n<p>At this point I decided to fire up Worms and see if inviting <lj user=\"glymph\"\/> would work, and it did. This confuses me greatly, as the automatically created redirect matches one of the previously done manual ones, and with these set up things didn&#8217;t work.<\/p>\n<p>Here&#8217;s some info as things went along showing it being weird:<\/p>\n<p>Starting out, showing nothing in the in the <tt>miniupnpd<\/tt> anchors:<\/p>\n<blockquote><p><tt>trashwall# pfctl -a miniupnpd -s nat<\/tt><br \/>\n<tt>trashwall# pfctl -a miniupnpd -s rules<\/tt><br \/>\n<tt>trashwall#<\/tt><\/p><\/blockquote>\n<p>From the XP VM I can see that the IGD (Internet Gateway Device) is present and contains no forwards:<\/p>\n<blockquote><p><tt>C:\\Documents&nbsp;and&nbsp;Settings\\c0nsumer\\Desktop\\miniupnpd&gt;upnpc-shared.exe&nbsp;-l<\/tt><br \/>\n<tt>upnpc&nbsp;:&nbsp;miniupnpc&nbsp;library&nbsp;test&nbsp;client.&nbsp;(c)&nbsp;2006-2008&nbsp;Thomas&nbsp;Bernard<\/tt><br \/>\n<tt>Go&nbsp;to&nbsp;http:\/\/miniupnp.free.fr\/&nbsp;or&nbsp;http:\/\/miniupnp.tuxfamily.org\/<\/tt><br \/>\n<tt>for&nbsp;more&nbsp;information.<\/tt><br \/>\n<tt>List&nbsp;of&nbsp;UPNP&nbsp;devices&nbsp;found&nbsp;on&nbsp;the&nbsp;network&nbsp;:<\/tt><br \/>\n<tt>&nbsp;desc:&nbsp;http:\/\/192.168.0.1:30239\/rootDesc.xml<\/tt><br \/>\n<tt>&nbsp;st:&nbsp;urn:schemas-upnp-org:device:InternetGatewayDevice:1<\/tt><\/p>\n<p><tt>Found&nbsp;valid&nbsp;IGD&nbsp;:&nbsp;http:\/\/192.168.0.1:30239\/ctl\/IPConn<\/tt><br \/>\n<tt>Local&nbsp;LAN&nbsp;ip&nbsp;address&nbsp;:&nbsp;192.168.0.25<\/tt><br \/>\n<tt>Connection&nbsp;Type&nbsp;:&nbsp;IP_Routed<\/tt><br \/>\n<tt>Status&nbsp;:&nbsp;Connected,&nbsp;uptime=542063,&nbsp;LastConnectionError&nbsp;:&nbsp;ERROR_NONE<\/tt><br \/>\n<tt>MaxBitRateDown&nbsp;:&nbsp;10000000&nbsp;bps&nbsp;&nbsp;&nbsp;MaxBitRateUp&nbsp;1000000&nbsp;bps<\/tt><br \/>\n<tt>ExternalIPAddress&nbsp;=&nbsp;69.244.128.183<\/tt><br \/>\n<tt>GetGenericPortMappingEntry()&nbsp;returned&nbsp;713&nbsp;(SpecifiedArrayIndexInvalid)<\/tt><\/p>\n<p><tt>C:\\Documents&nbsp;and&nbsp;Settings\\c0nsumer\\Desktop\\miniupnpd&gt;<\/tt><\/p><\/blockquote>\n<p>I would now turn on the 360, test the connection, and watch it fail saying that the NAT type is &#8220;Strict&#8221;, all without seeing any output from <tt>miniupnpd<\/tt>. As described above, saying that I&#8217;ve rebooted my router or modem would then produce the following output from <tt>miniupnpd<\/tt>:<\/p>\n<blockquote><p><tt>miniupnpd[11100]: HTTP connection from 192.168.0.7:47933<\/tt><br \/>\n<tt>miniupnpd[11100]: HTTP REQUEST : GET \/rootDesc.xml (HTTP\/1.1)<\/tt><br \/>\n<tt>miniupnpd[11100]: HTTP connection from 192.168.0.7:8577<\/tt><br \/>\n<tt>miniupnpd[11100]: HTTP REQUEST : POST \/ctl\/IPConn (HTTP\/1.1)<\/tt><br \/>\n<tt>miniupnpd[11100]: SOAPAction: urn:schemas-upnp-org:service:WANIPConnection:1#GetStatusInfo<\/tt><br \/>\n<tt>miniupnpd[11100]: HTTP connection from 192.168.0.7:52543<\/tt><br \/>\n<tt>miniupnpd[11100]: HTTP REQUEST : POST \/ctl\/IPConn (HTTP\/1.1)<\/tt><br \/>\n<tt>miniupnpd[11100]: SOAPAction: urn:schemas-upnp-org:service:WANIPConnection:1#AddPortMapping<\/tt><br \/>\n<tt>miniupnpd[11100]: AddPortMapping: ext port 3074 to 192.168.0.7:3074 protocol UDP for: Xbox (192.168.0.7:3074) 3074 UDP<\/tt><br \/>\n<tt>miniupnpd[11100]: UPnP permission rule 0 matched : port mapping accepted<\/tt><br \/>\n<tt>miniupnpd[11100]: redirecting port 3074 to 192.168.0.7:3074 protocol UDP for: Xbox (192.168.0.7:3074) 3074 UDP<\/tt><\/p><\/blockquote>\n<p>Look at that. XP can now see that there&#8217;s a port forward:<\/p>\n<blockquote><p><tt>C:\\Documents&nbsp;and&nbsp;Settings\\c0nsumer\\Desktop\\miniupnpd&gt;upnpc-shared.exe&nbsp;-l<\/tt><br \/>\n<tt>upnpc&nbsp;:&nbsp;miniupnpc&nbsp;library&nbsp;test&nbsp;client.&nbsp;(c)&nbsp;2006-2008&nbsp;Thomas&nbsp;Bernard<\/tt><br \/>\n<tt>Go&nbsp;to&nbsp;http:\/\/miniupnp.free.fr\/&nbsp;or&nbsp;http:\/\/miniupnp.tuxfamily.org\/<\/tt><br \/>\n<tt>for&nbsp;more&nbsp;information.<\/tt><br \/>\n<tt>List&nbsp;of&nbsp;UPNP&nbsp;devices&nbsp;found&nbsp;on&nbsp;the&nbsp;network&nbsp;:<\/tt><br \/>\n<tt>&nbsp;desc:&nbsp;http:\/\/192.168.0.1:30239\/rootDesc.xml<\/tt><br \/>\n<tt>&nbsp;st:&nbsp;urn:schemas-upnp-org:device:InternetGatewayDevice:1<\/tt><\/p>\n<p><tt>Found&nbsp;valid&nbsp;IGD&nbsp;:&nbsp;http:\/\/192.168.0.1:30239\/ctl\/IPConn<\/tt><br \/>\n<tt>Local&nbsp;LAN&nbsp;ip&nbsp;address&nbsp;:&nbsp;192.168.0.25<\/tt><br \/>\n<tt>Connection&nbsp;Type&nbsp;:&nbsp;IP_Routed<\/tt><br \/>\n<tt>Status&nbsp;:&nbsp;Connected,&nbsp;uptime=542527,&nbsp;LastConnectionError&nbsp;:&nbsp;ERROR_NONE<\/tt><br \/>\n<tt>MaxBitRateDown&nbsp;:&nbsp;10000000&nbsp;bps&nbsp;&nbsp;&nbsp;MaxBitRateUp&nbsp;1000000&nbsp;bps<\/tt><br \/>\n<tt>ExternalIPAddress&nbsp;=&nbsp;69.244.128.183<\/tt><br \/>\n<tt>&nbsp;0&nbsp;UDP&nbsp;&nbsp;3074->192.168.0.7:3074&nbsp;&nbsp;'Xbox&nbsp;(192.168.0.7:3074)&nbsp;3074&nbsp;UDP'&nbsp;''<\/tt><br \/>\n<tt>GetGenericPortMappingEntry()&nbsp;returned&nbsp;713&nbsp;(SpecifiedArrayIndexInvalid)<\/tt><\/p>\n<p><tt>C:\\Documents&nbsp;and&nbsp;Settings\\c0nsumer\\Desktop\\miniupnpd&gt;<\/tt><\/p><\/blockquote>\n<p><tt>pf<\/tt> can also see that it has both the redirect and filter rules:<\/p>\n<blockquote><p><tt>trashwall# pfctl -a miniupnpd -s nat<\/tt><br \/>\n<tt>rdr on gem0 inet proto udp from any to any port = 3074 label \"Xbox (192.168.0.7:3074) 3074 UDP\" -> 192.168.0.7 port 3074<\/tt><br \/>\n<tt>trashwall# pfctl -a miniupnpd -s rules<\/tt><br \/>\n<tt>pass in quick on gem0 inet proto udp from any to any port = 3074 flags S\/SA keep state label \"Xbox (192.168.0.7:3074) 3074 UDP\"<\/tt><br \/>\n<tt>trashwall#<\/tt><\/p><\/blockquote>\n<p>However, if I try the test again, it fails. Selecting the option to see the previous suggestion (rebooting the router or modem) and confirming that I did again causes the test to pass, with the Xbox 360 attempting to recreate the rule. As it already exists it isn&#8217;t created. The test will again pass:<\/p>\n<blockquote><p><tt>miniupnpd[11100]: HTTP connection from 192.168.0.7:64273<\/tt><br \/>\n<tt>miniupnpd[11100]: HTTP REQUEST : GET \/rootDesc.xml (HTTP\/1.1)<\/tt><br \/>\n<tt>miniupnpd[11100]: HTTP connection from 192.168.0.7:47982<\/tt><br \/>\n<tt>miniupnpd[11100]: HTTP REQUEST : POST \/ctl\/IPConn (HTTP\/1.1)<\/tt><br \/>\n<tt>miniupnpd[11100]: SOAPAction: urn:schemas-upnp-org:service:WANIPConnection:1#GetStatusInfo<\/tt><br \/>\n<tt>miniupnpd[11100]: HTTP connection from 192.168.0.7:23290<\/tt><br \/>\n<tt>miniupnpd[11100]: HTTP REQUEST : POST \/ctl\/IPConn (HTTP\/1.1)<\/tt><br \/>\n<tt>miniupnpd[11100]: SOAPAction: urn:schemas-upnp-org:service:WANIPConnection:1#AddPortMapping<\/tt><br \/>\n<tt>miniupnpd[11100]: AddPortMapping: ext port 3074 to 192.168.0.7:3074 protocol UDP for: Xbox (192.168.0.7:3074) 3074 UDP<\/tt><br \/>\n<tt>miniupnpd[11100]: UPnP permission rule 0 matched : port mapping accepted<\/tt><br \/>\n<tt>miniupnpd[11100]: ignoring redirect request as it matches existing redirect<\/tt><\/p><\/blockquote>\n<p>Just to confirm, here&#8217;s the original manual rules I was using prior to NXE when I was able to use Worms and play against others online:<\/p>\n<blockquote><p><tt>rdr pass on $ext_if proto { udp } to port 88 -> $xbox360<\/tt><br \/>\n<tt>rdr pass on $ext_if proto { tcp, udp } to port 3074 -> $xbox360<\/tt><\/p>\n<p><tt>pass in on $ext_if inet proto { tcp udp } from any to ($ext_if) port 3074 keep state<\/tt><br \/>\n<tt>pass in on $ext_if inet proto { udp } from any to ($ext_if) port 88 keep state<\/tt><\/p><\/blockquote>\n<p>(<strong>UPDATE:<\/strong> This issue has been worked around \/ resolved. Please see <a href=\"https:\/\/nuxx.net\/blog\/2009\/01\/06\/xbox-live-open-nat-using-pf-on-openbsd\/\">Xbox Live Open NAT Using pf on OpenBSD<\/a>.)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>(UPDATE: This issue has been worked around \/ resolved. Please see Xbox Live Open NAT Using pf on OpenBSD.) I rather enjoy turn-based artillery games<\/p>\n<div class=\"more-link-wrapper\"><a class=\"more-link\" href=\"https:\/\/nuxx.net\/blog\/2008\/11\/24\/nxe-xbox-live-with-pf-and-miniupnpd-on-openbsd-42\/\">Continue reading<span class=\"screen-reader-text\">NXE Xbox LIVE with pf and miniupnpd on OpenBSD 4.2<\/span><\/a><\/div>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[],"class_list":["post-731","post","type-post","status-publish","format-standard","hentry","category-computers","entry"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/nuxx.net\/blog\/wp-json\/wp\/v2\/posts\/731","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nuxx.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nuxx.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nuxx.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/nuxx.net\/blog\/wp-json\/wp\/v2\/comments?post=731"}],"version-history":[{"count":14,"href":"https:\/\/nuxx.net\/blog\/wp-json\/wp\/v2\/posts\/731\/revisions"}],"predecessor-version":[{"id":1014,"href":"https:\/\/nuxx.net\/blog\/wp-json\/wp\/v2\/posts\/731\/revisions\/1014"}],"wp:attachment":[{"href":"https:\/\/nuxx.net\/blog\/wp-json\/wp\/v2\/media?parent=731"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nuxx.net\/blog\/wp-json\/wp\/v2\/categories?post=731"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nuxx.net\/blog\/wp-json\/wp\/v2\/tags?post=731"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}