LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 10-27-2004, 11:15 AM   #1
urban_olofsson
LQ Newbie
 
Registered: Oct 2004
Location: Sweden
Distribution: Debian
Posts: 2

Rep: Reputation: 0
No packets received at application-level without a default gateway


Hi!

I have a problem with receiving data packets at the application-level in my C++ program. The transport protocol I use is UDP and the socket is bound to listen on all network interfaces (INADDR_ANY). Linux kernel version is 2.4.18.

The computer has two network interfaces one wireless and one wired. The wired one works well (e.g., packets sent to the this interface is also delivered up to my program) and is used as my default gateway. The wireless interface is though my problem: I cannot receive any packets to my program unless I have a default gateway routing to it (the wireless interface). Apparently the kernel drops the packet at the routing level, and doesn't deliver it up to my program, because of some not known reason...

I don't want to have a default gateway on my wireless interface , because the default gateway is supposed to be on my other wired interface.

My question is why doesn't the kernel deliver the data packets up to my program? And is it anyway I can avoid this problem and still have no default gateway (as explained above)?
 
Old 10-28-2004, 02:26 PM   #2
ugge
Senior Member
 
Registered: Dec 2000
Location: Gothenburg, SWEDEN
Distribution: OpenSUSE 10.3
Posts: 1,028

Rep: Reputation: 45
See if your iptables setup is blocking anything
Code:
iptables -v -n -L INPUT
Does the counters increase when sending to your wireless?
What does your routing table say? (route -n)
 
Old 10-29-2004, 02:35 AM   #3
urban_olofsson
LQ Newbie
 
Registered: Oct 2004
Location: Sweden
Distribution: Debian
Posts: 2

Original Poster
Rep: Reputation: 0
>See if your iptables setup is blocking anything
Iptables has policy 'ACCEPT' in all chains and all tables(mangle, nat and filter), so the problems shouldn't be there...

>Does the counters increase when sending to your wireless?
I don't know which counter you mean, but I use Ethereal to analyze whats is coming in on the interface, and all packets sent to the interface is received - e.g., can be seen in Ethereal - but not delivered up to my program...

>What does your routing table say? (route -n)
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.0.6.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
10.0.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
0.0.0.0 10.0.6.1 0.0.0.0 UG 0 0 0 eth0

Where 'eth1' is my wireless interface and 'eth0' the wired one.

The computer sending to the wireless interface has IP address: 10.0.4.2 and the protocol is UDP (and both has bound the same port). The packet will start arriving up to my program if I either:

add a route back to the sending computer, e.g., 'route add -host 10.0.4.2 dev eth1'
add a default gateway to 'eth1', e.g., 'route add default gw 10.0.1.1 dev eth1'

But if none of these routes is present in my routing table no packets arrives up to my program, and in my program, it isn't possible that I may know the sending IP address (or IP network address) beforehand , and as I sad I don't want a default gateway on my 'eth1' interface.
 
Old 10-29-2004, 08:51 AM   #4
ugge
Senior Member
 
Registered: Dec 2000
Location: Gothenburg, SWEDEN
Distribution: OpenSUSE 10.3
Posts: 1,028

Rep: Reputation: 45
Quote:
Iptables has policy 'ACCEPT' in all chains and all tables(mangle, nat and filter), so the problems shouldn't be there...
Are your chains empty? or do you have any rules in it? Packets can be stopped by that.

Quote:
I don't know which counter you mean, but I use Ethereal to analyze whats is coming in on the interface, and all packets sent to the interface is received - e.g., can be seen in Ethereal - but not delivered up to my program...
When running the command I suggested you get more columns, the interesting ones are packets and bytes. Do these counters increase when packets are sent to your LAN IP? Ethereal is most often run in promiscuous mode mean that it listens in on every packet traveling the cable, not only the ones that are let through to your machine.

Quote:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.0.6.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
10.0.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
0.0.0.0 10.0.6.1 0.0.0.0 UG 0 0 0 eth0
This seems in it's order.

Quote:
The computer sending to the wireless interface has IP address: 10.0.4.2 and the protocol is UDP (and both has bound the same port). The packet will start arriving up to my program if I either:

add a route back to the sending computer, e.g., 'route add -host 10.0.4.2 dev eth1'
add a default gateway to 'eth1', e.g., 'route add default gw 10.0.1.1 dev eth1'
This also is in it's correct order. The computer with IP 10.0.4.2 isn't on the same network as your WLAN card (10.0.1.x), this because of the sub netting in effect.
With the routing table given there are no way of your computer knowing where the 10.0.4.x network is.
How are your pinging computer (10.0.4.2) setup and connected to these networks?
Are there similar misses in their config?
If the 10.0.4.x network also is reachable through the LAN then it should probably be added as a route, unless it can be reached through a wire connection as well.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
which are these 0.0.0.0 source ip packets i received? linux_lover2005 Linux - Networking 1 04-29-2005 07:58 PM
Channel Bonding: DUP packets received from ping ricky_ds Linux - Networking 2 04-29-2005 11:39 AM
packets sent VS packets received fsasya Linux - Networking 0 07-18-2004 07:11 PM
handling packets at kernel level using C/C++ valib4u Linux - Networking 3 09-14-2003 02:29 PM
how packets handled at kernel level valib4u Programming 5 09-14-2003 03:58 AM


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

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration