VMware

This Question is Answered

1 "correct" answer available (10 pts) 1 "helpful" answer available (6 pts)
7 Replies Last post: Jun 29, 2009 6:59 PM by Chuck8773  

How to configure service console firewall to only allow access from certain IPs? posted: Jun 26, 2009 5:37 PM

Click to view Tysonl's profile Novice 7 posts since
Apr 24, 2008

I've spent most of today looking for information on the "esxcfg-firwall --ipruleAdd" command. I want to restrict SSH access to only 2 subnets (let's say 192.168.123.0/24 and 192.168.134.0/24). IP rules looks like it should be able to do it but I've not figured out the right combination of rules.

This is what I've tried (and the man page for esxcfg-firewall made it sound like it should work...)

esxcfg-firewall --ipruleAdd 0.0.0.0/0,22,tcp,REJECT,"Block_SSH"
esxcfg-firewall --ipruleAdd 192.168.123.0/24,22,tcp,ACCEPT,"Allow_123_SSH"
esxcfg-firewall --ipruleAdd 192.168.134.0/24,22,tcp,ACCEPT,"Allow_134_SSH"

My ressoning was that since SSH is open to the world to start I would deny all and then allow the two subnets I wanted. What actaully happened is the black worked and the allows didn't.

This is the example from the man page I based these rules on

To allow only one host access specified port of COS
esxcfg-firewall --ipruleAdd 0.0.0.0/0,902,tcp,REJECT,"block_902"
esxcfg-firewall --ipruleAdd 192.168.1.1,902,tcp,ACCEPT,"allow_one"

Any help you can give would be awesome. Thanks all.
Click to view Chuck8773's profile Expert 229 posts since
May 4, 2007

I have never done this but if it is implemented like Cisco is, then the deny all should be the last rule. It follows a lazy evaluation. If your deny all is first it stops processing after it finds that match. Try putting it last.

Charles Killmer, VCP

If you found this or other information useful, please consider awarding points for "Correct" or "Helpful".

Click to view Chuck8773's profile Expert 229 posts since
May 4, 2007
How are you verifying that it isn't working? I just set it up to block one host to port 902 and it worked. I will try to set it to allow only one and report back.

Charles Killmer, VCP

If you found this or other information useful, please consider awarding points for "Correct" or "Helpful".

Click to view Chuck8773's profile Expert 229 posts since
May 4, 2007
I set it up to block 0.0.0.0/0 and allow 192.168.1.247/32 and that worked. I verified by connecting a telnet session to the host on port 902. The VIC was still able to connect. Also, keep in mind that if you are connecting to virtual center, it still has access to the hosts.

Charles Killmer, VCP

If you found this or other information useful, please consider awarding points for "Correct" or "Helpful".

Click to view Chuck8773's profile Expert 229 posts since
May 4, 2007
Glad it is working. Interesting bug though.

Charles Killmer, VCP

If you found this or other information useful, please consider awarding points for "Correct" or "Helpful".

VMware Developer

SDKs, APIs, Videos, Learn and much more in the Developer community.

Learn More

Developer Sample Code

Increase your developer productivity with VMware API sample code.

Learn More

VMworld Sessions & Labs

Online access to the latest VMworld Sessions & Labs and online services.

Learn more

Purchase PSO Credits Online

Purchase credits to redeem training and consulting services online.

Buy Now

Community Hardware Software

View reported configurations or report your own.

Learn More

VMware vSphere

Come witness the next giant leap in virtualization.

Register Today

Communities