- 论坛徽章:
- 0
|
CentOS系统,装有KVM虚拟机几个,其中邮件由其中一个KVM虚拟机来处理,因此将服务器的几个邮件端口转发到邮件的虚拟机上去,在其它机器及外网都没有问题,只是服务器本身好像不能访问到转发的邮件端口。- *filter
- :INPUT ACCEPT [0:0]
- :FORWARD ACCEPT [0:0]
- :OUTPUT ACCEPT [60020:92010646]
- #-A INPUT -j LOG --log-prefix "INPUT-IPTABLES:INPUT: " --log-level 4
- -A INPUT -p tcp -m tcp --dport 8012 -j ACCEPT
- -A INPUT -p tcp -m tcp --dport 21 -j ACCEPT
- -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
- -A INPUT -p tcp -m state --state NEW -m tcp --dport 20000:20500 -j ACCEPT
- -A INPUT -i virbr0 -p udp -m udp --dport 53 -j ACCEPT
- -A INPUT -i virbr0 -p tcp -m tcp --dport 53 -j ACCEPT
- -A INPUT -i virbr0 -p udp -m udp --dport 67 -j ACCEPT
- -A INPUT -i virbr0 -p tcp -m tcp --dport 67 -j ACCEPT
- -A INPUT -p udp -m udp -s 192.168.122.0/24 --dport 123 -j ACCEPT
- -A INPUT -p tcp -m tcp -s 192.168.122.0/24 --dport 123 -j ACCEPT
- -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
- -A INPUT -i virbr0 -p icmp -j ACCEPT
- -A OUTPUT -o lo -j ACCEPT
- -A INPUT -i lo -j ACCEPT
- -A INPUT -p icmp -j DROP
- -A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
- -A INPUT -p tcp -m state --state NEW -m tcp --dport 5922 -j ACCEPT
- -A INPUT -j REJECT --reject-with icmp-host-prohibited
- -A FORWARD -d 192.168.122.0/24 -o virbr0 -m state --state RELATED,ESTABLISHED -j ACCEPT
- -A FORWARD -s 192.168.122.0/24 -i virbr0 -j ACCEPT
- -A FORWARD -i virbr0 -o virbr0 -j ACCEPT
- COMMIT
- *mangle
- :PREROUTING ACCEPT [171122:120572429]
- :INPUT ACCEPT [77942:37721871]
- :FORWARD ACCEPT [93180:82850558]
- :OUTPUT ACCEPT [60020:92010646]
- :POSTROUTING ACCEPT [153191:174860676]
- -A POSTROUTING -o virbr0 -p udp -m udp --dport 68 -j CHECKSUM --checksum-fill
- COMMIT
- *nat
- :PREROUTING ACCEPT [1:68]
- :POSTROUTING ACCEPT [0:0]
- :OUTPUT ACCEPT [6:432]
- #-A PREROUTING -j LOG --log-prefix "INPUT-IPTABLES:NAT:" --log-level 4
- # For KVM centos-mms
- -A PREROUTING -p tcp --dport 10022 -j DNAT --to 192.168.122.170:22
- -A PREROUTING -p tcp --dport 13306 -j DNAT --to 192.168.122.170:3306
- -A PREROUTING -p tcp --dport 10080 -j DNAT --to 192.168.122.170:80
- # For KVM windowsxp
- -A PREROUTING -p tcp --dport 23389 -j DNAT --to 192.168.122.60:3389
- # For KVM windows2003
- -A PREROUTING -p tcp --dport 30021 -j DNAT --to 192.168.122.95:21
- -A PREROUTING ! -i virbr0 -p tcp --dport 36660 -j DNAT --to 192.168.122.95:36660
- -A PREROUTING ! -i virbr0 -p tcp --dport 36661 -j DNAT --to 192.168.122.95:36661
- -A PREROUTING ! -i virbr0 -p tcp --dport 36662 -j DNAT --to 192.168.122.95:36662
- -A PREROUTING ! -i virbr0 -p tcp --dport 36663 -j DNAT --to 192.168.122.95:36663
- -A PREROUTING ! -i virbr0 -p tcp --dport 36664 -j DNAT --to 192.168.122.95:36664
- -A PREROUTING ! -i virbr0 -p tcp --dport 36665 -j DNAT --to 192.168.122.95:36665
- -A PREROUTING -p tcp --dport 33389 -j DNAT --to 192.168.122.95:3389
- # For KVM EMOS
- -A PREROUTING -p tcp --dport 40080 -j DNAT --to 192.168.122.82:80
- -A PREROUTING -p tcp --dport 40022 -j DNAT --to 192.168.122.82:22
- -A PREROUTING -p tcp --dport 25 -j DNAT --to 192.168.122.82:25
- -A POSTROUTING -d 192.168.122.82 -p tcp --dport 25 -j SNAT --to 192.168.122.1
- -A PREROUTING ! -i virbr0 -p tcp --dport 110 -j DNAT --to 192.168.122.82:110
- -A PREROUTING ! -i virbr0 -p tcp --dport 143 -j DNAT --to 192.168.122.82:143
- -A PREROUTING ! -i virbr0 -p tcp --dport 993 -j DNAT --to 192.168.122.82:993
- -A PREROUTING ! -i virbr0 -p tcp --dport 995 -j DNAT --to 192.168.122.82:995
- -A POSTROUTING -s 192.168.122.0/24 ! -d 192.168.122.0/24 -p tcp -j MASQUERADE --to-ports 1024-65535
- -A POSTROUTING -s 192.168.122.0/24 ! -d 192.168.122.0/24 -p udp -j MASQUERADE --to-ports 1024-65535
- -A POSTROUTING -s 192.168.122.0/24 ! -d 192.168.122.0/24 -j MASQUERADE
- COMMIT
复制代码 如果在外网或者KVM虚拟机上访问此服务器的25端口都是正常的,只有服务器本身没法访问到25端口。
请各位指点一下,谢谢! |
|