Web Hosting Talk







View Full Version : Machine with 2 Ethernet cards - how to configure routing?


pmak0
01-21-2002, 11:52 PM
I have a machine with two Ethernet cards; one connects to InterNAP (high quality bandwidth, expensive) and the other connects to Cogent (low quality bandwidth, cheap). Each Ethernet card has an IP address.

By default, the machine routes all outgoing traffic through Cogent.

How can I make it so that outgoing traffic on port 22 (i.e. my SSH connection) is routed through InterNAP? Does it have something to do with the "route" command perhaps?

priyadi
01-22-2002, 12:19 AM
As far as I know, you can't do that. The client is the one who decides which IP address to connect to.

RackMy.com
01-22-2002, 12:22 AM
I don't think you can do it with out BGP but you can only open up SSH on an IP of that line.

pmak0
01-22-2002, 12:23 AM
Originally posted by priyadi
As far as I know, you can't do that. The client is the one who decides which IP address to connect to.

If I connect to the IP address of the InterNAP ethernet card, the packets that I send to the machine will be via InterNAP.

However, the packets that the machine sends to me still goes through Cogent. I want to make those packets go through InterNAP. How can I do that?

RackMy.com
01-22-2002, 12:39 AM
It should only send it out the path you can in on and not out the other. How do you know it's returning on the other line?

pmak0
01-22-2002, 12:47 AM
Originally posted by RackMy.com
It should only send it out the path you can in on and not out the other. How do you know it's returning on the other line?

When I type "ifconfig", I can see the "RX bytes" (received bytes) and "TX bytes" (transmitted bytes) on each interface. If I type this:

# ifconfig | grep bytes
RX bytes:7329396 (6.9 Mb) TX bytes:4822546 (4.5 Mb)
RX bytes:335486890 (319.9 Mb) TX bytes:3781097551 (3605.9 Mb)
RX bytes:124316227 (118.5 Mb) TX bytes:124316227 (118.5 Mb)

That shows eth0 (InterNAP), eth1 (Cogent) and lo (localhost).

If I type "ifconfig | grep bytes" twice while logged in via ssh to the InterNAP address, the "RX bytes" doesn't change in between. If traffic was being sent through InterNAP, then the output to the first "ifconfig" would have been sent through InterNAP and thus increased "RX bytes".

pmak0
01-22-2002, 12:49 AM
In case this is useful, here's my routing table. 66.28.98.52 is my Cogent IP, and 64.94.46.199 is my InterNAP IP.

# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
66.28.98.32 66.28.98.34 255.255.255.224 UG 0 0 0 eth1
66.28.98.32 * 255.255.255.224 U 0 0 0 eth1
64.94.46.0 servercentral-1 255.255.254.0 UG 0 0 0 eth0
64.94.46.0 * 255.255.254.0 U 0 0 0 eth0
127.0.0.0 * 255.0.0.0 U 0 0 0 lo
default 66.28.98.34 0.0.0.0 UG 0 0 0 eth1
default 66.28.98.34 0.0.0.0 UG 0 0 0 eth1
default 66.28.98.34 0.0.0.0 UG 0 0 0 eth1
default servercentral-1 0.0.0.0 UG 0 0 0 eth0
default 66.28.98.34 0.0.0.0 UG 1 0 0 eth1
default 66.28.98.34 0.0.0.0 UG 1 0 0 eth1
default 66.28.98.34 0.0.0.0 UG 1 0 0 eth1

(Is it just me, or are there a lot of redundant entries there? Line 2 seems to be a superset of line 1. Line 4 seems to be a superset of line 3. And then the "default" lines using Iface of eth1 seem to be repeated.)

DavidU
01-23-2002, 01:32 PM
This can easily be done with IPtables.

man iptables or email me off list.

You're gonna need the route2 packages for QoS.

-davidu