Hacking DHCP in a home network

For good or bad at home i do have a cable provided, it is the traditional service where a coaxial cable is connected to the TV.  Some days ago a technician from the TV cable company came and installed a decoder.  This decoder is a device that connects between the coaxial and the television enabling a better quality of images, it also includes a software with Youtube and applications to watch TV through Internet.

The problem: This decoded is connected to the home network (LAN) but it do not permits to set a static IP address, the only way is that the device obtains an IP/network mask/router ip and dhcp servers through DHCP.
The real problem is that i take very seriously what i enable and not in my home network, each new service is something i worry about.  I wanted to avoid a DHCP server.

How to avoid having to install a DHCP server and make the decoder work ?
Not making it work is no an option.  Solution: Create a DHCP minimalistic server with less than 200 lines, a script if possible, simple to start and close, having control on each IP i assign to each MAC address.

The RFC describes how this protocol works, a picture will help understanding how the program works.

                Server          Client          Server
            (not selected)                    (selected)

                  v               v               v
                  |               |               |
                  |     Begins initialization     |
                  |               |               |
                  | _____________/|\____________  |
                  |/DHCPDISCOVER | DHCPDISCOVER  \|
                  |               |               |
              Determines          |          Determines
             configuration        |         configuration
                  |               |               |
                  |\             |  ____________/ |
                  | \________    | /DHCPOFFER     |
                  | DHCPOFFER\   |/               |
                  |           \  |                |
                  |       Collects replies        |
                  |             \|                |
                  |     Selects configuration     |
                  |               |               |
                  | _____________/|\____________  |
                  |/ DHCPREQUEST  |  DHCPREQUEST\ |
                  |               |               |
                  |               |     Commits configuration
                  |               |               |
                  |               | _____________/|
                  |               |/ DHCPACK      |
                  |               |               |
                  |    Initialization complete    |
                  |               |               |
                  .               .               .
                  .               .               .
                  |               |               |
                  |      Graceful shutdown        |
                  |               |               |
                  |               |\ ____________ |
                  |               | DHCPRELEASE  \|
                  |               |               |
                  |               |        Discards lease
                  |               |               |
                  v               v               v
     Figure 3: Timeline diagram of messages exchanged between DHCP
               client and servers when allocating a new network address

Para los más curiosos, recomiendo estos recursos para leer acerca de DHCP:
recurso1
recurso2
recurso3
Esta es una imagen que armé mientras estudiaba el funcionamiento de este viejo protocolo:


Script server source here.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s