mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
network: set mtu as a DHCP option when specified
This adds an additional directive to the dnsmasq configuration file that notifies clients via dhcp about the link's MTU. Guests can then choose adjust their link accordingly. Signed-off-by: Casey Callendrello <cdc@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
6dec641394
commit
682be11505
@ -1410,6 +1410,10 @@ networkDnsmasqConfContents(virNetworkObjPtr obj,
|
||||
dctx->addnhostsfile->path);
|
||||
}
|
||||
|
||||
/* Configure DHCP to tell clients about the MTU. */
|
||||
if (def->mtu > 0)
|
||||
virBufferAsprintf(&configbuf, "dhcp-option=option:mtu,%d\n", def->mtu);
|
||||
|
||||
/* Are we doing RA instead of radvd? */
|
||||
if (DNSMASQ_RA_SUPPORT(caps)) {
|
||||
if (ipv6def) {
|
||||
|
19
tests/networkxml2confdata/nat-network-mtu.conf
Normal file
19
tests/networkxml2confdata/nat-network-mtu.conf
Normal file
@ -0,0 +1,19 @@
|
||||
##WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
|
||||
##OVERWRITTEN AND LOST. Changes to this configuration should be made using:
|
||||
## virsh net-edit default
|
||||
## or other application using the libvirt API.
|
||||
##
|
||||
## dnsmasq conf file created by libvirt
|
||||
strict-order
|
||||
except-interface=lo
|
||||
bind-dynamic
|
||||
interface=virbr0
|
||||
dhcp-range=192.168.122.2,192.168.122.254
|
||||
dhcp-no-override
|
||||
dhcp-authoritative
|
||||
dhcp-lease-max=253
|
||||
dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile
|
||||
addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts
|
||||
dhcp-option=option:mtu,7000
|
||||
dhcp-range=2001:db8:ac10:fe01::1,ra-only
|
||||
dhcp-range=2001:db8:ac10:fd01::1,ra-only
|
22
tests/networkxml2confdata/nat-network-mtu.xml
Normal file
22
tests/networkxml2confdata/nat-network-mtu.xml
Normal file
@ -0,0 +1,22 @@
|
||||
<network>
|
||||
<name>default</name>
|
||||
<uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid>
|
||||
<forward dev='eth1' mode='nat'/>
|
||||
<bridge name='virbr0' stp='on' delay='0'/>
|
||||
<mtu size='7000'/>
|
||||
<ip address='192.168.122.1' netmask='255.255.255.0'>
|
||||
<dhcp>
|
||||
<range start='192.168.122.2' end='192.168.122.254'/>
|
||||
<host mac='00:16:3e:77:e2:ed' name='a.example.com' ip='192.168.122.10'/>
|
||||
<host mac='00:16:3e:3e:a9:1a' name='b.example.com' ip='192.168.122.11'/>
|
||||
</dhcp>
|
||||
</ip>
|
||||
<ip family='ipv4' address='192.168.123.1' netmask='255.255.255.0'>
|
||||
</ip>
|
||||
<ip family='ipv6' address='2001:db8:ac10:fe01::1' prefix='64'>
|
||||
</ip>
|
||||
<ip family='ipv6' address='2001:db8:ac10:fd01::1' prefix='64'>
|
||||
</ip>
|
||||
<ip family='ipv4' address='10.24.10.1'>
|
||||
</ip>
|
||||
</network>
|
@ -136,6 +136,7 @@ mymain(void)
|
||||
DO_TEST("nat-network-dns-forwarders", full);
|
||||
DO_TEST("nat-network-dns-forwarder-no-resolv", full);
|
||||
DO_TEST("nat-network-dns-local-domain", full);
|
||||
DO_TEST("nat-network-mtu", dhcpv6);
|
||||
DO_TEST("dhcp6-network", dhcpv6);
|
||||
DO_TEST("dhcp6-nat-network", dhcpv6);
|
||||
DO_TEST("dhcp6host-routed-network", dhcpv6);
|
||||
|
22
tests/networkxml2xmlin/nat-network-mtu.xml
Normal file
22
tests/networkxml2xmlin/nat-network-mtu.xml
Normal file
@ -0,0 +1,22 @@
|
||||
<network>
|
||||
<name>default</name>
|
||||
<uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid>
|
||||
<bridge name="virbr0"/>
|
||||
<mtu size='7000'/>
|
||||
<forward mode="nat" dev="eth1"/>
|
||||
<ip address="192.168.122.1" netmask="255.255.255.0">
|
||||
<dhcp>
|
||||
<range start="192.168.122.2" end="192.168.122.254"/>
|
||||
<host mac="00:16:3e:77:e2:ed" name="a.example.com" ip="192.168.122.10"/>
|
||||
<host mac="00:16:3e:3e:a9:1a" name="b.example.com" ip="192.168.122.11"/>
|
||||
</dhcp>
|
||||
</ip>
|
||||
<ip family="ipv4" address="192.168.123.1" netmask="255.255.255.0">
|
||||
</ip>
|
||||
<ip family="ipv6" address="2001:db8:ac10:fe01::1" prefix="64">
|
||||
</ip>
|
||||
<ip family="ipv6" address="2001:db8:ac10:fd01::1" prefix="64">
|
||||
</ip>
|
||||
<ip family="ipv4" address="10.24.10.1">
|
||||
</ip>
|
||||
</network>
|
24
tests/networkxml2xmlout/nat-network-mtu.xml
Normal file
24
tests/networkxml2xmlout/nat-network-mtu.xml
Normal file
@ -0,0 +1,24 @@
|
||||
<network>
|
||||
<name>default</name>
|
||||
<uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid>
|
||||
<forward dev='eth1' mode='nat'>
|
||||
<interface dev='eth1'/>
|
||||
</forward>
|
||||
<bridge name='virbr0' stp='on' delay='0'/>
|
||||
<mtu size='7000'/>
|
||||
<ip address='192.168.122.1' netmask='255.255.255.0'>
|
||||
<dhcp>
|
||||
<range start='192.168.122.2' end='192.168.122.254'/>
|
||||
<host mac='00:16:3e:77:e2:ed' name='a.example.com' ip='192.168.122.10'/>
|
||||
<host mac='00:16:3e:3e:a9:1a' name='b.example.com' ip='192.168.122.11'/>
|
||||
</dhcp>
|
||||
</ip>
|
||||
<ip family='ipv4' address='192.168.123.1' netmask='255.255.255.0'>
|
||||
</ip>
|
||||
<ip family='ipv6' address='2001:db8:ac10:fe01::1' prefix='64'>
|
||||
</ip>
|
||||
<ip family='ipv6' address='2001:db8:ac10:fd01::1' prefix='64'>
|
||||
</ip>
|
||||
<ip family='ipv4' address='10.24.10.1'>
|
||||
</ip>
|
||||
</network>
|
@ -141,6 +141,7 @@ mymain(void)
|
||||
DO_TEST("nat-network-dns-forwarder-no-resolv");
|
||||
DO_TEST("nat-network-forward-nat-address");
|
||||
DO_TEST("nat-network-forward-nat-no-address");
|
||||
DO_TEST("nat-network-mtu");
|
||||
DO_TEST("8021Qbh-net");
|
||||
DO_TEST("direct-net");
|
||||
DO_TEST("host-bridge-net");
|
||||
|
Loading…
Reference in New Issue
Block a user