LinuxQuestions.org
Visit Jeremy's Blog.
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 12-04-2014, 09:50 PM   #1
hardikgohil1988
Member
 
Registered: Sep 2014
Posts: 63

Rep: Reputation: Disabled
routing ports


Hello,

I have a Embedded Board

eth0 ip : 192.168.82.x eth1 ip : 192.168.82.y

up eth0 first then eth1

when I ping from host to both the interfaces default route goes though eth0 only.It doesn't matter whether eth1 link is connected or not.

if I up eth1 first the default route goes through eth1

help me
 
Old 12-05-2014, 04:49 PM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,199

Rep: Reputation: 1284Reputation: 1284Reputation: 1284Reputation: 1284Reputation: 1284Reputation: 1284Reputation: 1284Reputation: 1284Reputation: 1284
Both ports are on the same subnet. What are you expecting to happen?
 
Old 12-05-2014, 05:15 PM   #3
Nemesiz
Member
 
Registered: Oct 2007
Posts: 47

Rep: Reputation: 2
You have to make some rules to route the IP respond.
 
Old 12-07-2014, 07:38 PM   #4
hardikgohil1988
Member
 
Registered: Sep 2014
Posts: 63

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by smallpond View Post
Both ports are on the same subnet. What are you expecting to happen?

Problem is whenever I ping eth1 ip address eth0 is responding.i remove eth1 link connection ping response still works instead of going to timeout.
 
Old 12-07-2014, 11:38 PM   #5
Nemesiz
Member
 
Registered: Oct 2007
Posts: 47

Rep: Reputation: 2
Can you print #ip route
 
Old 12-08-2014, 07:15 PM   #6
hardikgohil1988
Member
 
Registered: Sep 2014
Posts: 63

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Nemesiz View Post
Can you print #ip route
# ip route
192.168.82.0/24 dev eth0 proto kernel scope link src 192.168.82.111
192.168.82.0/24 dev eth1 proto kernel scope link src 192.168.82.99
 
Old 12-09-2014, 03:01 AM   #7
Nemesiz
Member
 
Registered: Oct 2007
Posts: 47

Rep: Reputation: 2
You have to create 2 routing tables and set incoming and outgoing ip rules to look up in these tables.

# one time command
echo "100 IP1" >> /etc/iproute2/rt_tables
echo "101 IP2" >> /etc/iproute2/rt_tables

# commands for route

ip route add 192.168.82.0/24 dev eth0 src 192.168.82.111 table IP1
ip route add 192.168.82.0/24 dev eth1 src 192.168.82.99 table IP2

ip rule add to 192.168.82.111 lookup IP1
ip rule add from 192.168.82.111 lookup IP1

ip rule add to 192.168.82.99 lookup IP2
ip rule add from 192.168.82.99 lookup IP2
 
1 members found this post helpful.
Old 12-10-2014, 12:23 AM   #8
hardikgohil1988
Member
 
Registered: Sep 2014
Posts: 63

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Nemesiz View Post
You have to create 2 routing tables and set incoming and outgoing ip rules to look up in these tables.

# one time command
echo "100 IP1" >> /etc/iproute2/rt_tables
echo "101 IP2" >> /etc/iproute2/rt_tables

# commands for route

ip route add 192.168.82.0/24 dev eth0 src 192.168.82.111 table IP1
ip route add 192.168.82.0/24 dev eth1 src 192.168.82.99 table IP2

ip rule add to 192.168.82.111 lookup IP1
ip rule add from 192.168.82.111 lookup IP1

ip rule add to 192.168.82.99 lookup IP2
ip rule add from 192.168.82.99 lookup IP2

Thank you very much your answer is perfect.

Here is the most thorough list for getting iproute2 to work with your kernel:

CONFIG_NETFILTER_NETLINK=y
CONFIG_NETFILTER_NETLINK_QUEUE=y
CONFIG_NETFILTER_NETLINK_LOG=y
CONFIG_NF_CT_NETLINK=y
CONFIG_SCSI_NETLINK=y
CONFIG_IP_ADVANCED_ROUTER=y
CONFIG_NET_SCH_INGRESS=y
CONFIG_NET_SCHED=y
CONFIG_IP_MULTIPLE_TABLES=y
CONFIG_NETFILTER_XT_TARGET_MARK=y
 
  


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
IP Routing policies for separating traffic based on ports - not working BhushanPathak Linux - Networking 6 09-17-2014 01:28 AM
Routing entry question for dual ethernet ports 5883 Linux - Networking 2 03-04-2014 07:45 AM
Routing certain ports to one Network Interface and all of the rest to another T0PAZ Linux - Networking 2 12-18-2011 07:37 AM
Routing ports to secondary network card vockleya Linux - Networking 24 01-22-2010 08:08 PM
how? redirect apache2 outbound ports to specific ports w/iptables? nowshining Linux - Security 5 05-27-2008 02:46 AM

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

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