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-30-2009 10:25 AM

ok i now got the ping req. at 192.168.2.100 but still same ping messages. destination host unreachable.

it should ping from wlan0 not eth0 so i think it should ping @ 192.168.1.102

R03L 11-30-2009 02:59 PM

i did
Code:

iptables -F
iptables -t nat -F
iptables -t mangle -F
iptables -X
iptables -t nat -X
iptables -t mangle -X

afther that
Code:

service iptables save
service iptables restart

to flush ip tables.
also i disabled the firewall creator that was inplamented by fedora 12

now all rules and chains will clear !

afther that i did
Code:

iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
service iptables save
service iptables restart

so it should masquerade wlan0 as an internet connection

but still afther reboot i get the same ping req.
Quote:

DESKTOP PING
Code:

[roel@vlip ~]$ ping www.google.nl
Code:

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

Today 03:22 PM
R03L       
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



bartonski 11-30-2009 11:31 PM

I think that you have the hoses hooked up right, but you're pumping the water the wrong direction.

Look at it this way: Iptables enables packets sent from wlan0 to be sent to eth0 or vise versa. It also alters the packets as necessary so that packets sent from wlan0 through eth0 are well formed... but Iptables has no idea which way the internet is located. It's just connecting this pipe to that pipe, and saying 'I"m acting like a router' or 'I'm acting like a switch'. There's absolutely no logic inherent in iptables that says packets headed for the internet need to be sent through wlan0.

That logic lives in the routing tables. In order to print out the routing tables on your server, run the following command:

Code:

/sbin/route
and paste the results.

R03L 12-01-2009 03:47 AM

Code:

/sbin/route:
Kernel IP routing table
Destination    Gateway        Genmask        Flags Metric Ref    Use Iface
192.168.1.1    *              255.255.255.255 UH    0      0        0 eth0
192.168.2.0    *              255.255.255.0  U    1      0        0 eth0
192.168.1.0    *              255.255.255.0  U    2      0        0 wlan0
default        192.168.1.1    0.0.0.0        UG    0      0        0 eth0

when i disconnect eth0 its going nice and correctly through wlan0 :) but it should :) as only connection on the box.

bartonski 12-01-2009 10:21 PM

Quote:

Originally Posted by R03L (Post 3775452)
Code:

/sbin/route:
Kernel IP routing table
Destination    Gateway        Genmask        Flags Metric Ref    Use Iface
192.168.1.1    *              255.255.255.255 UH    0      0        0 eth0
192.168.2.0    *              255.255.255.0  U    1      0        0 eth0
192.168.1.0    *              255.255.255.0  U    2      0        0 wlan0
default        192.168.1.1    0.0.0.0        UG    0      0        0 eth0

when i disconnect eth0 its going nice and correctly through wlan0 :) but it should :) as only connection on the box.

Yeah... that's definitely not right. Your default route is through 192.168.1.1, but it's trying to send that through eth0, even though the 192.168.1.0 subnet is through wlan0. I'm not quite sure how to fix that yet.

bartonski 12-01-2009 10:56 PM

Quote:

Originally Posted by R03L (Post 3775452)
Code:

/sbin/route:
Kernel IP routing table
Destination    Gateway        Genmask        Flags Metric Ref    Use Iface
192.168.1.1    *              255.255.255.255 UH    0      0        0 eth0
192.168.2.0    *              255.255.255.0  U    1      0        0 eth0
192.168.1.0    *              255.255.255.0  U    2      0        0 wlan0
default        192.168.1.1    0.0.0.0        UG    0      0        0 eth0

when i disconnect eth0 its going nice and correctly through wlan0 :) but it should :) as only connection on the box.

Ok, I've just been reading through the man pages for route here's what I'm thinking:

First, delete the routes to 192.168.1.1; these are going through the wrong interface.

Code:

route del -host 192.168.1.1
route del default gw 192.168.1.1

Then add them back, correctly:

Code:

route add -host 192.168.1.1 netmask 255.255.255.255 dev wlan0
route add dfault gw 192.168.1.1 netmask 0.0.0.0 dev wlan0

I'm not sure that the first of these two lines is necessary, 192.168.1.1 is in the 192.168.1.0 subnet, and should be routed via

Code:

192.168.1.0    *              255.255.255.0  U    2      0        0 wlan0
Would someone else in the Linux-Networking forum care to check my math here? I don't go changing routing tables on a regular basis. R03L is pretty liberal with the 'thank you button', so it's worth your time :D

Quote:

Originally Posted by bartonski (Post 3770832)
Click on the reference to this quote, it will take you back to the post where I attached a PDF of the network configuration


R03L 12-02-2009 04:39 AM

[solved]
 
Quote:

route add -host 192.168.1.1 netmask 255.255.255.255 dev wlan0
Code:

route: netmask  doesnt make sense whit host route
instead i did
Code:

