V
V
VA2016-03-11 10:33:19
iptables
VA, 2016-03-11 10:33:19

Port forwarding to a virtual machine (Libvrt, QEMU, CentOS. WS2012R2)?

Hello!

There is a Windows Server 2012R2 virtual machine, on CentOS 6.7.
In general, you need to forward the port for FTP.

For example:
external IP xx.xxx.xx.xxx, eth0
Virtual machine IP yy.yyy.yyy.yy, virbr0
In this case?

iptables -t nat -A PREROUTING --dst xx.xxx.xx.xxx -p tcp --dport 21 -j DNAT --to-destination yy.yyy.yyy.yy
iptables -I FORWARD 1 -i eth0 -o virbr0 -d yy.yyy.yyy.yy -p tcp -m tcp --dport 21 -j ACCEPT

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vadim K, 2016-03-11
@OLQLOSH

iptables -t nat-A PREROUTING -p tcp -m tcp -d xx.xxx.xx.xxx -i eth0 --dport 21 -j DNAT --to-destination yy.yyy.yyy.yy:21

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question