Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
home router: DHCP doesn't work and LAN adapter fubars DNS
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
blackdragonblood
n00b
n00b


Joined: 23 Apr 2006
Posts: 73

PostPosted: Sun Jul 23, 2006 4:15 pm    Post subject: home router: DHCP doesn't work and LAN adapter fubars DNS Reply with quote

I'm setting up a home router. I have two issues right now.

1. Client times out waiting for DHCP
2. net.eth1 (LAN adapter) fubars DNS resolution on the router. I can't emerge --sync or pull up any webpages. I can stop eth1 and restart eth2 to get networking.

log:
Quote:

Jul 23 10:22:16 [dhcpd] Internet Systems Consortium DHCP Server V3.0.3-Gentoo-r9
Jul 23 10:22:16 [dhcpd] Copyright 2004-2005 Internet Systems Consortium.
Jul 23 10:22:16 [dhcpd] All rights reserved.
Jul 23 10:22:16 [dhcpd] For info, please visit http://www.isc.org/sw/dhcp/
Jul 23 10:22:16 [dhcpd] Wrote 0 deleted host decls to leases file.
Jul 23 10:22:16 [dhcpd] Wrote 0 new dynamic host decls to leases file.
Jul 23 10:22:16 [dhcpd] Wrote 0 leases to leases file.
Jul 23 10:22:16 [dhcpd] Multiple interfaces match the same subnet: eth1 eth2
Jul 23 10:22:16 [dhcpd] Multiple interfaces match the same shared network: eth1 eth2


/etc/dhcp/dhcpd.conf
Code:
default-lease-time 3600;
max-lease-time 7200;
authorative;
log-facility local7;
ddns-update-style ad-hoc;

subnet 192.168.0.0 netmask 255.255.255.0 {
        range 192.168.0.100 192.168.0.250;

        option subnet-mask 255.255.255.0;
        option netbios-name-servers 192.168.0.1;
        option broadcast-address 192.168.0.255;
        option routers 192.168.0.1;
        option domain-name-servers 192.168.0.1;

        host blackwidow
        {
                hardware ethernet 00:xx:xx:xx:xx:xx;
                fixed-address 192.168.0.2;
        }

        host soulcage
        {
                hardware ethernet 00:11:xx:xx:xx:xx;
                fixed-address 192.168.0.3;
        }
}


How can I resolve these two issues? I just want a subnet declaration for eth1, not both devices. Eth2 should be getting dhcp leases from my existing d-link.

FYI:
Quote:

eth0=dead NIC
eth1=LAN
eth2=WAN
Back to top
View user's profile Send private message
thunder
Retired Dev
Retired Dev


Joined: 01 Sep 2003
Posts: 164
Location: Wroclaw, PL

PostPosted: Sun Jul 23, 2006 7:19 pm    Post subject: Reply with quote

i think you dont wan to broadcast dhcp on WAN interface so put eth1 in /etc/conf.d/
_________________
Damian Florczyk
Gentoo/NetBSD development lead
Back to top
View user's profile Send private message
blackdragonblood
n00b
n00b


Joined: 23 Apr 2006
Posts: 73

PostPosted: Sun Jul 23, 2006 8:05 pm    Post subject: Reply with quote

Thx for the reply. I tried setting up /etc/conf.d/net.eth1 and I still can't get it to work. Do I have something set up wrong for eth1?

Here is the relavent section of /etc/conf.d/net.eth1:
Code:
##############################################################################
# INTERFACE HANDLERS
#
# We provide two interface handlers presently: ifconfig and iproute2.
# You need one of these to do any kind of network configuration.
# For ifconfig support, emerge sys-apps/net-tools
# For iproute2 support, emerge sys-apps/iproute2

# If you don't specify an interface then we prefer ifconfig if it's installed
# Prefer iproute2 over ifconfig
#modules=( "iproute2" )

# For a static configuration, use something like this
# (They all do exactly the same thing btw)
#config_eth0=( "192.168.0.2/24" )
#config_eth1=( "192.168.0.1 netmask 255.255.255.0" )

# We can also specify a broadcast
#config_eth0=( "192.168.0.2/24 brd 192.168.0.255" )
config_eth1=( "192.168.0.1 netmask 255.255.255.0 broadcast 192.168.0.255" )

# If you need more than one address, you can use something like this
# NOTE: ifconfig creates an aliased device for each extra IPv4 address
#       (eth0:1, eth0:2, etc)
#       iproute2 does not do this
#config_eth0=(
#       "192.168.0.2/24"
#       "192.168.0.3/24"
#       "192.168.0.4/24"
#)

