internet --> modem --> m0n0wall -- > wireless ap --> xbox
I only have 2 network adapters in my m0n0wall box. I have no switch and my setup is very straight forward and simple. m0n0wall takes care of all everything. The access point just passes all info through without restriction. For my outbound nat I have selected avoid port mapping to prevent port randomization. The only reason I need static ports is because of xbox live. Both m0n0wall and pfsense causes problems with my xbox live and I end up with a moderate or strict nat. I've isolated the problem in the source code of m0m0wall.
/* depending on whether or not port mapping is disabled, we put the (generic) IP
rule or the portmap rule first. If the portmap rule comes first, we will always
have mapped/randomized ports. Otherwise, the port will only be mapped if there
is already another mapping for the same port.
*/
Now the last sentence above quoted from the filter.inc source code file is troubling. That's what causing static port mapping to fail when using xbox live using the network configured above. I'm attaching a larger portion of the code so it will be clearer on what I'm talking about.
if ($config['nat']['portrange-low'] && $config['nat']['portrange-high']) {
$rangelow = $config['nat']['portrange-low'];
$rangehigh = $config['nat']['portrange-high'];
}
$portmaprule = "map $if $src $dst -> {$tgt} portmap tcp/udp $rangelow:$rangehigh\n";
$ipmaprule = "map $if $src $dst -> {$tgt}\n";
/* depending on whether or not port mapping is disabled, we put the (generic) IP
rule or the portmap rule first. If the portmap rule comes first, we will always
have mapped/randomized ports. Otherwise, the port will only be mapped if there
is already another mapping for the same port.
*/
if ($portmap)
$natrule .= $portmaprule . $ipmaprule;
else
$natrule .= $ipmaprule . $portmaprule;
return $natrule;
}
A more closer look:
if ($portmap)
$natrule .= $portmaprule . $ipmaprule;
else
$natrule .= $ipmaprule . $portmaprule;
return $natrule;
The above code kills xbox lives chances of always having an open nat. I made a simple change in the code below and now xbox live works absolutely great.
if ($portmap)
$natrule .= $portmaprule . $ipmaprule;
else
$natrule .= $ipmaprule;
return $natrule;
I would like to know if this is going to break anything. Ok so lets say I have "already another mapping for the same port". What issue is this going to cause with the above code change?