Created
August 12, 2014 16:26
-
-
Save jblancett/6c4e3457a03614c22a27 to your computer and use it in GitHub Desktop.
knife-linode bootstrap template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% if @config[:private_ip] %> | |
( | |
cat <<'EOP' | |
# The loopback interface | |
auto lo | |
iface lo inet loopback | |
# Configuration for eth0 and aliases | |
# This line ensures that the interface will be brought up during boot. | |
auto eth0 eth0:0 | |
# eth0 - This is the main IP address that will be used for most outbound connections. | |
# The address, netmask and gateway are all necessary. | |
iface eth0 inet static | |
address <%= @config[:public_ip] %> | |
netmask 255.255.255.0 | |
gateway <%= @config[:public_ip].split('.')[0..-2].join('.') %>.1 | |
# eth0:0 - Private IPs have no gateway (they are not publicly routable) so all you need to | |
# specify is the address and netmask. | |
iface eth0:0 inet static | |
address <%= @config[:private_ip] %> | |
netmask 255.255.128.0 | |
EOP | |
) > /etc/network/interfaces | |
/etc/init.d/networking restart | |
<% end %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment