Re: Raw Socket




Rainer Temme wrote:
markpapadakis wrote:
zwhermes@xxxxxxxxx wrote:
How can i use a Raw Socket to send a packet through a certain ethernet
card in a computer with several ethernet cards? I still have no idea
about that. I will really appreciate your help. Thanks.


o Examine the source code of programs that utilize this functionality.
o To send them over a given NIC, just bind() your socket's fd to that
NIC's assigned IP address.
o http://mixter.void.ru/rawip.html

Nope, binding a socket-fd to one of the local IP addresses only
makes sure, this address will be used as source address. If a packet
is routed out via a certain adapter or not is still depending on
the destination IP (and where that is routed to is looked up in the
routing table).


Nevertheless, I don't understand the wish to send a packet out via
a certain adapter...
If it is the 'right' way out for the given destination, then the
routingtable should route the packet there as well.
If its the 'wrong' way out, why would one want to send it there.

Whereas, the wish to us a certain of more than one local addresses
(as pointed out by Mark) is very useful at times.

Rainer

Well said. I was thinking about bind()ing to an IP address as a means
to listen() for accept()ing requests from a single interface only --
completely unrelated, of course, to the original question.

.



Relevant Pages

  • Re: How do I read/interpret a (netstat) routing table ?
    ... I know this routing table is used to direct TCP/IP packets to their destination. ... Assume on local computer 192.168.0.14 a TCP-IP packet is arriving with the destination ... NetMask --> Makes it easier for the Router (layer 3 device, ...
    (microsoft.public.windowsxp.network_web)
  • Re: Raw Socket
    ... card in a computer with several ethernet cards? ... routing table). ... I don't understand the wish to send a packet out via ... If it is the 'right' way out for the given destination, ...
    (comp.unix.programmer)
  • Re: How do I read/interpret a (netstat) routing table ?
    ... This article describes TCP connection states and how to read Netstat ... I know this routing table is used to direct TCP/IP packets to their ... destination. ... Assume on local computer 192.168.0.14 a TCP-IP packet is arriving with the ...
    (microsoft.public.windowsxp.network_web)
  • Re: set up gateway for PPP to Ethernet?
    ... doesn't know how to forward the packet, ... I was expecting .200 with a destination of .3, ... Remember that the routing table is used to tell the ...
    (comp.os.linux.networking)
  • Re: Changing the NAT IP on demand?
    ... > source address of the packet, not the destination as per usual. ... though - looking at the routing table won't ... Now that just changes which IP the packet is NAT'ed onto. ... now when I NAT onto the secondary Internet connection IP it'll be ...
    (freebsd-hackers)

Loading