Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
2  
You have a 0% accept rate. That's terrible. I would accept some answers if I were you or people are unlikely to help you. –  MDMarra Sep 29 '11 at 0:13
    
I can trust the good will of the people –  JuanPablo Sep 29 '11 at 0:15
1  
^ Most dangerous words i have heard all day... –  Silverfire Sep 29 '11 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 '11 at 0:19
1  
I was going to help but your 0% accept rate scared me off, but not enough to leave this comment! –  GregD Sep 29 '11 at 0:23
show 3 more comments

2 Answers 2

up vote 1 down vote accepted

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?

share|improve this answer
add comment

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.

share|improve this answer
    
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 '11 at 1:40
    
Probably the ethX part –  jdw Sep 29 '11 at 1:45
    
Fair enough, JuanPablo please clarify if this is not on Linux. –  Sean Reifschneider Sep 29 '11 at 17:41
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.