Monday, November 3, 2008

Add vnc port to iptables

[root@dwmythp4 ~]# iptables -L INPUT --line-numbers
Chain INPUT (policy ACCEPT)
num target prot opt source destination
1 ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
2 ACCEPT icmp -- anywhere anywhere
3 ACCEPT all -- anywhere anywhere
4 ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ssh
5 REJECT all -- anywhere anywhere reject-with icmp-host-prohibited


[root@dwmythp4 ~]# iptables -I INPUT 5 -p tcp --destination-port 5801 --source 192.168.187.0/24 -j ACCEPT
[root@dwmythp4 ~]# iptables -I INPUT 5 -p tcp --destination-port 5901 --source 192.168.187.0/24 -j ACCEPT
[root@dwmythp4 ~]# iptables -L INPUT --line-numbers
Chain INPUT (policy ACCEPT)
num target prot opt source destination
1 ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
2 ACCEPT icmp -- anywhere anywhere
3 ACCEPT all -- anywhere anywhere
4 ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ssh
5 ACCEPT tcp -- 192.168.187.0/24 anywhere tcp dpt:5901
6 ACCEPT tcp -- 192.168.187.0/24 anywhere tcp dpt:5801
7 REJECT all -- anywhere anywhere reject-with icmp-host-prohibited

No comments: