eric dombroski

Linux Versus Windows: File Server Performance

Test Server

Dell PowerEdge 2950
Dual Quad Core Xeon CPUs (3GHz)
16GB RAM
2x 300GB 15000rpm HDD, RAID-0

Test Client

Dell PowerEdge 2550
Dual Xeon CPUs (933MHz)
4GB RAM
2x 18GB 10000rpm HDD, RAID-1

Read the rest of this entry »

Configure Multiple Addresses with DHCP on Linux


Problem

  • In an age where globally route-able IP addresses are treated as a precious commodity, your residential Internet Service Provider happens to give you three as part of the basic package, but all over DHCP.
  • You want the flexibility provided by having those three global IPs, but the safety and security of a router/firewall, or you happen to have more than three devices that need to use the Internet.

Solution: Build your own Router!

  • How to build your own router is more than well documented on the web, and I won’t re-invent the wheel here. Most solutions involve a cheap PC, two network cards, and a Linux distribution.
  • Assigning more than one static IP address to a single Network Interface Card is common practice for certain applications like Web Servers, and is accomplished in Linux using aliases (e.g., eth0:0) or in Windows by editing the Advanced TCP/IP properties for your network connection.
  • The tricky part is getting those addresses via DHCP.

But how do I get more than one IP address on the same NIC via DHCP?

The way I discovered was by using a DHCP client for Linux called dhcpcd, which is available in many distributions’ package managers. dhcpcd has an option -I that allows you to specify your “Client ID” to the DHCP server. If not specified, the DHCP client sends your MAC address as the Client ID. For instance:

/sbin/dhcpcd -I 00:0B:20:21:22:23 eth0
/sbin/dhcpcd -I 00:0B:20:25:22:24 eth0:0
/sbin/dhcpcd -I 00:0B:20:25:22:25 eth0:1

You’re not spoofing your MAC address to the network itself, but just to the DHCP server.  From here, you can go on to create iptables rules to do whatever sort of NAT or Port Forwarding you wish. For instance, you might want to enable Remote Desktop to two different computers on your home network. With an off-the-shelf router, you would have to assign 3389 to one internal computer and a non-default port (e.g., 3390) to another. With the flexibility of more than one address, this is not necessary.