LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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-29-2004, 08:35 AM   #1
rickthemick
Member
 
Registered: Aug 2003
Location: Sweden
Distribution: Debian
Posts: 52

Rep: Reputation: 15
DHCP overcomes my communication problems


DHCP has a nice feature that I need in a program I'm coding (this post is related to some other posts I've made but has a new topic - DHCP)

I have problems with communicating between two hosts using completely different IP addresses (e.g [h1:192.168.0.5, eth0] <---> [eth0 h2:10.0.1.1 eth1 10.0.2.8]) but are sitting on the same link and should do so.

The thing is that the hosts drops the packets from the other host, this can be solved by adding this:
route add default dev eth0
but this messes up the packet routing to for h2, since it's default gw (e.g 10.0.2.1) will have conflicts with the new "default device". So this solution is not an option for me.

How DHCP solves this...(?)
Lets say h2 runs a DHCP server and h1 the DHCP client. This would cause no problems, h1 would send its discover to h2 and the process continous and h1 will finally get a new address say 10.0.1.6. (I have tried it so it works). When I did this I saw on Ethereal that the source address was 0.0.0.0 on the DHCP discovery packets arrive at the server!
-> Is this the trick (with src 0.0.0.0)?
-> Or how can the DHCP client get its packets to the DHCP server if it has a totaly different (current) IP address?
-> How is it possible to set the source address to 0.0.0.0 in a UDP packet?

Best Regads
Rickard

Last edited by rickthemick; 10-29-2004 at 08:38 AM.
 
Old 10-30-2004, 08:07 PM   #2
zatriz
Member
 
Registered: Aug 2003
Location: Seattle, Wa
Distribution: Fedora,Trustix,Debian
Posts: 290

Rep: Reputation: 30
why not assign virtual ip to each nic
the 10.0 would get a alias eth0:1 with 192. x
and the 192.x would get an alias eth0:1 with 10.x

but if all you want to do is get the src address to 0.0.0.0 on a udp packet you could use a program like hping2 and script that to create a udp packet with whatever parameters you need.

Last edited by zatriz; 10-30-2004 at 08:09 PM.
 
Old 10-31-2004, 03:28 AM   #3
r0b0
Member
 
Registered: Aug 2004
Location: Europe
Posts: 602

Rep: Reputation: 49
That's how dhcp discovery works. You ask a dhcp server for an IP address. You still don't have any address, so you use 0.0.0.0 source address (and broadcast destination address).
If the client and the server sit on the same layer2 subnet, they see each others' packets and they are able to communicate.
 
Old 11-01-2004, 08:27 AM   #4
rickthemick
Member
 
Registered: Aug 2003
Location: Sweden
Distribution: Debian
Posts: 52

Original Poster
Rep: Reputation: 15
i

Hurray, it works, thanks...

I've tried to change the source address using iptables:
iptables -t nat -A POSTROUTING -p udp -dport 5000 -j SNAT --to 0.0.0.0

this works fine but only for broadcast packets, why? I want it to change the unicast packets too... Ok, I'm tired right now but it seems a little odd to me!
(All other chains are empty)

/Rickard
 
  


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
DHCP problems - multiple DHCP servers sat86 Linux - Networking 4 10-02-2005 05:43 AM
pilot-link & Tungsten communication problems everbloom Linux - Hardware 4 08-27-2005 03:56 PM
problems communication on ttyS0 _HB_ Linux - Hardware 0 06-24-2004 06:57 AM
Modem communication Problems iannickb Linux - Hardware 1 03-14-2004 08:31 PM
XP Pro Build 2600/sp1 v.1105 DHCP Client to Redhat 8.0 DHCP Server - Problems atomant Linux - Networking 5 06-28-2003 11:24 AM


All times are GMT -5. The time now is 06:18 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