# You can also use IPv6 addresses
#config_eth0=(
#       "192.168.0.2/24"
#       "4321:0:1:2:3:4:567:89ab"
#       "4321:0:1:2:3:4:567:89ac"
#)

# If you wish to keep existing addresses + routing and the interface is up,
# you can specify a noop (no operation). If the interface is down or there
# are no addresses assigned, then we move onto the next step (default dhcp)
# This is useful when configuring your interface with a kernel command line
# or similar
#config_eth0=( "noop" "192.168.0.2/24" )

# If you don't want ANY address (only useful when calling for advanced stuff)
#config_eth0=( "null" )

# Here's how todo routing if you need it - the below sets the default gateway
#routes_eth0=(
#       "default via 192.168.0.1"
#       "default via 4321:0:1:2:3:4:567:89ab"
#)

# If a specified module fails (like dhcp - see below), you can specify a
# fallback like so
#fallback_eth0=( "192.168.0.2 netmask 255.255.255.0" )
#fallback_route_eth0=( "default via 192.168.0.1" )

# NOTE: fallback entry must match the entry location in config_eth0
# As such you can only have one fallback route.
Back to top
View user's profile Send private message
thunder
Retired Dev
Retired Dev


Joined: 01 Sep 2003
Posts: 164
Location: Wroclaw, PL

PostPosted: Mon Jul 24, 2006 2:27 pm    Post subject: Reply with quote

well, you dont have any NIC configured :) please read gentoo manual at:
http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=4
_________________
Damian Florczyk
Gentoo/NetBSD development lead
Back to top
View user's profile Send private message
blackdragonblood
n00b
n00b


Joined: 23 Apr 2006
Posts: 73

PostPosted: Mon Jul 24, 2006 11:56 pm    Post subject: Reply with quote

