cloudstack-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CLOUDSTACK-10346) Problem with NAT configuration and VMs not accessing each other via public IPs
Date Wed, 18 Apr 2018 17:38:00 GMT

    [ https://issues.apache.org/jira/browse/CLOUDSTACK-10346?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16442923#comment-16442923
] 

ASF GitHub Bot commented on CLOUDSTACK-10346:
---------------------------------------------

rhtyd commented on issue #2514: [CLOUDSTACK-10346] Problem with NAT configuration and VMs
not accessing each other via public IPs
URL: https://github.com/apache/cloudstack/pull/2514#issuecomment-382468606
 
 
   @rafaelweingartner okay I did a quick test. I allocated a public IP to my VPC, but did
not SNAT it to any VM. Next I used console-proxy and was able to ssh from other vm to the
VM which was port-forwarded to the VM with public IP (nat).
   
   iptables rules outputs:
   ```
   #iptables -t nat -S
   -P PREROUTING ACCEPT
   -P INPUT ACCEPT
   -P OUTPUT ACCEPT
   -P POSTROUTING ACCEPT
   -A PREROUTING -d 192.168.1.53/32 -p tcp -m tcp --dport 22 -j DNAT --to-destination 10.1.1.50:22
   -A OUTPUT -d 192.168.1.53/32 -p tcp -m tcp --dport 22 -j DNAT --to-destination 10.1.1.50:22
   -A POSTROUTING -s 10.1.1.0/24 -o eth2 -j SNAT --to-source 10.1.1.1
   -A POSTROUTING -o eth1 -j SNAT --to-source 192.168.1.56
   -A POSTROUTING -d 192.168.1.53/32 -p tcp -m tcp --dport 22 -j SNAT --to-source 10.1.1.50:22
   
   # iptables -t mangle -S
   -P PREROUTING ACCEPT
   -P INPUT ACCEPT
   -P FORWARD ACCEPT
   -P OUTPUT ACCEPT
   -P POSTROUTING ACCEPT
   -N ACL_OUTBOUND_eth2
   -N VPN_STATS_eth1
   -A PREROUTING -i eth2 -m state --state RELATED,ESTABLISHED -j CONNMARK --restore-mark --nfmask
0xffffffff --ctmask 0xffffffff
   -A PREROUTING -s 10.1.1.0/24 ! -d 10.1.1.1/32 -i eth2 -m state --state NEW -j ACL_OUTBOUND_eth2
   -A FORWARD -j VPN_STATS_eth1
   -A POSTROUTING -p udp -m udp --dport 68 -j CHECKSUM --checksum-fill
   -A ACL_OUTBOUND_eth2 -d 224.0.0.18/32 -j ACCEPT
   -A ACL_OUTBOUND_eth2 -j ACCEPT
   -A ACL_OUTBOUND_eth2 -d 225.0.0.50/32 -j ACCEPT
   -A VPN_STATS_eth1 -o eth1 -m mark --mark 0x525
   -A VPN_STATS_eth1 -i eth1 -m mark --mark 0x524
   
   
   # iptables -t filter -S
   -P INPUT DROP
   -P FORWARD DROP
   -P OUTPUT ACCEPT
   -N ACL_INBOUND_eth2
   -N NETWORK_STATS
   -N NETWORK_STATS_eth1
   -A INPUT -d 10.1.1.1/32 -i eth2 -p tcp -m tcp --dport 443 -m state --state NEW -j ACCEPT
   -A INPUT -d 10.1.1.1/32 -i eth2 -p tcp -m tcp --dport 80 -m state --state NEW -j ACCEPT
   -A INPUT -d 10.1.1.1/32 -i eth2 -p tcp -m tcp --dport 53 -j ACCEPT
   -A INPUT -d 10.1.1.1/32 -i eth2 -p udp -m udp --dport 53 -j ACCEPT
   -A INPUT -j NETWORK_STATS
   -A INPUT -i eth2 -p udp -m udp --dport 67 -j ACCEPT
   -A INPUT -s 10.1.1.0/24 -i eth2 -p udp -m udp --dport 53 -j ACCEPT
   -A INPUT -s 10.1.1.0/24 -i eth2 -p tcp -m tcp --dport 53 -j ACCEPT
   -A INPUT -i eth2 -p tcp -m tcp --dport 80 -m state --state NEW -j ACCEPT
   -A INPUT -i eth2 -p tcp -m tcp --dport 8080 -m state --state NEW -j ACCEPT
   -A INPUT -d 224.0.0.18/32 -j ACCEPT
   -A INPUT -d 225.0.0.50/32 -j ACCEPT
   -A INPUT -p icmp -j ACCEPT
   -A INPUT -i lo -j ACCEPT
   -A INPUT -i eth0 -p tcp -m tcp --dport 3922 -m state --state NEW,ESTABLISHED -j ACCEPT
   -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
   -A FORWARD -j NETWORK_STATS_eth1
   -A FORWARD -j NETWORK_STATS
   -A FORWARD -s 10.0.0.0/8 ! -d 10.0.0.0/8 -j ACCEPT
   -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
   -A FORWARD -d 10.1.1.0/24 -o eth2 -j ACL_INBOUND_eth2
   -A OUTPUT -j NETWORK_STATS
   -A ACL_INBOUND_eth2 -d 225.0.0.50/32 -j ACCEPT
   -A ACL_INBOUND_eth2 -d 224.0.0.18/32 -j ACCEPT
   -A ACL_INBOUND_eth2 -j ACCEPT
   -A ACL_INBOUND_eth2 -j DROP
   -A NETWORK_STATS -i eth0 -o eth2 -p tcp
   -A NETWORK_STATS -i eth2 -o eth0 -p tcp
   -A NETWORK_STATS ! -i eth0 -o eth2 -p tcp
   -A NETWORK_STATS -i eth2 ! -o eth0 -p tcp
   -A NETWORK_STATS_eth1 -s 10.1.1.0/24 -o eth1
   -A NETWORK_STATS_eth1 -d 10.1.1.0/24 -i eth1
   ```
   
   You can check my lab setup here https://lab.yadav.cloud/stack/ (use cloud:cloud, it's a
read only admin :) )

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> Problem with NAT configuration and VMs not accessing each other via public IPs
> ------------------------------------------------------------------------------
>
>                 Key: CLOUDSTACK-10346
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10346
>             Project: CloudStack
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the default.) 
>            Reporter: Rafael Weingärtner
>            Assignee: Rafael Weingärtner
>            Priority: Major
>
> When users create a VPC, and configure a NAT from a public IP to application in a VM.
This VM(applications) are not accessible via public IP for other VMs in the same VPC.
>  
> The problem is in the NAT table. If you take a closer look at rules, you will see something
like:
> {code:java}
> -A PREROUTING -d publicIP/32 -i eth1 -p tcp -m tcp --dport 80 -j DNAT --to-destination
internalIp:80
> {code}
> The problem is that according to this rule only packets coming via eth1(public interface),
will be “redirected” to the internal IP. We need an extra entry to each one of the NAT
configurations. For the presented rule, we would need something like:
> {code:java}
> -A PREROUTING -d publicIP/32 -i eth2 -p tcp -m tcp --dport 80 -j DNAT --to-destination
internalIp:80
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message