This commit is contained in:
Astro 2016-11-09 01:18:00 +01:00
parent 718eba8ab9
commit f7490a06fa
5 changed files with 21 additions and 4 deletions

View File

@ -8,6 +8,13 @@ kvm -hda salt.hda -m 1024 -smp 2 -net nic,model=e1000 -net user -cdrom
Now run the Debian installation. Hostname: `server1` Now run the Debian installation. Hostname: `server1`
```shell
brctl addbr br-up1
ifdown eth0
brctl addif br-up1 eth0
dhclient br-up1
```
# Bootstrap # Bootstrap
Configure a recent version, eg. *stretch* Configure a recent version, eg. *stretch*

View File

@ -5,3 +5,5 @@ base:
- vlans - vlans
'*gw': '*gw':
- dhcp - dhcp
'upstream1':
- upstream.upstream1

View File

@ -13,7 +13,8 @@ lxc.network.flags=up
{%- if conf['type'] == 'veth' %} {%- if conf['type'] == 'veth' %}
lxc.network.veth.pair={{ id }}-{{ net }} lxc.network.veth.pair={{ id }}-{{ net }}
{%- endif %} {%- endif %}
{%- set inet_addr = pillar['hosts-inet'][net].get(id) %} {%- set hosts = pillar['hosts-inet'].get(net) %}
{%- set inet_addr = hosts and hosts.get(id) %}
{%- if inet_addr %} {%- if inet_addr %}
{%- set prefix_len = pillar['subnets-inet'][net].split('/')[1] %} {%- set prefix_len = pillar['subnets-inet'][net].split('/')[1] %}
lxc.network.ipv4={{ inet_addr }}/{{ prefix_len }} lxc.network.ipv4={{ inet_addr }}/{{ prefix_len }}
@ -24,8 +25,9 @@ lxc.network.link=br-{{ net }}
lxc.network.link=bond0.{{ pillar['vlans'].get(net) }} lxc.network.link=bond0.{{ pillar['vlans'].get(net) }}
{%- endif %} {%- endif %}
lxc.network.name={{ net }} lxc.network.name={{ net }}
{%- if net == 'core' %} {%- set gw = conf.get('gw') %}
lxc.network.ipv4.gateway=172.20.72.1 {%- if gw %}
lxc.network.ipv4.gateway={{ pillar['hosts-inet'][net][gw] }}
{%- endif %} {%- endif %}
#lxc.network.ipv6= #lxc.network.ipv6=
#lxc.network.ipv6.gateway=fe80::1 #lxc.network.ipv6.gateway=fe80::1

View File

@ -2,6 +2,7 @@ pub-gw:
interfaces: interfaces:
core: core:
type: veth type: veth
gw: anon1
pub: pub:
type: phys type: phys
@ -9,6 +10,7 @@ serv-gw:
interfaces: interfaces:
core: core:
type: veth type: veth
gw: upstream1
serv: serv:
type: veth type: veth
@ -16,16 +18,20 @@ priv1-gw:
interfaces: interfaces:
core: core:
type: veth type: veth
gw: upstream1
priv2-gw: priv2-gw:
interfaces: interfaces:
core: core:
type: veth type: veth
gw: upstream1
upstream1: upstream1:
interfaces: interfaces:
core: core:
type: veth type: veth
up1:
type: veth
anon1: anon1:
interfaces: interfaces:

View File

@ -13,9 +13,9 @@ base:
- no-ssh - no-ssh
- forwarding - forwarding
- ospf - ospf
- upstream.dhcp
- unbound - unbound
'anon*': 'anon*':
- no-ssh - no-ssh
- forwarding - forwarding
- ospf - ospf
- unbound