An often made mistake when trying to open up or close a port range with the ESX(3.0.2 and 3.5) firewall is using the dash(-) as a divider. Using the dash unfortunately does not always result in an error. To open up or close a port range you should use a collon(:) as a divider:

esxcfg-firewall –openport 6000:6010,tcp,in,test

Normally using a dash as a divider should result in following error:

[root@server1 /]# esxcfg-firewall -o 7000-7010,tcp,in,test
2007-12-26 20:54:52 (6842) ERROR: ‘iptables /sbin/iptables -A INPUT -p tcp –dport 7000-7010 -j ACCEPT’ failed
2007-12-26 20:54:52 (6842) ERROR: Panic! Stack trace follows:
2007-12-26 20:54:52 (6842) ERROR: VMware::Panic VMware::Panic::DumpStackTrace in /usr/lib/vmware/esx-perl/perl5/site_perl/5.8.0/VMware/Panic.pm line 59
2007-12-26 20:54:52 (6842) ERROR: main VMware::Panic::Panic in /usr/sbin/esxcfg-firewall line 661
2007-12-26 20:54:52 (6842) ERROR: main main::IpTables in /usr/sbin/esxcfg-firewall line 492
2007-12-26 20:54:52 (6842) ERROR: main main::FWAddCustomPorts in /usr/sbin/esxcfg-firewall line 545
2007-12-26 20:54:52 (6842) ERROR: main main::FWLoad in /usr/sbin/esxcfg-firewall line 1039
2007-12-26 20:54:52 (6842) ERROR: Getopt::Long main::OpenPort in /usr/lib/perl5/5.8.0/Getopt/Long.pm line 478
2007-12-26 20:54:52 (6842) ERROR: Getopt::Long (eval) in /usr/lib/perl5/5.8.0/Getopt/Long.pm line 477
2007-12-26 20:54:52 (6842) ERROR: main Getopt::Long::GetOptions in /usr/sbin/esxcfg-firewall line 1131
2007-12-26 20:54:52 (6842) ERROR: Making panic callbacks…
2007-12-26 20:54:52 (6842) ERROR: Done, exiting with code -19. Goodbye!

The weird thing is that when you query the firewall it says the port range is open but when you restart the firewall service it will result in the same error again. It seems that iptables isn’t fond of the dash and esxcfg-firewall doesn’t convert it or blocks the port range of being submitted to iptables.