LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   dnsmasq as dhcp server on eth0 and networkmanager (https://www.linuxquestions.org/questions/linux-networking-3/dnsmasq-as-dhcp-server-on-eth0-and-networkmanager-770305/)

R03L 11-19-2009 04:42 PM

[SOLVED] dnsmasq as dhcp server on eth0 and networkmanager [SOLVED]
 
i use fedora as a server and want it to use as router.
herefor i need dnsmasq to set up an dhcp server
and /etc/init.d/dnsmasq restart says OK.

my dnsmasq.conf looks like
Code:

domain-needed
bogus-priv
resolv-file=/etc/resolv.conf
dhcp-range=192.168.2.100,192.168.2.250,255.255.255.0,12h
dhcp-option=3,192.168.2.1
dhcp-option=15,dhcp.server.lan
#listen-address=192.168.2.1
interface=eth0
except-interface=wlan0
except-interface=wlan1
bind-interfaces

Code:

sudo /etc/init.d/dnsmasq restart
Starting dnsmasq  [  OK  ]

so far so good

it shoud act as a dhcp only my first question is that my dnsserver is at 192.168.1.1 does it get thisone from resolv.conf than i have it configured correctly for that.
i dont now how to forward thatone.
but

i still have NetworkManager running up eth0 and wlan for wlan connection

howto send out dhcp dnsmasq to eth0
eth0 is still listening to dhcp and it should send dhcp????
howto configure thisone?

thanks in advanced :)

bartonski 11-21-2009 09:20 AM

I'm not quite sure that I'm reading this correctly; let's start from the top:

I'm going to call the fedora box with dnsmasq running 'dhcp server'.
  • what interfaces are available on dhcp server?
  • what are the ip addresses on each interface?
  • what device has a connection to the internet?
  • what device is sharing network connections (router, switch, hub...)
  • what other computers do you have on your network?
  • what are their IP addresses?
  • Where were these machines getting IP address before you set up dnsmasq?
  • have you done a release/renew on their IP addresses since you installed dnsmasq?

If you can answer these, as well as any other special setup on your network, I'll be in a better position to help.

R03L 11-23-2009 04:43 AM

i have a fileserver wireless connected whit my dd-wrt router.
and i have my dekstop pc besides that.
i cannot have my fileserver below becouse the people living here dont allow that, yes i need to move from a room to a house but enough of that..

i have a wireless connection to my fileserver
and want a wired connection to my desktop from the fileserver.

now i have connection sharing enabled on the fileserver and that works but i want to use dnsmasq to do it.

from fileserver one router wireless,
one desktop pc 1000mb wired. need an ip adress from dhcpserver.

dhcpd or dnsmasq but my m8 said i best can use dnsmasq to do this.

now you see i have dnsmasq running.
but i don't get any ip adress from this,

like i said i still have eth0 1000mb wired at dhcp client, asking for dhcp from my desktop and i can use internet connection sharing to do this,
but i get a range of 10.42.43.* i want it to have a range of 192.168.2.*
and than my router dd-wrt gives me 192.168.1.*

bartonski 11-26-2009 06:56 PM

1 Attachment(s)
Quote:

Originally Posted by R03L (Post 3766526)
i have a fileserver wireless connected whit my dd-wrt router.
and i have my dekstop pc besides that.
i cannot have my fileserver below becouse the people living here dont allow that, yes i need to move from a room to a house but enough of that..

i have a wireless connection to my fileserver
and want a wired connection to my desktop from the fileserver.

now i have connection sharing enabled on the fileserver and that works but i want to use dnsmasq to do it.

from fileserver one router wireless,
one desktop pc 1000mb wired. need an ip adress from dhcpserver.

dhcpd or dnsmasq but my m8 said i best can use dnsmasq to do this.

now you see i have dnsmasq running.
but i don't get any ip adress from this,

like i said i still have eth0 1000mb wired at dhcp client, asking for dhcp from my desktop and i can use internet connection sharing to do this,
but i get a range of 10.42.43.* i want it to have a range of 192.168.2.*
and than my router dd-wrt gives me 192.168.1.*

