LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Routing Traffic to a Virtual Network Interface (https://www.linuxquestions.org/questions/linux-networking-3/routing-traffic-to-a-virtual-network-interface-806908/)

medized 05-10-2010 03:19 AM

Routing Traffic to a Virtual Network Interface
 
Hello all,

I am currently working on a project in my university to enhance quality of VoIP communications in a WLAN (I'm not going further with details, not the purpose of this post). For this work, I am looking for a way to route specific traffic from a physical interface to virtual interface. Not all the traffic must be forwarded (actually just the RTP traffic). The virtual interface should perform some actions on the packets received, before sending them to an other interface.

eth0 --> eth0:0 --> eth1

The problem is that I don't know how to select the packet to be transmitted from eth0 to eth0:0.

Many thanks for your precious advices and idea !

SuperJediWombat! 05-10-2010 03:40 AM

Are you using NAT? What are the IP addresses of your interfaces?

Your question does not really make a lot of sense, can you be more specific?

Also, run these commands and post the output here:
Code:

ifconfig
ip route
iptables-save


medized 05-10-2010 04:10 AM

I am not using NAT, and not even set up the virtual interface yet.
I just have one simple internet connection, linked to my eth0 interface.
I am more looking for general tips to start conceiving the implementation.


Code:

ifconfig

eth0      Link encap:Ethernet  HWaddr 00:1b:24:58:d9:3e 
          inet adr:213.100.46.180  Bcast:213.100.46.191            Masque:255.255.255.192
          adr inet6: fe80::21b:24ff:fe58:d93e/64 Scope:Lien
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Packets reçus:6028 erreurs:0 :0 overruns:0 frame:0
          TX packets:5632 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 lg file transmission:1000
          Octets reçus:5445567 (5.4 MB) Octets transmis:952514 (952.5 KB)
          Interruption:29 Adresse de base:0xe000

lo        Link encap:Boucle locale 
          inet adr:127.0.0.1  Masque:255.0.0.0
          adr inet6: ::1/128 Scope:Hôte
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          Packets reçus:0 erreurs:0 :0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 lg file transmission:0
          Octets reçus:0 (0.0 B) Octets transmis:0 (0.0 B)

Code:

ip route :

213.100.46.128/26 dev eth0  proto kernel  scope link  src 213.100.46.180  metric 1
169.254.0.0/16 dev eth0  scope link  metric 1000
default via 213.100.46.129 dev eth0  proto static

I can try to be clearer:

I want my device to act like an intelligent bridge. It will receive packets on the eth0 interface. If the packet is an RTP flow, with a specific IP destination address, it will be sent to a virtual network interface. if not, the packet will be delivered normally.

In the virtual interface, all the RTP frames will be aggregated into one big multiplexed frame, before being sent to the second network interface.

Thanks for your patience guys !!

TimothyEBaldwin 05-21-2010 02:45 AM

Quote:

Originally Posted by medized (Post 3963001)
eth0 --> eth0:0 --> eth1

eth0:0 isn't a virtual interface - that is silly. Perhaps you are thinking of tun0 etc?

Quote:

The problem is that I don't know how to select the packet to be transmitted from eth0 to eth0:0.
Use iptables to mark the packet then ip rule to select a routing table.

Ipolit 05-21-2010 04:12 AM

May be something like this

/sbin/iptables -t nat -A PREROUTING -p udp --dport 10000:20000 -i eth0 -j DNAT --to 192.168.0.2

where 192.168.0.2 is the address of the address of eth0:0


All times are GMT -5. The time now is 06:07 PM.