diff --git a/network/interface.go b/network/interface.go index 877cb9e..73a83cb 100644 --- a/network/interface.go +++ b/network/interface.go @@ -130,7 +130,17 @@ type bondInterface struct { } func (b *bondInterface) Netdev() string { - return fmt.Sprintf("[NetDev]\nKind=bond\nName=%s\n", b.name) + config := fmt.Sprintf("[NetDev]\nKind=bond\nName=%s\n", b.name) + if b.hwaddr != nil { + config += fmt.Sprintf("MACAddress=%s\n", b.hwaddr.String()) + } + + config += fmt.Sprintf("\n[Bond]\n") + for _, name := range sortedKeys(b.options) { + config += fmt.Sprintf("%s=%s\n", name, b.options[name]) + } + + return config } func (b *bondInterface) Type() string { diff --git a/network/interface_test.go b/network/interface_test.go index df6eea3..5cafc93 100644 --- a/network/interface_test.go +++ b/network/interface_test.go @@ -52,7 +52,7 @@ func TestInterfaceGenerators(t *testing.T) { }, { name: "testname", - netdev: "[NetDev]\nKind=bond\nName=testname\n", + netdev: "[NetDev]\nKind=bond\nName=testname\n\n[Bond]\n", network: "[Match]\nName=testname\n\n[Network]\nBond=testbond1\nVLAN=testvlan1\nVLAN=testvlan2\nDHCP=true\n", kind: "bond", iface: &bondInterface{logicalInterface: logicalInterface{