[Note that R03L and I had a short conversation off line, who sent me a picture of his network configuration, which I've rendered as the attached PDF].

http://e1h13.simplecdn.net/lqcdn/ima...attach/pdf.gif

So... here's how I'm reading this:

  • Internet connection on DD-WRT, with LAN interface at 192.169.1.1
  • Wireless connection between DD-WRT and Computer 2 (Fedora 12 router/File server). Computer 2 wireless connection at 192.168.1.100
  • 1000mb ethernet connection between Computer 2 and Computer 1 (Desktop Fedora 12).
  • Computer 2 currently does connection sharing, it serves a 10.42.43.* address via dhcp.
  • The desire is to have connection sharing between Computer 2 and Computer 1 with the ethernet interface on Computer 2 at 192.168.2.1, and ethernet interface on Computer 1 at 192.168.2.100.

The wlan connection on Computer 2 seems to be correct.

Undo any firewall/routing settings that you have set up for connection sharing on Computer 2.

Set eth0 on Computer 2 with a static IP address of 192.168.2.1

Your dnsmasq.conf looks ok (it's actually configured better than mine).

Once you've set the static IP address on eth0, release and renew your IP address on Computer 1. It should get an IP address of 192.168.2.100.

After you have done this, you can set up IP Masquerading (which is what internet connection sharing is called under Linux/Unix). Instructions can be found here.

R03L 11-27-2009 09:29 AM

yes thanks already for responding :)

bartonski 11-27-2009 01:10 PM

R03L,

Take another look at my previous post, I added a lot more to it; I think that I may have found a solution.

p.s. where does the nickname 'R03L' come from? It sounds a bit like R2-D2 or C-3PO :D

R03L 11-30-2009 04:37 AM

Quote:

Originally Posted by bartonski (Post 3771675)
R03L,

Take another look at my previous post, I added a lot more to it; I think that I may have found a solution.

p.s. where does the nickname 'R03L' come from? It sounds a bit like R2-D2 or C-3PO :D


No My name is actualy Roel it's dutch ( frysian ) name.

just added some numbers to it :P

but verry thanks for helping me out,, i see wats mistaken.

i read verry mutch tutorials and have the LPI book besides me.

but the part of setting a static ip adress was missing from most tutorials. so i think that is wat im doing wrong. i should work on it today :)

R03L 11-30-2009 04:56 AM

Quote:

Originally Posted by R03L (Post 3774177)
ch tutorials and have the LPI book besides me.

but the part of setting a static ip adress was missing from most tutorials. so i think that is wat im doing wrong. i should work on it today :)

yes im getting an ip adress :D :D

Code:

eth0
ip adress : 192.168.2.123
broadcast adress : 192.168.2.255
subnet mask : 255.255.255.0
defaulth route: 192.168.2.1
dns : 192.168.2.1

Thanks Again :D

so far so good :D

R03L 11-30-2009 05:48 AM

when i ping www.google.nl or 192.168.1.1 @ my fileserver i get.

Code:

ping www.google.nl ( ping 192.168.1.1 )
PING www.l.google.com (74.125.79.99) 56(84) bytes of data.
From 192.168.2.1 icmp_seq=2 Destination Host Unreachable
From 192.168.2.1 icmp_seq=3 Destination Host Unreachable
From 192.168.2.1 icmp_seq=4 Destination Host Unreachable

what could this be.?


i think its my routing/firewall that still is blocking my connection..

also when i am browzing to www.google.nl i get this pagefaulth
Connection to server Refused

R03L 11-30-2009 07:17 AM

ok i now get a ping at 192.168.1.1 ( DD-WRT )
but still
Code:

ping www.google.nl
PING www.l.google.com (74.125.79.99) 56(84) bytes of data.
From 192.168.2.1 icmp_seq=2 Destination Host Unreachable
From 192.168.2.1 icmp_seq=3 Destination Host Unreachable
From 192.168.2.1 icmp_seq=4 Destination Host Unreachable


bartonski 11-30-2009 07:57 AM