Maybe I should have mentioned this sooner. I have eth2 configured. It use to be eth1 when I first set up this box. Then I desided to make it a router and added a second NIC. (not counting the onboard eth0 that's dead.) What was previously eth1 is now eth2 and what is now eth1 I would like to serve dhcp to my lan. Sorry for the confusion. I just want dhcpd to listen on eth1.

I did some tweeking. /etc/dhcp/dhcp.conf:
Code:
# dhcpd.conf
#
# Sample configuration file for ISC dhcpd
#

# option definitions common to all supported networks...
#option domain-name "example.org";
#option domain-name-servers ns1.example.org, ns2.example.org;

#default-lease-time 600;
#max-lease-time 7200;

# 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 10.152.187.0 netmask 255.255.255.0 {
#}

# This is a very basic subnet declaration.

#subnet 10.254.239.0 netmask 255.255.255.224 {
#  range 10.254.239.10 10.254.239.20;
#  option routers rtr-239-0-1.example.org, rtr-239-0-2.example.org;
#}

# This declaration allows BOOTP clients to get dynamic addresses,
# which we don't really recommend.

#subnet 10.254.239.32 netmask 255.255.255.224 {
#  range dynamic-bootp 10.254.239.40 10.254.239.60;
#  option broadcast-address 10.254.239.31;
#  option routers rtr-239-32-1.example.org;
#}

ddns-update-style ad-hoc;

# A slightly different configuration for an internal subnet.
subnet 192.168.0.0 netmask 255.255.255.0 {
  range 192.168.0.100 192.168.0.150;
  option domain-name-servers 172.17.1.14, 172.17.1.15;
#  option domain-name "internal.example.org";
  option routers 192.168.0.1;
  option broadcast-address 192.168.0.255;
  default-lease-time 600;
  max-lease-time 7200;
}

# Hosts which require special configuration options can be listed in
# host statements.   If no address is specified, the address will be
# allocated dynamically (if possible), but the host-specific information
# will still come from the host declaration.

#host passacaglia {
#  hardware ethernet 0:0:c0:5d:bd:95;
#  filename "vmunix.passacaglia";
#  server-name "toccata.fugue.com";
#}

# Fixed IP addresses can also be specified for hosts.   These addresses
# should not also be listed as being available for dynamic assignment.
# Hosts for which fixed IP addresses have been specified can boot using
# BOOTP or DHCP.   Hosts for which no fixed address is specified can only
# be booted with DHCP, unless there is an address range on the subnet
# to which a BOOTP client is connected which has the dynamic-bootp flag
# set.
host blackwidow {
  hardware ethernet 00:xx:xx:xx:xx:xx;
  fixed-address 192.168.0.2;
}

host soulcage {
  hardware ethernet 00:xx:xx:xx:xx:xx;
  fixed-address 192.168.0.3;
}


EDIT: added more info
Back to top
View user's profile Send private message
Zi7
n00b
n00b


Joined: 23 Jul 2006
Posts: 43
Location: Provence

PostPosted: Tue Jul 25, 2006 3:23 am    Post subject: Reply with quote

Here is your problem:
Code:
Jul 23 10:22:16 [dhcpd] Multiple interfaces match the same subnet: eth1 eth2
Jul 23 10:22:16 [dhcpd] Multiple interfaces match the same shared network: eth1 eth2

Basically it means that (whatever you're using to setup your network config on eth1/eth2) you're setting both interface to be on the same subnet: 192.168.0/24 from what i see.

It seems to me you're a little bit confused about what you're trying to do from a networking point of view.
Either you want both interface to be on the same network, in which case you'll have to work out proper netmasks for the eth1 and eth2 parts.
Or you want to make another network on eth2, in which case you can keep your 255.255.255.0 netmasks but you have to change one network part (192.168.0) and use NAT to make both networks communicate.

Can you be a little more specific?
Back to top
View user's profile Send private message
blackdragonblood
n00b
n00b


Joined: 23 Apr 2006
Posts: 73

PostPosted: Tue Jul 25, 2006 1:01 pm    Post subject: Reply with quote

This is my first time attemping this and it is true that I am confused. I would like eth2 to get a dhcp lease from my ISP or, currently my d-link, and I want eth1 to serve dhcp to my LAN. I also want the router to use NAT to hide my LAN. Eventually, I also want the router to have a wireless card so that it can completely replace my d-link, but I will wait with the wireless and work with just ethernet to keep things simple. Is there anything else I can clarify?

eth2=dhcp lease from ISP/d-link
eth1=serve dhcp to LAN

I appreciate the help.
Back to top
View user's profile Send private message
Zi7
n00b
n00b


Joined: 23 Jul 2006
Posts: 43
Location: Provence

PostPosted: Tue Jul 25, 2006 2:06 pm    Post subject: Reply with quote

All right, i think i get it now. :)

So, what you need to do is:
  • Have two different networks, one for eth1 (LAN) and one for eth2 (WAN). That means two different network address (192.168.0 and 192.168.1 for example).
  • Put on NAT on your box, masquerading everything that goes out on eth2.
  • Install a DNS server on your box to resolve domain names for your LAN (if your ISP DNS servers are not static)
  • Configure dhcpd to serve leases on eth1 for your LAN boxes

I'll assume from your previous posts you want your LAN (eth1) to be 192.168.0, so your /etc/conf.d/net should go:
Code:
config_eth1=( "192.168.0.1/24 brd 192.168.0.255" )
config_eth2=( "dhcp" )

Then, restart your 2 network devices (/etc/init.d/... restart) and check out their config (ifconfig). They should show 2 different network address. If not, change your Dlink config (or your eth1 config) to have so.
You should be able to ping the outside world from your box.

Now you want to start NAT.
If you don't have any iptables rules yet, just issue:
Code:
iptables -t nat -A POSTROUTING -o eth2 -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward

Your box is now able to forward IP packets from your LAN to the internet, back and forth.

DNS and DHCP configs depend on what packages you chose.
You might consider using dnsmasq which does both.

Hope this helps :p
Back to top
View user's profile Send private message
blackdragonblood
n00b
n00b


Joined: 23 Apr 2006
Posts: 73

PostPosted: Tue Jul 25, 2006 11:30 pm    Post subject: Reply with quote

That post is a tremendous help. I decided to use dnsmasq. I stepped through the config file and I still don't get and dns resolution when eth1 is up.

log:
Quote:
Jul 25 18:18:36 [dnsmasq] started, version 2.31 cachesize 150
Jul 25 18:18:36 [dnsmasq] compile time options: IPv6 GNU-getopt no-ISC-leasefile no-DBus no-I18N
Jul 25 18:18:36 [dnsmasq] DHCP, IP range 192.168.0.2 -- 192.168.0.100, lease time 1h
Jul 25 18:18:36 [dnsmasq] reading /etc/resolv.conf
Jul 25 18:18:36 [dnsmasq] using nameserver 172.17.1.15#53
Jul 25 18:18:36 [dnsmasq] using nameserver 172.17.1.14#53
Jul 25 18:18:36 [dnsmasq] ignoring nameserver 192.168.0.1 - local interface
Jul 25 18:18:36 [dnsmasq] read /etc/hosts - 4 addresses


How do I set up DNS using dnsmasq? According the docs it should work auto-magiclly. :(
Back to top
View user's profile Send private message
Zi7
n00b
n00b


Joined: 23 Jul 2006
Posts: 43
Location: Provence

PostPosted: Tue Jul 25, 2006 11:57 pm    Post subject: Reply with quote

I don't use dnsmasq, so i don't know much about it, but from what i read in your logs it looks good.
By the way, i've just stumbled upon this gentoo home routeur guide which is exactly what you're trying to do. It includes a minimal - though functional - dsnmasq config file.

Even if you don't have DNS resolution working, can the boxes on your LAN ping internet IP addresses:
Code:
ping 72.14.207.99
(fyi: google.com)
Back to top
View user's profile Send private message
blackdragonblood
n00b
n00b


Joined: 23 Apr 2006
Posts: 73

PostPosted: Wed Jul 26, 2006 12:47 am    Post subject: Reply with quote

I used that guide first. When I was having problems I also consaulted the gentoo wiki guilde on home routers. I restarted eth1, eth2, and dnsmasq. My clients on the LAN still don't get any dhcp leases. :cry: To make things worse a new error popped up. :cry:

Quote:
* Stopping eth2
* Bringing down eth2
* Stopping dhcpcd on eth2 ... [ ok ]
* Shutting down eth2 ... [ ok ]
* Starting eth2
* Bringing up eth2
* dhcp
* Running dhcpcd ...
Error, dhcpConfig: ioctl SIOCADDRT: Network is unreachable
* eth2 received address 192.168.0.6 [ ok ]


I didn't think setting up a router would be this challenging for me. Would it be possible that something like mDNSResponder would be interfering? I haven't stripped the GUI off of this box yet. I of cousre was going to do that before it went into production. It was my first gentoo box. (I am now up to two.)
Back to top
View user's profile Send private message
Zi7
n00b
n00b


Joined: 23 Jul 2006
Posts: 43
Location: Provence

PostPosted: Wed Jul 26, 2006 1:25 am    Post subject: Reply with quote

blackdragonblood wrote:
* Running dhcpcd ...
Error, dhcpConfig: ioctl SIOCADDRT: Network is unreachable
* eth2 received address 192.168.0.6 [ ok ]

Now you're back into your first problem: you WAN NIC (eth2) is given a network address that's the same as your LAN NIC's (eth1) : 192.168.0
It won't work unless you make sure each NIC has its own network address.

Didn't you change you're Dlink config so that it gives you a lease on a 192.168.1 network?
If you don't want to do that, change the eth1 config in /etc/conf.d/net to:
Code:
config_eth1=( "192.168.1.1/24 brd 192.168.1.255" )


Edit: Made a typo on an IP


Last edited by Zi7 on Wed Jul 26, 2006 11:30 am; edited 1 time in total
Back to top
View user's profile Send private message
blackdragonblood
n00b
n00b


Joined: 23 Apr 2006
Posts: 73

PostPosted: Wed Jul 26, 2006 2:56 am    Post subject: Reply with quote

So, let me get this stright. I can't hand out 192.168.0.0/24 if I'm already on that network? (Forgive me if that seems obvious.)
Back to top
View user's profile Send private message
Zi7
n00b
n00b


Joined: 23 Jul 2006
Posts: 43
Location: Provence

PostPosted: Wed Jul 26, 2006 11:37 am    Post subject: Reply with quote

8O
Zi7 wrote:
  • Have two different networks, one for eth1 (LAN) and one for eth2 (WAN). That means two different network address (192.168.0 and 192.168.1 for example)

We've been through this already...
What's the point of doing NAT (Network Address Translation) if both of your NICs are on the same network? Why would you translate english to english?

I suggest you read a bit about what is a network, a network address/mask, a subnet, NAT.
Cause here it's like you wanted a car, not a motorbike, yet a car with 2 wheels. ;)
Back to top
View user's profile Send private message
blackdragonblood
n00b
n00b


Joined: 23 Apr 2006
Posts: 73

PostPosted: Thu Jul 27, 2006 2:01 am    Post subject: Reply with quote

I agree. I will be reading more docs before I attempt this again. Thx for your help.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum