# Fedora Core 1, LAN, Dhcp server & Internet access (NAT)



## XunilNewb (Jan 13, 2005)

Hi there I'm currently setting up a Soho LAN that requires internet access with a view to self hosting a site in the near future.
I have an old Dell Poweredge 2200 running Fedora Core 1, a High spec windows XP machine, a switch and a modem (connected to linux box, as you might expect via serial cable). There are two additional PC's to hook up in the future (one may be used as a DNS server). Well I've done a lot of reading but there are still uncertainties in my mind, does anyone mind if I bombard you with newb questions?

Is the hardware that I have, enough to create a network in which the 2200 Poweredge is both the dhcp server and the internet gateway?

Does the Dell need a fixed ip address in order to allocate ip addresses via dhcp? 

If so, what is it that has the fixed ip - is it my nic ie eth0?

Is it best to use ifconfig (ifcfg) to change the ip, what other files need changing?

Can the server (or a machine via the server) connecting to the internet recieve ip info from my isp while acting as a dhcp server. Do I need to purchase a router in order to use NAT? Can I do the same thing using iptables? -- if so how?

*Any* help would be greatly appreciated, cheers guys :wave:


----------



## Skie (Mar 15, 2003)

I did a quick search and found the specs of this server to be:

Dual PII 300Mhz
128MB RAM
2 2GB hard drives

Is this what you have? If not, please specify. I'm going to assume that this is what you have.

Do you want to use a GUI with this machine? If you do, then I would recommend upgrading both the RAM and Hard Drives if you plan on using either KDE or Gnome. If you use a light weight Desktop Enviroment, then you should be fine. If you're just going to use the command line, you should be fine. 

Based on what you've told me, you'll be using a modem for internet connectivity. Your modem/linux will get the dynamic IP from your ISP and assign it to the modem. IPTables will then use NAT to act as a "gateway" between your internal network and the internet. 

The first thing I would do is to setup your internal network. You can use either static or dynamic IP's. Just make sure you setup dhcpd on linux if you want to use DHCP. Once you have the internal network set, configure your modem for connectivity to your ISP. How this is done depends on what you'll be installing (Gnome, KDE or command line). If you need more help here, let us know.

Once you're able to connect, it's time to setup your iptables for NAT. You can look at this page for a good explination: http://www.yolinux.com/TUTORIALS/LinuxTutorialIptablesNetworkGateway.html. There is a lot of information here, but if you start at the top and work your way down, you should be able to figure it out.


----------



## XunilNewb (Jan 13, 2005)

*TY Skie that is usefull info, more info and questions incomming...*

Thanks for your advice (an astonishiongly rapid reply!). The Dell currently has 512KB cache to one PII processor (only one PII chip I'm afraid), 32 MB of 72-bit-wide, buffered EDO-type main memory etc etc.

I installed pretty much all the server options and both KDE and Gnome. As a newb I wanted to check everything out. Things are slow in GUI modes but I'm trying to do everything from the command line. (Essentially I'm just testing stuff out at the mo but I can certainly see myself upgrading my server hardware etc in the future)

I obtained my dhcp.conf file from:

/usr/share/doc/dhcp-3.0pl2/dhcpd.conf.sample

and copied it into my /etc folder --> /etc/dhcpd.conf

I guess I need help understanding the dhcpd.conf file before I tackle iptables.

What has determined these addresses (default settings?) And what do they refer to? Is there an ip address in dhcpd.conf that reffers to my nic? 

subnet 192.168.0.0 netmask 255.255.255.0 {

# --- default gateway

option routers 192.168.0.1;
option subnet-mask 255.255.255.0;

range dynamic boot-p 192.168.0.128 192.168.0.254;

--------------------------------------------------------------------------
Does the "#" symbol merely #-out comments in files such as these?

I want to configure a fixed ip for the nic on the linux box (dell), if i do that 
with ifcfg do I also need to change / configure that in dhcpd.conf?

Where can I find easy to understand advice on using iptables *gulp*


----------



## Skie (Mar 15, 2003)

You can look at this link for info on setting up dhcpd: http://www.linuxhomenetworking.com/linux-hn/dchp.htm.

If anything is confusing to you, let me know.

Yes, the # means a comment. 

If you want to assign a specific IP address to a particular machine, use the following:



> host <computer name goes here> {
> hardware ethernet 08:00:2b:4c:59:23;
> fixed-address 192.168.1.222;
> }


The "hardware ethernet" is the MAC address of the machine. For linux, you can get this using the ifconfig command. 

As far as iptables, there really isn't a whole lot of easy to use tutorials. iptables itself is quite complicated and will take some time and understanding to work with. There are a few GUI based tools that you can use, but I don't know which ones off the top of my head. If you'd like, I'll take a look around.


----------



## XunilNewb (Jan 13, 2005)

*Thanks again!*

Again some great info! Thanks loads Skie, that clears a few things up. If anyone's interested I found some usefull iptables info @ http://www.faqs.org/docs/iptables/
:smile:


----------



## XunilNewb (Jan 13, 2005)

*ip mayhem (and what is next-server in dhcpd.conf?)*

when i run ifconfig -a i can see that my HW addr of my ethernet NIC is 00:01:02:E2:76:B5... Aha, so that is my MAC addr?

In order for the server to always appear at a fixed address (router/gateway addr) I need to map it with a host entry

eg

# set dhcp/name server to appear at fixed addr
host ns {
next-server ns1 _____________?
hardware ethernet 00:01:02:E2:76:B5
fixed address 10.0.0.1

Question: What is the "next-server"?

My other question is a more general ip allocation question.

The subnet mask 255.255.255.252 would yield 4 addresses (256-252=4). Does this meen 4 subnets? ie if the host portion of the ip address was 28 then there would be (28/4=7) 7 available addresses in each subnet? Is the ip address in this instance the same as the router/gateway addr ie the one that will be mapped to my NIC as above?

:4-dontkno


----------



## Skie (Mar 15, 2003)

I'm not familiar with the next-server option. I have a feeling it has something to do with DNS servers, but I've been unable to find an explination of that option. I didn't search extensively though. As far as the subnet mask, stick with 255.255.255.0, and you'll be fine. I don't think you need to narrow down the available IP's unless you specifically want to limit the number of available IP's.


----------



## XunilNewb (Jan 13, 2005)

*next-sever DNS*

Cheers Skie, I think you're right, it does have something to do with the allocation of a DNS server - I'll comment that crap out for now and just get the job done.

:smile:


----------



## Skie (Mar 15, 2003)

You can have your DHCP server set to provide the DNS info. This is what many do. So, unless you want to manually set this on each computer, I would use it. Without this info, your internet access will be severely limited.


----------

