LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Some questions on Setting up a Router/Gateway (https://www.linuxquestions.org/questions/linux-networking-3/some-questions-on-setting-up-a-router-gateway-367332/)

Riddick 09-26-2005 08:18 PM

Some questions on Setting up a Router/Gateway
 
Hi - I have a gateway with two ethernet cards.
I would one (eth0) to use DHCP to get the internet and its name servers etc,
and I would like the second one to run Samba, NFS and DHCP (for the
rest of the computers on the network).

I have not understood how to tell one interface eth0 to do DHCP and the other,
eth1 to be static at 192.168.0.1 - how do I do this! Can I run dhcpd with a rule to
configure itself???

After we have solved the static IP problem,
I would like to know, how do I get the machine to act as a gateway?

Thanks,
Riddick

win32sux 09-26-2005 08:41 PM

you can tell dhcpd to only listen on eth0 by specifying at runtime:
Code:

dhcpd eth0
the configuration for dhcpd is done in /etc/dhcpd.conf...

remember that:

DHCPD = dhcp daemon

DHCPCD = dhcp client daemon

DHCPD is what will serve IPs to your LAN... DHCPCD is what will request an IP for eth0 from your ISP's DHCP server...

as for the IPs, it's simple... configure eth0 to use DHCP (how you do this depends on your distro) and make eth1 have a static IP...
Code:

ifconfig eth1 inet 192.168.0.1 netmask 255.255.255.0
of course you should use your NIC's configuration file instead of running ifconfig directly, although the effect is the same if you don't reboot...

to make your box act as a gateway, you need to activate forwarding:
Code:

echo "1" > /proc/sys/net/ipv4/ip_forward
but you should really study iptables before you do any forwarding:

http://iptables-tutorial.frozentux.n...-tutorial.html

read-up on SNAT and MASQUERADE.... ;)

just my :twocents:...


Riddick 09-27-2005 05:24 PM

I like the 2cents! Excellent I got it working!
This is an excellent resource, even though I am running slackware:

http://www.aboutdebian.com/

Thanks for everything,
Riddick


All times are GMT -5. The time now is 06:38 PM.