[Techtalk] network query

John Clarke johnc+linuxchix at kirriwa.net
Mon Jan 12 00:14:30 EST 2004


On Sun, Jan 11, 2004 at 09:54:30 +1100, Patricia Fraser wrote:

> I am in the process of connecting to ADSL via a D-Link 300+ modem, which 
> has a built-in pppoe client. The advice from the ISP is to use DHCP to 
> get the IP address. This works fine on the machine I've got connected 
> now.

This is exactly the setup I have here.  It works fine, and depending
upon your ISP, you could have the same IP address for months at a time.

I'm running RH7.3 and I have my external interface, eth1, configured as
(this is in /etc/sysconfig/network-scripts/ifcfg-eth1):

    DEVICE=eth1         # device name
    BOOTPROTO=dhcp      # use dhcp (use "static" for a fixed address)
    ONBOOT=yes          # start the interface on boot
    PEERDNS=no          # prevents ifup changing /etc/resolv.conf - I
                        #   run a caching name server locally
    FIREWALL_MODS=no    # prevents ifup from inserting firewall rules
                        #   to allow dns traffic - my firewall rules
                        #   already allow it and I don't want anything
                        #   messing with my firewall

eth0 is my internal network and is configured like this:

    DEVICE=eth0
    BOOTPROTO=static
    BROADCAST=192.168.1.255
    IPADDR=192.168.1.1
    NETMASK=255.255.255.0
    NETWORK=192.168.1.0
    ONBOOT=yes

> My problem is, I now want to set up a home network, using the connected 
> PC as the gateway/firewall. But my head isn't around the DHCP vs. 

It's much the same as how you'd do it with a modem, but instead of your
default route being ppp0, it's eth0 (or eth1 or whatever).

You should have two network cards in your gateway.  One connects to the
internet via the dlink-300+, the other connects to your internal
network, something like this:

                          Internet
                             |
                         ----------
                         | d-link |
                         |  300+  |
                         ----------
                             | public dhcp address
                        ------------
                        | firewall |
                        ------------
                             |
                    ------------------- internal network
                    |                 | static or dhcp addresses
                 ------            ------
                 | pc |            | pc |
                 ------            ------
                 
You can use static addressing or dhcp or even a combination of the two
on your internal network, but you should use a private address range
from RFC 1918.  The internal machines need to be given the internal ip
address of the firewall as their default gateway, and you setup
firewall rules on your gateway to do NAT or masquerading so that the
internal machines can talk to the outside world.

> standard routing thing; if the gateway machine gets a new IP address 
> from the ISP periodically, then how do I manage this? Will all the 

Only the gateway needs to know about the external IP address, and the
dhcp client takes care of it, so you don't need to do anything when it
changes.  The other machines don't need to know.

> machines in the network have to use DHCP, or can I mix the two methods?

You can mix the two.  You can have both DHCP and static addresses on
the same network segment, and you can even configured your DHCP server
to hand out static addresses to some or all machines based on the
hardware (MAC) address of their ethernet cards.

> I can possibly use a pppoe client from the gateway and bypass all this, 

I don't think the Dlink-300+ will work that way, and it's much easier
not to.

If you want more info (e.g. firewall rules, dhcp server configuration),
just ask.


Cheers,

John
-- 
whois !JC774-AU at whois.aunic.net
GPG key id: 0xD59C360F
http://kirriwa.net/john/


More information about the Techtalk mailing list