Quote:

Originally Posted by R03L (Post 3774303)
ok i now get a ping at 192.168.1.1 ( DD-WRT )
but still
Code:

ping www.google.nl
PING www.l.google.com (74.125.79.99) 56(84) bytes of data.
From 192.168.2.1 icmp_seq=2 Destination Host Unreachable
From 192.168.2.1 icmp_seq=3 Destination Host Unreachable
From 192.168.2.1 icmp_seq=4 Destination Host Unreachable


Let's see... DNS is working, must be through dnsmasq. If you can ping to 192.168.1.1, you know that at least part of the routing is working on your server box. The first thing I would do is run

Code:

traceroute www.google.nl
from 192.168.2.100. That will tell you whether the packets headed to www.google.nl are failing at the DD-WRT or before.

I would also try running /sbin/route on both your server and DD-WRT. Read the results from top to bottom, the first route that matches is the path that the packets take.

bartonski 11-30-2009 08:18 AM

By the way, if you absolutely totally have to know every packet going in and out of your DD-WRT, you can use pcap to capture packets. Installation of libpcap is detailed here, about half way down the page. I'm not 100% sure how to get the pcap file from the DD-WRT to your server, but once you do, you can open the file in Wireshark and figure out exactly what's going where.

I would do this only as a last resort, because it's going to take some serious reading to get this correctly installed and get a file back to your server, and then it can be a lot of work filtering through all of those packets, but you'll definitely know what's going on (also, only do this if you have isolated the problem to the DD-WRT).

R03L 11-30-2009 08:22 AM

Code:

traceroute www.google.nl
traceroute to www.google.nl (74.125.79.104), 30 hops max, 60 byte packets
 1  192.168.2.1 (192.168.2.1)  0.181 ms  0.182 ms  0.260 ms
 2  192.168.2.1 (192.168.2.1)  2998.983 ms !H  2998.996 ms !H  2998.916 ms !H

on Desktop computer 1 i have a ping but half the time it also say destination host unreachable.
and no www.google.nl PAGE is coming up The requested URL could not be retrieved
maybe im on QOS.
becouse the house im living in a room at. also has a router outside the house my DD-WRT router is hooked to...

its 10.0.0.138 (DHCP)

i added some lines to DNSMASQ.
Code:

server=192.168.1.1 (DD-WRT)
server=194.109.6.66 (XS4ALL DNS server 1)
server=194.109.9.99 (XS4ALL DNS Server 2)
server=10.0.0.138 (DHCP / ROUTER whit at least 100 connections FIRM router)


R03L 11-30-2009 08:26 AM

DESKTOP PING
Code:

[roel@vlip ~]$ ping www.google.nl
PING www.l.google.com (74.125.79.104) 56(84) bytes of data.
From 192.168.2.1: icmp_seq=1 Redirect Host(New nexthop: ey-in-f104.1e100.net (74.125.79.104))
From 192.168.2.1: icmp_seq=2 Redirect Host(New nexthop: ey-in-f104.1e100.net (74.125.79.104))
From 192.168.2.1: icmp_seq=3 Redirect Host(New nexthop: ey-in-f104.1e100.net (74.125.79.104))
From 192.168.2.1 icmp_seq=1 Destination Host Unreachable
From 192.168.2.1 icmp_seq=2 Destination Host Unreachable
From 192.168.2.1 icmp_seq=3 Destination Host Unreachable
From 192.168.2.1: icmp_seq=4 Redirect Host(New nexthop: ey-in-f104.1e100.net (74.125.79.104))
From 192.168.2.1: icmp_seq=5 Redirect Host(New nexthop: ey-in-f104.1e100.net (74.125.79.104))
From 192.168.2.1: icmp_seq=6 Redirect Host(New nexthop: ey-in-f104.1e100.net (74.125.79.104))
From 192.168.2.1 icmp_seq=4 Destination Host Unreachable
From 192.168.2.1 icmp_seq=5 Destination Host Unreachable
From 192.168.2.1 icmp_seq=6 Destination Host Unreachable
From 192.168.2.1: icmp_seq=8 Redirect Host(New nexthop: ey-in-f104.1e100.net (74.125.79.104))
^C
--- www.l.google.com ping statistics ---
8 packets transmitted, 0 received, +6 errors, 100% packet loss, time 7459ms
pipe 4

