D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
opt
/
godaddy
/
docker
/
Filename :
configure-snat
back
Copy
#!/bin/bash mkdir -p /mnt/cdrom mount /dev/sr0 /mnt/cdrom # In Pike, Nova no longer writes net config to 0000 CONTENT_PATH=/mnt/cdrom/openstack/content IP_FILE=0000 [ "$(head -n1 ${CONTENT_PATH}/0000)" == "# Injected by Nova on instance boot" ] && IP_FILE=0001 PUBLIC_IP=$(cat ${CONTENT_PATH}/${IP_FILE}) umount /dev/sr0 until [ "$(/usr/bin/docker network inspect --format '{{ .Name }}' bridge)" == "bridge" ]; do echo "waiting for docker bridge..." sleep 0.1 done DOCKER_NETWORK=$(ip -f inet -o addr show docker0 scope global | cut -d\ -f 7) set -x iptables -t nat -D POSTROUTING -s ${DOCKER_NETWORK} ! -o docker0 -j SNAT --to ${PUBLIC_IP} iptables -t nat -I POSTROUTING -s ${DOCKER_NETWORK} ! -o docker0 -j SNAT --to ${PUBLIC_IP}
Name
Size
Last Modified
Owner
Permissions
Actions
configure-snat
0.727
KB
April 13 2020 11:01:03
root
0755
2017 © D7net | D704T team