I run this website off a server running on an ADSL line in a spare bedroom of my home. That causes some weird issues from time to time, like the time I had to figure out setting the MTU automatically in Debian.
My server of choice is Debian, because it’s Linux which makes it fast, reliable, and cheap, and Debian makes it pretty easy to install only what you want and need, so I can have a server OS that’s only using 125 megabytes of disk space, leaving most of my drive available for content. I like having space for content.
This will work in Debian-derived systems like Ubuntu and Linux Mint too.
Now, the downside of modern DSL: Southwestern Bell, like most ISPs these days, uses PPPoE. So not only can your IP address change with no notice whatsoever, you also have the hassles of PPPoE. With the default settings, some unknown but noticeably large percentage of web users won’t be able to access a web server running on a DSL connection using PPPoE.
The reason is MTU and fragmentation.Yes, you remember MTU if you used Windows 9x back in the bad old days of dialup. Tweakers would play around with the MTU settings in hopes of squeezing just a little more performance out of their 56K modems, and they would swear that one utility did a better job than any others, or that this MTU setting was optimal and the conventional wisdom of 576 stank… Remember those flamewars?
Well, with broadband, theoretically the right setting to use is 1500. Trouble is, PPPoE steals some of that packet space, and the result is something worse than slow speeds. In some scenarios, you completely vanish.
Setting the MTU
The way to make my website reappear is to issue the command ifconfig eth0 mtu 1472. The exact number doesn’t seem to matter much. It appears for me that 1472 is the maximum I can use. (It can vary from ISP to ISP, in case you’re wondering.)
Excellent. Problem solved.
Not so fast. Problem solved until my server reboots. Linux doesn’t need to reboot, right? Right you are. But here in St. Louis, the power likes to hiccup a lot, especially in the summertime. My server is on a UPS, but every once in a while, in the middle of the night, there must be a long enough power failure that my UPS dies, because every once in a while I fall off the ‘net again.
To set the default MTU permanently–that is, to change it automatically on bootup–one normally would change the ifup script or the rc.startup script. Except Debian doesn’t have either of those.
My kludgy solution: cron. Log in as root, issue the command crontab -e, and add the following line:
*/2 * * * * ifconfig eth0 mtu 1472
With this in place, only seconds will elapse between the time my power comes back on for good and I reappear on the ‘net. I can live with that.
More Debian tricks
If you change your network card or motherboard, you don’t have to reinstall Debian but you may lose eth0. Here’s how to get eth0 back. And here’s how to get a list of the installed packages in Debian.