dummy devices and dhcp?

Discussion in 'Installation/Configuration' started by savoyardal, Jul 23, 2006.

  1. savoyardal

    savoyardal New Member

    My school's network is set up in such a way that when it sees a MAC address you have registered to yourself, it assigns it an IP address and updates its entry in the campus DNS servers. So basically, no matter where I plug in to the network, I will always get the same hostname (but not IP address, since each building is in a different subnet). I'd like to be able to get dummy ethernet devices to broadcast DHCP requests, with their own MAC addresses so that I can get traffic bound for multiple hostnames sent to my machine. Essentially, I want the network to think my one ethernet adapter is actually a hub (a bridge maybe?) with multiple computers on it, so that I can then host multiple websites using Apache's virtual hosting abilities.

    I've added a dummy device (dummy0) with
    Code:
    modprobe dummy
    It shows up in ifconfig, and when I set the IP manually, I can ping it. When I try to
    Code:
    dhclient dummy0
    it times out.

    I've tried bridging eth0 and dummy0 with:
    Code:
    ifdown eth0
    ifdown dummy0
    brctl addbr br0
    brctl addif dummy0
    brctl addif eth0
    ifconfig br0 up
    ifconfig eth0 up
    ifconfig dummy0 up
    
    Since the br0 device takes on the MAC address of eth0, it gets a valid IP via DHCP with no problems. Trying to get dummy0 to get an IP still doesn't work.

    All of these commands are run with root priviledges. I'm using ubuntu 6.06.

    Can anyone point in the right direction?
     
  2. falko

    falko Super Moderator Howtoforge Staff

    Why don't you use eth0 to host your web sites?
     
  3. savoyardal

    savoyardal New Member

    That's what I'm doing, except that my network card is only getting traffic bound for one of my hostnames. I want to add dummy interfaces so that I can get traffic bound for multiple hosts. Here's how the set up on 'their' end works:

    1. You register a MAC address and pick a hostname for it.
    2. Whenever that MAC address requests a DHCP lease, it is given an IP address valid in that building's subnet. At the same time, the DHCP server sends an update to the DNS server, telling it the new IP of that particular hostname.
    3. I have no control over the DNS server, or the DHCP server. All I can do is register MAC addresses to myself.

    Basically I need one network card to broadcast DHCP requests for multiple dummy cards. I know it's possible because Parallels and VMware both do it with their virtual ethernet devices. Howerver, I don't want to do any virtualization.

    Anybody have any tips?
     
  4. falko

    falko Super Moderator Howtoforge Staff

    You could add this to /etc/network/interfaces:

    Code:
    auto dummy0
    iface dummy0 inet dhcp
    Restart your network afterwards:
    Code:
    /etc/init.d/networking restart
     
  5. savoyardal

    savoyardal New Member

    I tried that but then when I restart networking and it gets to dummy0 it sends out dhcp requests, but they dont seem to go anywhere, because the dhcp requests timeout while the dhcp requests on eth0 are answered instantly.

    Anyone have any ideas?
     
  6. falko

    falko Super Moderator Howtoforge Staff

    Have you tried virtual interfaces, such as

    Code:
    auto eth0:0
    iface eth0:0 inet dhcp
    ?
     
  7. savoyardal

    savoyardal New Member

    Since eth0:0 will acquire an IP address by broadcasting with eth0's MAC address, it will give me the same IP for eth0:0 as eth0.

    Anyone have any suggestions?
     
  8. falko

    falko Super Moderator Howtoforge Staff

Share This Page