SERVER PING
Code:

[server@server ~]$ ping www.google.nl
PING www.l.google.com (74.125.79.99) 56(84) bytes of data.
From 192.168.2.1 icmp_seq=2 Destination Host Unreachable
From 192.168.2.1 icmp_seq=3 Destination Host Unreachable
From 192.168.2.1 icmp_seq=4 Destination Host Unreachable
From 192.168.2.1 icmp_seq=6 Destination Host Unreachable
From 192.168.2.1 icmp_seq=7 Destination Host Unreachable
From 192.168.2.1 icmp_seq=8 Destination Host Unreachable
^C
--- www.l.google.com ping statistics ---
9 packets transmitted, 0 received, +6 errors, 100% packet loss, time 8140ms
pipe 3


bartonski 11-30-2009 08:47 AM

Quote:

Originally Posted by R03L (Post 3774373)
DESKTOP PING
Code:

[roel@vlip ~]$ ping www.google.nl
PING www.l.google.com (74.125.79.104) 56(84) bytes of data.
From 192.168.2.1: icmp_seq=1 Redirect Host(New nexthop: ey-in-f104.1e100.net (74.125.79.104))
From 192.168.2.1: icmp_seq=2 Redirect Host(New nexthop: ey-in-f104.1e100.net (74.125.79.104))
From 192.168.2.1: icmp_seq=3 Redirect Host(New nexthop: ey-in-f104.1e100.net (74.125.79.104))
From 192.168.2.1 icmp_seq=1 Destination Host Unreachable
From 192.168.2.1 icmp_seq=2 Destination Host Unreachable
From 192.168.2.1 icmp_seq=3 Destination Host Unreachable
From 192.168.2.1: icmp_seq=4 Redirect Host(New nexthop: ey-in-f104.1e100.net (74.125.79.104))
From 192.168.2.1: icmp_seq=5 Redirect Host(New nexthop: ey-in-f104.1e100.net (74.125.79.104))
From 192.168.2.1: icmp_seq=6 Redirect Host(New nexthop: ey-in-f104.1e100.net (74.125.79.104))
From 192.168.2.1 icmp_seq=4 Destination Host Unreachable
From 192.168.2.1 icmp_seq=5 Destination Host Unreachable
From 192.168.2.1 icmp_seq=6 Destination Host Unreachable
From 192.168.2.1: icmp_seq=8 Redirect Host(New nexthop: ey-in-f104.1e100.net (74.125.79.104))
^C
--- www.l.google.com ping statistics ---
8 packets transmitted, 0 received, +6 errors, 100% packet loss, time 7459ms
pipe 4

SERVER PING
Code:

[server@server ~]$ ping www.google.nl
PING www.l.google.com (74.125.79.99) 56(84) bytes of data.
From 192.168.2.1 icmp_seq=2 Destination Host Unreachable
From 192.168.2.1 icmp_seq=3 Destination Host Unreachable
From 192.168.2.1 icmp_seq=4 Destination Host Unreachable
From 192.168.2.1 icmp_seq=6 Destination Host Unreachable
From 192.168.2.1 icmp_seq=7 Destination Host Unreachable
From 192.168.2.1 icmp_seq=8 Destination Host Unreachable
^C
--- www.l.google.com ping statistics ---
9 packets transmitted, 0 received, +6 errors, 100% packet loss, time 8140ms
pipe 3


Yeah... there's something messed up here. When pinging from your server, packets should be headed through the wlan interface... you should be pinging from 192.168.1.100, not 192.168.2.1. This does suggest a routing error. I'm late for work (too much time spent answering questions on LQ ;)). I would definitely run /sbin/route on your server, and figure out what's going where. I'll be able to look at the results this evening (~8pm US Eastern Standard Time).


All times are GMT -5. The time now is 08:57 AM.