Allow only specific IP address to access ports 443/80 of VD


Here is steps to ONLY ALLOW https/http traffic from specific ip.


1)    sudo vi /etc/iptables/rules.v4

2)    Change NAT source address 


Change following line:


-A VNMS -i eth0 -p tcp -m tcp --dport 80 -j DNAT --to-destination 127.0.0.1:8080

-A VNMS -i eth0  -p tcp -m tcp --dport 443 -j DNAT --to-destination 127.0.0.1:8443


Add ONLY SPECIFIC IP:


-A VNMS -i eth0 -s 10.42.144.136  -p tcp -m tcp --dport 80 -j DNAT --to-destination 127.0.0.1:8080

-A VNMS -i eth0 -s 10.42.144.136  -p tcp -m tcp --dport 443 -j DNAT --to-destination 127.0.0.1:8443

3) Save it 

4) sudo iptables-apply /etc/iptables/rules.v4