route add -host 192.168.1.1 dev wlan0
route add default gw 192.168.1.1 netmask 0.0.0.0 dev wlan0

and i think this worked perfectly

Thanks for helping me out whit this... [SOLVED]

ONLY one thing.. how do i set this perminantly?
Fedora 12

((afther i reboot NetworkManager i need to set route again.
also if i reconnect wlan0 i need to set route again!!))

R03L 12-02-2009 06:35 AM

Quote:

ONLY one thing.. how do i set this perminantly?
Fedora 12

((afther i reboot NetworkManager i need to set route again.
also if i reconnect wlan0 i need to set route again!!))
ok i dit set these rules below inside:
Code:

/etc/rc.d/rc.local

Code:

route add -host 192.168.1.1 dev wlan0
route add default gw 192.168.1.1 netmask 0.0.0.0 dev wlan0

but its a temporaroly solution,
i read on this forum when the init scripts get updated rc.local will be cleared?

also when i disconnect from wlan0 i need to reboot for rc.local to be read again.

bartonski 12-02-2009 07:37 AM

Quote:

Originally Posted by R03L (Post 3776978)
ok i dit set these rules below inside:
Code:

/etc/rc.d/rc.local
Code:

route add -host 192.168.1.1 dev wlan0
route add default gw 192.168.1.1 netmask 0.0.0.0 dev wlan0

but its a temporaroly solution,
i read on this forum when the init scripts get updated rc.local will be cleared?

also when i disconnect from wlan0 i need to reboot for rc.local to be read again.

I think that I would poke around inside network manager and see if there's a check-box or something that says "this is my route to the internet" or something. I'm just guessing,.. if there's not, this is a bug in network manager.

Thanks for working with the route stuff, that was uncharted territory for me... I know how it works on a theoretical level, but I've never had the need or opportunity to actually change the routing. (The one time I did, I was very very new to networking and ended up routing packets back to the network that they came from, doubling the network load... someone else had to trouble shoot that one for me).

Where did you find the info about setting routes in rc.local?

R03L 12-02-2009 08:50 AM

here s the post
http://www.linuxquestions.org/questi...c-route-16769/

R03L 12-02-2009 10:06 AM

Quote:

I think that I would poke around inside network manager and see if there's a check-box or something that says "this is my route to the internet" or something. I'm just guessing,.. if there's not, this is a bug in network manager.
There is no check-box inside fedora core 12 NetworkManager say "this is my route to the internet" ;)

if there was it made life much easyer

bartonski 12-02-2009 12:01 PM

Quote:

Originally Posted by R03L (Post 3777122)

Further on from the same thread:

Quote:

Originally Posted by jrwsod (Post 3564635)
I know this is an old thread but it kills me to see people using the rc.local file for this. This is not the right way to do this.
The correct way to add permanent static routes to a system besides setting the default gateway is to create a file /etc/sysconfig/network-scripts/route-eth0 (or whichever interface you want to route through). You can add as many routes as you would like per interface by simply incrementing the number at the end of each statement. Once saved a restart of the network services will force a read of this route file.
The syntax of the file should look like this:
ADDRESS0=x.x.x.x
GATEWAY0=x.x.x.x
NETMASK0=x.x.x.x
ADDRESS1=x.x.x.x
GATEWAY1=x.x.x.x
NETMASK1=x.x.x.x

Enjoy!

Take a look at /etc/sysconfig/network-scripts, and see if route-eth0 and route-wlan0 exist, if they do, look inside and see if each one is configured according the routes that you need. It may be that NetworkManager is reading from these, and that's why your routes are being re-written every time you re-connect to wlan0.

R03L 12-03-2009 04:46 AM

Code:

/etc/sysconfig/network-scripts/route-eth0
is there
but there is no
Code:

/etc/sysconfig/network-scripts/route-wlan0
so should i create one?

yes im new to setting routes. but thats the seccond point why im interesed in these things. im doing study LPI 1 so im little ahead on my study whit thisone.

bartonski 12-03-2009 10:05 PM

Quote:

Originally Posted by R03L (Post 3778168)
Code:

/etc/sysconfig/network-scripts/route-eth0
is there
but there is no
Code:

/etc/sysconfig/network-scripts/route-wlan0
so should i create one?

yes im new to setting routes. but thats the seccond point why im interesed in these things. im doing study LPI 1 so im little ahead on my study whit thisone.

Yes, I think that you need to add route-wlan0, and I think that you'll have to edit route-eth0.

I'd like to see route-eth0, partly because I'm running a Debian system that doesn't use that file, and I'm curious to see it, and partly because it might be useful.

R03L 12-04-2009 04:37 AM

/etc/sysconfig/network-scripts/eth0
Code:


GATEWAY0=192.168.1.1
NETMASK0=255.255.255.0
ADDRESS0=192.168.1.102

is the standart of this file..
i think created by networkmanager


All times are GMT -5. The time now is 03:01 PM.