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 01-19-2012, 04:40 PM   #1
john_tobias
LQ Newbie
 
Registered: Jan 2012
Posts: 2

Rep: Reputation: Disabled
Network Route - setting routing priority


Hello All,

I have two network interfaces wire (phy0) and wireless (wifi), both of them are
connected to the network correctly. My kernel uses the wifi (as a default) when sending data but, I prefer to use the phy0. I created a routing table (please see below) for each interface and set the phy0 with higher priority than the wifi.

The routing table seems not working, maybe I am doing incorrectly or missing some procedures.
Any idea how to fix my problem?


#(wired)
/sbin/ip route flush table phy0
/sbin/ip route add table phy0 to 192.168.1.0/24 dev eth0
/sbin/ip route add table phy0 to default via 192.168.1.1 dev eth0

#(wireless)
/sbin/ip route flush table wifi
/sbin/ip route add table wifi to 10.0.1.0/24 dev ra0
/sbin/ip route add table wifi to default via 10.0.1.1 dev ra0

/sbin/ip rule add from 192.168.1.0/24 table phy0 priority 1000
/sbin/ip rule add from 10.0.1.0/24 table wifi priority 1002

/sbin/ip route flush cache

Thanks,

john
 
Old 01-19-2012, 06:28 PM   #2
MartinStrec
Member
 
Registered: Jan 2012
Location: Czech
Distribution: Fedora, RHEL, Ubuntu, Mint
Posts: 110

Rep: Reputation: 14
Hi, John!

I'm not sure about your understanding of routing. Your changes of priority will never have effect.

There is no effect of changing priorities of default routes.
If your interface has 192.168.1.X/24 IP there has to the route 192.168.1.0/24 on your that interface. Other way packets are not sent via that interface. The common priority for default routes is 0.


When you send data to a different network, such as internet, you can choose the default gateway. It means to make a route for 0.0.0.0/0 network. If you specify 192.168.1.1 as the GW it uses the first network. If you specify 10.0.1.1 gateway, it uses the second network.

Let me know if "send" data mean the whole communication or do you mean "send data via eth and recieve data from wifi". You can do it using routing however you have to make changes on the second side (10.0.1.1 and 192.168.1.1 device).
 
Old 01-19-2012, 07:45 PM   #3
john_tobias
LQ Newbie
 
Registered: Jan 2012
Posts: 2

Original Poster
Rep: Reputation: Disabled
Hi MartinStrec,

Here's what I want to do on my device:
My two interfaces are connected to the Network and they got the IP addresses from my DHCP server (below is my routing table).

10.0.1.0 * 255.255.255.0 U 0 0 0 ra0
192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
default 10.0.1.1 0.0.0.0 UG 0 0 0 ra0
default 192.168.1.1 0.0.0.0 UG 0 0 0 eth0

What I am trying to say "send" data, I have an application doing a communication between my device and the cloud server (both of them are exchanging data).
Since, my interfaces are configured correctly, the kernel uses (by default) the wifi (10.0.1.1) gateway to transmit the packet. But, I prefer to use the 192.168.1.1 instead of my wifi gateway and not screwing up the routing table.

Any idea?

Thanks,

john
 
Old 01-21-2012, 01:07 PM   #4
MartinStrec
Member
 
Registered: Jan 2012
Location: Czech
Distribution: Fedora, RHEL, Ubuntu, Mint
Posts: 110

Rep: Reputation: 14
Remove the default gateway via ra0 and add new gateway via eth0

or see http://www.generationip.com/document...teway-on-linux
 
  


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
Linux route/routing table NoahJK Linux - Server 7 06-25-2010 01:43 PM
help me with routing (route command) active Linux - Networking 0 01-15-2009 12:54 AM
Difficulty setting up wireless network, running route thiqued Linux - Wireless Networking 9 02-05-2006 04:58 PM
a routing route???? mchitrakar Linux - Networking 4 07-11-2005 10:38 PM
Setting Processing Priority DJFauß Linux - General 1 06-03-2001 09:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:34 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration