It turns out that iptables doesn\'t handle leading zeros too well. As $machinenumber that is used has to have a leading zero in it for other purposes, the idea
$machinenumber
Using sed:
echo 000498 | sed "s/^0*\([1-9]\)/\1/;s/^0*$/0/" 498 echo 000 | sed "s/^0*\([1-9]\)/\1/;s/^0*$/0/" 0