<div dir="ltr">
<p style="margin-bottom:0cm">Dear OpenNebula Community,</p><p style="margin-bottom:0cm">I want to install/configure a virtual LAN (<a href="http://192.168.120.0/24" target="_blank">192.168.120.0/24</a>) in one dedicated root server in data center. </p>
<p style="margin-bottom:0cm">eth0 is the physical interface of this root server. virbr0 is the default virtual LAN switch provided by libvirtd (virbr0-nic is the correspondent virtual interface of virbr0). the virtual network switch is in NAT mode. a VM in this virtual LAN, and some applications runs in this VM. for externally accessing the applications (e.g. web server) run in the VM, need to use iptables command similar as below:</p>
<p style="margin-bottom:0cm">"</p><p style="margin-bottom:0cm">LAN="virbr0"<br>WAN="eth0"<br>LAN_IP="192.168.120.1"<br>WAN_IP="172.20.85.28"<br>VM_IP="192.168.120.100"<br>
</p>
<p>iptables -t nat -A PREROUTING -p tcp
-d $WAN_IP --dport 80 -j DNAT --to-destination
$VM_IP</p>
<p>iptables -t nat -A POSTROUTING -p tcp
-d $LAN_IP --dport 80 -j SNAT --to-source $VM_IP</p>
<p>iptables -t nat -A OUTPUT -p tcp -d $WAN_IP --dport 80 -j DNAT --to-destination $VM_IP</p>
<p>iptables -i FORWARD -p tcp -m tcp
--in-interface $WAN --out-interface $LAN -d $VM_IP
--dport 80 --j ACCEPT</p><p>"</p><p>however after running the .sh script with the above iptables command, get below error</p><p>"</p><p>iptables v1.4.12: multiple -i flags not allowed</p>
<p>Try `iptables -h' or 'iptables --help' for more information.</p><p>"</p><p>run the .sh script after commenting out the command "iptables -i FORWARD -p tcp -m tcp --in-interface $WAN --out-interface $LAN -d $VM_IP --dport 80 --j ACCEPT", there is no error in the output. but only can locally access the VM web server with the registered domain name (i.e. can locally access the website hosted in the VM web server, within the virtual LAN scope), but can't externally access the website hosted in this VM web server.</p>
<p style>there may be some problem with this iptables .sh script. it is much appreciated if anyone can assist with this.</p><p style>thanks,<br>Q.S.</p></div>