1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112 | ## for bug http://pad.lv/1675571
## ENI rendering of multiple addresses of the same where each subnet
## has different nameservers (or one has nameserver and the other do not).
## will have issues where resolvconf will get updated with only the last
## address to come up (because resolvconf is per interface not per address)
##
## In there example below, the suggested fix is to have the superset
## of all dns-nameservers listed for each stanza.
##
## For example, we'd expect *each* address stanza to have:
## dns-nameservers 192.168.1.2 10.0.0.2/24
## dns-search utlemming.com
##
##
$ cat my.cfg
version: 1
config:
- type: physical
name: myen0
mac_address: fe:de:ac:13:4c:d4
subnets:
- type: static
address: 192.168.1.10/24
gateway: 192.168.1.1
dns_nameservers: ["192.168.1.2"]
dns_search: ["utlemming.com"]
- type: static
address: 2001:db8::2:1/64
- type: static
address: 10.0.0.2/24
dns_nameservers: ["10.0.0.1"]
$ rm -Rf my.d;
$ PYTHONPATH=$PWD ./tools/net-convert.py \
--network-data=my.cfg --kind=yaml --output-kind=eni -d my.d
Input YAML
config:
- mac_address: fe:de:ac:13:4c:d4
name: myen0
subnets:
- address: 192.168.1.10/24
dns_nameservers:
- 192.168.1.2
dns_search:
- utlemming.com
gateway: 192.168.1.1
type: static
- address: 2001:db8::2:1/64
type: static
- address: 10.0.0.2/24
dns_nameservers:
- 10.0.0.1
type: static
type: physical
version: 1
Internal State
!!python/object:cloudinit.net.network_state.NetworkState
_network_state:
dns:
nameservers: []
search: []
interfaces:
myen0:
address: null
gateway: null
inet: inet
mac_address: fe:de:ac:13:4c:d4
mode: manual
mtu: null
name: myen0
subnets:
- address: 192.168.1.10/24
dns_nameservers:
- 192.168.1.2
dns_search:
- utlemming.com
gateway: 192.168.1.1
type: static
- address: 2001:db8::2:1/64
type: static
- address: 10.0.0.2/24
dns_nameservers:
- 10.0.0.1
type: static
type: physical
routes: []
use_ipv6: true
_version: 1
use_ipv6: true
$ cat my.d/etc/network/interfaces
auto lo
iface lo inet loopback
auto myen0
iface myen0 inet static
address 192.168.1.10/24
dns-nameservers 192.168.1.2
dns-search utlemming.com
gateway 192.168.1.1
# control-alias myen0
iface myen0 inet6 static
address 2001:db8::2:1/64
# control-alias myen0
iface myen0 inet static
address 10.0.0.2/24
dns-nameservers 10.0.0.1
|