2

I have two network interfaces with respective ips

 eth0 : 192.168.70.153
 eth2 : 192.168.70.155

when I make

 route -C
 Kernel IP routing cache
 Source          Destination     Gateway         Flags Metric Ref    Use Iface
 192.168.70.155 192.168.70.152  192.168.70.152        0      0        0 eth0

how I can force a telnet conection to 192.168.70.152 over eth2?

6
  • I can trust the good will of the people
    – JuanPablo
    Sep 29, 2011 at 0:15
  • 1
    ^ Most dangerous words i have heard all day...
    – Silverfire
    Sep 29, 2011 at 0:17
  • 1
    Accepting answers on your previous questions is giving back to the community. It gives a small reward to those that help you and it costs you nothing. It also helps future visitors by showing them what answer solved your problem. If you won't do this, why would anyone want to help you?
    – MDMarra
    Sep 29, 2011 at 0:19
  • ok, now understand how work the rate.
    – JuanPablo
    Sep 29, 2011 at 0:28
  • @GregD give me a tip
    – JuanPablo
    Sep 29, 2011 at 0:33

2 Answers 2

1

You would have to add a specific route for the host 192.168.70.152.

route add -host 192.168.70.152 dev eth2

This would push all traffic destined for 192.168.70.152 over eth2. Would that be enough, or would you require only telnet to be routed?

1

What you want is the Linux Advanced Routing and Traffic Control HOWTO. Specifically, the section on Netfilter & iproute - marking packets is a good place to start for this sort of thing.

You'd set up your default route to go over eth0, then in /etc/iproute2/rt_tables add an entry, say at 200, for "viaeth2". Then you need to set up routing in that table:

ip route add 192.168.70.0/24 dev eth2 src 192.168.70.155 table viaeth2
ip rule add fwmark 1 table viaeth2

Then you can mark packets via iptables that should be routed via that table:

iptables -A PREROUTING -d 192.168.70.152 -t mangle -p tcp --dport 23 \
    -j MARK --set-mark 1

This will do what you specifically asked in the original question. If you want to do more general load-balancing across the two interfaces, you want to do "bonding" via the "bond" driver.

3
  • Given the lack of tags or any mention of Linux in his question, are you sure your answer applies to his question?
    – Zoredache
    Sep 29, 2011 at 1:40
  • Probably the ethX part
    – jdw
    Sep 29, 2011 at 1:45
  • Fair enough, JuanPablo please clarify if this is not on Linux. Sep 29, 2011 at 17:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .