Rate this page

Flattr this

Change the MTU of an network interface using DHCP

Tested on

Ubuntu (Maverick)

Objective and Background

See Change the MTU of a network interface.

Scenario

Suppose that you are running a DHCP server for the subnet 192.168.0.0/24. You wish to use jumbo frames on this subnet with an MTU of 9000. All affected machines either:

Method

Overview

A DHCP server can supply an MTU to its clients by means of the Interface MTU option described in RFC 2132. Since the MTU of all interfaces in a given subnet should normally be the same, it is best to set this option on a per-subnet basis where possible.

The syntax for setting the Interface MTU option will depend on the particular DHCP server in use. Specific instructions for two of these are given below. Alternatively, some DHCP servers allow options to be specified numerically. In the case of the Interface MTU option this is done by setting the option code to 26 then encoding the MTU as a 16-bit unsigned integer.

In all cases, the setting will not take effect on a client until its DHCP lease is renewed. You can force this by taking the interface down then bringing it back up again:

ifdown eth0
ifup eth0

Method (ISC DHCP server)

If the network uses the ISC DHCP server (as provided by the package dhcp3-server on Debian-based systems) then the Interface MTU option can be placed in the relevant subnet declaration:

subnet 192.168.0.0 netmask 255.255.255.0 {
  option broadcast-address 192.168.0.255;
  option routers 192.168.0.1;
  option interface-mtu 9000;
}

Method (udhcpd)

If the network uses udhcpd then there is no provision for configuring individual subsets, therefore the MTU must be set globally:

option mtu 9000

Testing

See Change the MTU of a network interface.

Further reading

Tags: mtu