2

So I've looked around for a way to change the MTU of interfaces on XenServer 6.2, but can't find anything that works for me ...

One method spoke about changing the ifcnfg-intX files in the /etc/sysconfig/network-scripts directory, but the files just aren't there ... The only one there is the ifcnfg-lo file. Do I just need to create a file for each interface?

Then I thought, I'll just make a startup script:

#!/bin/bash
#Saved as /etc/init.d/mtuchange.sh
#Change mtu of interfaces
ifconfig xenbr0 mtu 1454
ifconfig xenbr1 mtu 1454
ifconfig eth0 mtu 1454
ifconfig eth1 mtu 1454

This script works when ran in console.

So, to make it run at start:

ln -s /etc/init.d/mtuchange.sh /etc/rc3.d/S99mtuchange

But, it wont run ...

The reason I need to change the MTU, is for some strange reason, XenCenter can't connect with the MTU being the default of 1500, it has to be 1454

Anyone know what I'm doing wrong?

  • It's on XenServer as I explained in the question ... Yes, the script and commands run on their own, as I explained in the question. Nope, there's no errors, and I've got it set to `S99` in rc3.d so that it runs last, as I ... Oh nevermind – Just Lucky Really May 21 '14 at 18:08
  • Oops sorry for the silly question, I'm not familiar with XenServer and I thought it only was a hypervisor rather than a complete distribution. Do you have a file such as `/etc/network/interfaces` where you defined the interface's IPs ? Can you show what it looks like ? –  May 21 '14 at 18:14
  • No worries ... XenServer doesn't have the `interfaces` file ... It doesn't even have the `/etc/network` dir Lol ... I've been looking around for some documentation on how to edit network configurations, but no luck so far :( ... The only way I've found to change the config, is either with XenCenter (Which doesn't let you change the MTU) or through xsconsole, which also doesn't let you change it – Just Lucky Really May 21 '14 at 18:18
  • Here's one more try : `xe vif-param-set uuid= other-config:mtu=1454` (I believe "vif-uuid" stands for the UUID of the virtual interface, and I'm not sure if that will persist across reboots of the host). –  May 21 '14 at 18:31
  • That would only change the virtual interface for a VM ... I need to change the mtu for the physical and bridge interfaces. Nice try though ... Here's a picture of a hamster in a toilet roll for your troubles: http://img710.imageshack.us/img710/6677/screenshot20100621at858.png – Just Lucky Really May 21 '14 at 18:37
  • What exactly do you mean with won't run? You could add a command like `touch /tmp/$$` to the script to know if it was run or not. Did you remember to make the script executable? – kasperd May 21 '14 at 18:43
  • Yep, made it executable. When I say it won't run, I mean, the expected result is not achieved, and no errors output. I'll try the `touch` idea and see what happens ... – Just Lucky Really May 21 '14 at 18:46
  • But if you run it on all virtual interfaces is should still solve your problem, you can at least use this while searching for a better solution. And thanks for the hamster. :) –  May 21 '14 at 18:56
  • My work around for the moment is to just manually change the MTU by SSHing into the server and using the commands explained above. I just want to have this automatic. – Just Lucky Really May 21 '14 at 18:58
  • Use a cron job every 5 minutes ? Running the command over and over again won't do any damage. –  May 21 '14 at 18:59
  • Yeah the file is created with `touch` in the script, but the interfaces still dont have their mtu changed :( ... This leads me to believe that something else is ran after my script has ran. @kasperd – Just Lucky Really May 21 '14 at 19:11
  • cron job every 5 minutes? ... Erm ... no ... Thanks for the input though :D – Just Lucky Really May 21 '14 at 19:12
  • 1
    @Stretch Have the script save the output of `ifconfig -a` somewhere so you know what was the state right after those three ifconfig commands? – kasperd May 21 '14 at 19:16
  • Yep, the ouput ifconfig at this time has the MTU at 1454. But weirdly the `xenbr1` interface is not there. So, I think now I need to find out what is running afterwards, and how to get my script to run after that. – Just Lucky Really May 21 '14 at 19:26

2 Answers2

2

There's some discussion on the Xen wiki of how to do this: Xen wiki network performance page. In short:

Enabling Jumbo Frames

Suppose eth6 and xenbr6 are the device and the bridge corresponding to the 10 GiB/sec connection used.

Shut down user domains:

VMs=$(xe vm-list is-control-domain=false params=uuid --minimal | sed 's/,/ /g')
for uuid in $VMs; do xe vm-shutdown uuid=$uuid; done`

Set network MTU to 9000, and re-plug relevant PIFs:

net_uuid=`xe network-list bridge=xenbr6 params=uuid --minimal`
xe network-param-set uuid=$net_uuid MTU=9000
PIFs=$(xe pif-list network-uuid=$net_uuid --minimal | sed 's/,/ /g')
for uuid in $PIFs; do xe pif-unplug uuid=$uuid; xe pif-plug uuid=$uuid; done

Start user domains (you might want to make sure that VMs are started one after another to avoid potential VIF static allocation problems):

VMs=$(xe vm-list is-control-domain=false params=uuid --minimal | sed 's/,/ /g')
for uuid in $VMs; do xe vm-start uuid=$uuid; done

Set up the connections you will use inside the user domains to use MTU 9000. For Linux VMs, this is done with:

ETH=eth1   # the user domain connection you are concerned with
ifconfig $ETH mtu 9000 up

Verifying:

xe vif-list network-uuid=$net_uuid params=MTU --minimal
Bill Weiss
  • 10,782
  • 3
  • 37
  • 65
  • I believe [this site](http://heeeeeeeey.com/) can describe what I think about this answer – Just Lucky Really May 21 '14 at 20:04
  • Thanks dude ... Specifically, what I used from your answer was the `net_uuid=\`xe network-list bridge=xenbr6 params=uuid --minimal\` xe network-param-set uuid=$net_uuid MTU=9000` commands – Just Lucky Really May 21 '14 at 20:05
  • :D Glad to help. A while ago Xen didn't support jumbo frames at all, so I actually came to tell you you were SOL, but things evidently changed. – Bill Weiss May 22 '14 at 00:26
0

When faced with MTU related problems, it may be more effective to modify the MSS rather than tweaking MTU of individual links. It looks like that platform is based on Linux, so iptables would be available. This couple of iptables rules could reduce the MSS on SYN packets in both directions and thus dodge most of the MTU issues.

iptables -t mangle -A PREROUTING -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --set-mss 1220
iptables -t mangle -A POSTROUTING -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --set-mss 1220

If using this set of rules instead of changing the MTU, you can permanently add them to your iptables configuration.

kasperd
  • 29,894
  • 16
  • 72
  • 122