# [SOLVED] Gentoo Routes as Gateway / DHCP Server?

## Crimjob

Hey Guys,

I just recently commissioned an old piece of Sun hardware to be my linux "router". I've got the OS up and running, and I appear to have networking working, but I'm coming across some weird issues I didn't have on my old setup.

In my old setup, I had no default gw or static routes in /etc/conf.d/net. For some reason, with this new setup, that no longer stands. The machines on the network get an IP, and if I manually force a gateway or static route, the work fine, but they aren't automatically getting their default gateway anymore.

Google lead me to two things. Changing /etc/dhcp/dhcpd.conf to put in the default gw, which resulted in no change to my operation.

Next was changing /etc/init.d/net to have routes_eth1=( "default via 192.168.0.1" ). This completely breaks my system, it's as if the name resolution just fly's off and never comes back, even if I keep the same addresses in resolve.conf. I'm out of luck until I comment the config line out, and restart the machine (restarting the interface after commenting seems to have no effect).

Now I'm still learning here but I'm thinking I'm just doing something wrong. Anyone have any ideas?

My setup is as follows ( Internet <-> Gentoo "Router" <-> switches and other computers ) so I'm using dhcpd, ip_forward, and iptables, and I can't figure it out for some reason. I've been trying trial and error (note the comments in my config below), but haven't been getting very far.

```

# This blank configuration will automatically use DHCP for any net.*

# scripts in /etc/init.d.  To create a more complete configuration,

# please review /etc/conf.d/net.example and save your configuration

# in /etc/conf.d/net (this file :]!).

# WAN

config_eth0=( "dhcp" )

#fallback_eth0=( "dhcp" )

mtu_eth0="1500"

# DNS Stuff

dns_domain_lo="brokencouch.org"

#dns_domain_eth0="brokencouch.org"

dns_domain_eth1="phub.net.cable.rogers.com"

#dns_domain_eth1="brokencouch.org"

# LAN

config_eth1=( "192.168.0.1 broadcast 192.168.0.255 netmask 255.255.254.0" )

dns_servers_eth1=( "64.71.255.198 8.8.8.8 8.8.4.4" )

#routes_eth1=( "default via 192.168.0.1" )

```

----------

## malern

It does sound like a dhcpd issue seeing as manually specifying a gateway on your other machines fixes it. Could you post the contents of /etc/dhcp/dhcpd.conf ?

----------

## Crimjob

```

# dhcpd.conf

# option definitions common to all supported networks...

option domain-name "brokencouch.org";

option domain-name-servers 8.8.8.8, 8.8.4.4, 4.4.4.4, 4.4.2.2;

option time-servers 192.168.0.1;

option subnet-mask 255.255.255.0;

option host-name "Dominator";

allow client-updates;

ddns-updates on;

default-lease-time 60000;

max-lease-time 720000;

# Use this to enble / disable dynamic dns updates globally.

ddns-update-style ad-hoc;

# If this DHCP server is the official DHCP server for the local

# network, the authoritative directive should be uncommented.

authoritative;

# Use this to send dhcp log messages to a different log file (you also

# have to hack syslog.conf to complete the redirection).

log-facility local7;

# No service will be given on this subnet, but declaring it helps the

# DHCP server to understand the network topology.

subnet 192.168.0.0 netmask 255.255.254.0 {

        authoritative;

        allow client-updates;

        # Servers

        group {

                # Windows 2008 Server

                host Spitfire {

                        hardware ethernet 00:11:d8:2f:10:73;

                        server-name "Spitfire.brokencouch.org";

                        fixed-address 192.168.0.2;

                        }

                # Aurora Gentoo Linux

                host Aurora {

                        hardware ethernet e0:cb:4e:cf:4a:b5;

                        fixed-address 192.168.0.3;

                        }

                # Windows Home Server

                host Marauder {

                        hardware ethernet 00:26:2d:03:54:18;

                        fixed-address 192.168.0.4;

                        }

                }

        # Workstations

        group {

                # Windows 7 Ultimate Workstation

                host Liberator {

                        hardware ethernet 00:1f:c6:73:a9:66;

                        fixed-address 192.168.0.11;

                        }

                # Windows 7 Ultimate Workstation

                host Hellcat {

                        hardware ethernet 90:e6:ba:f4:56:64;

                        fixed-address 192.168.0.12;

                        }

                # Windows XP / Gentoo Linux Netbook

                host Genspire {

                        hardware ethernet 00:26:9e:11:d6:7c;

                        fixed-address 192.168.0.13;

                        }

                # Windows 7 Ultimate Asus Laptop

                host Durptop {

                        hardware ethernet 1c:4b:d6:a5:29:95;

                        fixed-address 192.168.0.14;

                        }

                # Windows 7 Ultimate Workstation - Basement

                host Antec {

                        hardware ethernet 00:16:76:e5:14:a6;

                        }

                }

        # Consoles

        group {

                # Xbox 360

                host Sexbox360 {

                        hardware ethernet 00:17:fa:bc:29:11;

                        fixed-address 192.168.0.100;

                        }

                # PS3

                host PS3 {

                        hardware ethernet 00:24:8d:3c:24:09;

                        fixed-address 192.168.0.101;

                        }

                }

        range 192.168.0.20 192.168.0.99;

        # Non-Cisco Network Gear

        group {

                # TL-WA901N AP

                host AP1 {

                        hardware ethernet d8:5d:4c:af:7d:7a;

                        fixed-address 192.168.1.254;

                        }

                }

        }

```

Looking at those together now makes me realize there might be an issue with the fact the name server addresses are slightly different in both files, but I can't imagine that's causing my problem  :Sad: 

----------

## malern

You don't seem to be specifying your gateway anywhere in your dhcpd.conf. You probably need to add something like

```
option routers 192.168.0.1;
```

----------

## Crimjob

Wow, that fixed it right up, spot on! Thank you so much!

----------

