Re: Multiple external interfaces
From: sean (sean_at_fredcom.com)
Date: 03/18/04
- Next message: P Gentry: "Re: VLANs"
- Previous message: Tester: "domain name change"
- In reply to: LeX: "Multiple external interfaces"
- Next in thread: LeX: "Re: Multiple external interfaces"
- Reply: LeX: "Re: Multiple external interfaces"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 18 Mar 2004 14:56:23 -0500
First, you should only need to enter a gateway once for the default
routing table (unless you are routing to two different gateways, but I
am assuming that you are not).
It sounds like you need to set up routing tables to have one segment get
routed differently then another.
Assuming that your default route is set to go out eth0, and you want
10.0.1.0/24 to go out eth1
ip rule add from 10.0.1.0/24 table "altroute"
ip route add default via [ip-address-of-eth1] dev eth1 table "altroute"
ip route flush cache
This will send out anything from the 10.0.1.0/24 net though the second
nic. If eth1 is a DHCP address you can do something like this to get
the IP address that is assigned to it:
IP=`/sbin/ifconfig eth1|grep "inet addr"| \
cut -f 2 -d ":"|cut -f 1 -d " "`
Crude, but effective.
Now $IP will hold the IP address of that ethernet device.
Is it possible that you can setup a secondary IP address on the same NIC
with DHCP a second time? That way you have eth0 and eth0:0 with two
separate IP addresses, and you can tailor you iptables rules to NAT to
each IP address instead of using the ip rule and route commands.
As for the pinging from the outside could it be that the return ping is
exiting the wrong nic and getting dropped or ignored? Have you tried a
tcpdump on each interface while attempting this to see how the server is
responding to the pings?
LeX wrote:
> Hi there,
>
> After months of tinkering I'm desparate, I don't know what to do. I hope
> someone out here knows what to do, this is my problem:
>
> My Linux server (Debian 3 stable) has 1 internal network adapter and 2
> external adapters. I want to route the traffic from my 10.0.0.x subnet
> via one interface, and the traffic from my 10.0.1.x subnet via the other
> one. Both external interfaces are connected to a single cable modem
> (Which supports up to 8 network cards) and have both an ip address in
> the same subnet with the same gateway. If I put both cards in diffrent
> computers they work perfectly, but in the Linux box only one of them
> works (The one initialised first). If I do "ifup extA && ifup extB" only
> extA can be pinged from the outside, if i do "ifup extB && ifup extA"
> only extB can be pinged from the outside. Whatever I try I can't get
> both of them to work at the same time. Am I missing something or is this
> just impossible with Linux?
>
- Next message: P Gentry: "Re: VLANs"
- Previous message: Tester: "domain name change"
- In reply to: LeX: "Multiple external interfaces"
- Next in thread: LeX: "Re: Multiple external interfaces"
- Reply: LeX: "Re: Multiple external interfaces"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|