Ali cloud to share Internet access

1. Ali cloud inside VPC to add routes

 

Ali cloud -> proprietary network -> Administration -> Routing Table -> Administration -> Add route entry

2. The public IP address of the machine to do forward

Check the forwarding
cat / proc / sys / net / ipv4 / ip_forward

Open Forwarded

echo "1" > /proc/sys/net/ipv4/ip_forward
echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf

# Take effect
sysctl -p

View the current forward
iptables -t nat -L -nv

 

# Configure iptables do SNAT: iptables -t nat -I POSTROUTING -s VPC 's IP segment -j SNAT --to-source ECS within a public network IP network IP
iptables -t NAT the -I POSTROUTING -s 192.168.1.0/24 -j SNAT --to-source 192.168.1.192

To delete this later, use the
iptables -t nat -D 1 POSTROUTING
latter figure corresponds to the line number

3. The public network ip did not check the routing
route -n

Guess you like

Origin www.cnblogs.com/aozima/p/11505594.html