LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   multiple nics (https://www.linuxquestions.org/questions/linux-networking-3/multiple-nics-651527/)

satish 06-25-2008 06:53 AM

multiple nics
 
we have 4 nics in our redhat 9 proxy server.

eth0: 192.168.1.2 local ip
eth1: 59.144.124.58 internet static ip
eth2: 192.168.100.149 local ip
eth3: 10.32.138.40 local ip

in office we have our trading software which works on 10.32.138.1 as a gateway,if i didn't specify 10.32.138.1 as a gateway in the trading pc the trading software will not work, i want to do that when i give 10.32.138.40 as a gateway in trading pc it will to work.

Things i want to do without disturbing the internet which works on eth0 (localip) and eth1(static ip).

i want to do that when i specify 10.32.138.1 as a gatway in eth3 the nic will be work as a router but without disturbing the internet,because when i specify 10.32.138.1 as a gatway the internet get down and i cannot ping 192.168.1.2,when i delete the gateway from route command the internet works and i get ping response from 192.168.1.2

Regards


satish

rossonieri#1 06-25-2008 01:47 PM

hi,

i'm not too sure about your point, but maybe you can use 2 gateways with different metric :
10.32.138.1 metric 1
10.32.138.40 metric 10

or maybe - you can give us more drawing?

like this?

eth1 ------------- eth0, 2, 3?

eth3 goes to 10.32.138.1 machine?

HTH.

satish 06-28-2008 05:54 AM

multiple nics
 
i had tried mettic 1 and metric 10 in client windows xp pc with 2 gatway but only on gatway works.here i am giving you the more clear picture

eth0-eth1 for internet

eth0
DEVICE=eth0
BOOTPROTO=static
BROADCAST=192.168.1.255
IPADDR=192.168.1.2
NETMASK=255.255.255.0
NETWORK=192.168.1.0
ONBOOT=yes

eth1
DEVICE=eth1
BOOTPROTO=static
BROADCAST=59.144.124.255
IPADDR=59.144.124.58
NETMASK=255.255.255.0
NETWORK=59.144.124.0
ONBOOT=yes

eth1 having gatway 59.144.124.1 for my internet i had defined with route command and i don't want to delete gateway,if i did the internet will not work so i don't want to touch this interface.

eth3
DEVICE=eth3
ONBOOT=yes
BOOTPROTO=static
IPADDR=10.32.138.40
NETMASK=255.255.255.0

eth3 i want to define 10.32.138.1 as a gateway,and also i want to route internet to 10.32.138.40 which comes from eth1 and eth0 interface.it just like the matter of multiple nics with multiple gatways forget about eth2 nic.so please help me to sort out this matter

dougbourne 06-30-2008 08:24 AM

You can define different gateways to all NIC, using ip route.
Search for "plicy based routing" or "advanced routing" or "ip route"
gl

chort 06-30-2008 08:36 AM

You can't have multiple default routes unless you use ip2 to do policy-based routing. Otherwise there is just one default route that will take precedence. You can have as many static routes as you like, though. So you can say the route to a certain subnet goes to a certain gateway. You can use this to specify how to get to subnets that aren't directly connected.

Are you trying to say that 10.32.138.1 is some other box (firewall or router) that has access to the trading network? You need to get traffic from 10.32.138/24 to there, but you want it to go through the proxy first? Or do you really just want the trading software to go through your proxy and then out to the Internet? I'm not very clear what you're trying to accomplish.

If you're trying to accomplish the latter, you'll need to use source-based routing, unless the trading software is always trying to go to a certain subnet that none of your other traffic goes to. In that case you could just set a static route for that subnet with a gateway of 10.32.138.1.

satish 07-02-2008 04:27 AM

multiple nics
 
eth0 192.168.1.2----- eth1 59.144.124.58 this 2 nics used for internet
eth2 192.168.100.145-------forget about this nic,because my question is about eth3 nic--------10.32.138.40. we have one router in office which is having ipaddress 10.32.138.1,we have to define this router's ip address in every pc as a gateway,if we don't define the router's ip address in the pc my trading software will not work.now i want to say that in eth3 i want to define the route's ip as a gateway it will look like this

eth3
DEVICE=eth3
ONBOOT=yes
BOOTPROTO=static
IPADDR=10.32.138.40
NETMASK=255.255.255.0
GATWAY=10.32.138.1

what i want to do from this nic is that i want to configured in each pc 10.32.138.40 as a gatway,i want 2 things from this nic

1 it will route internet packets from eth1,eth0
2 it will route trading software from 10.32.138.1 and my software will work.

it just like a router,please help me to sort it out.

as i am a newbie i don't understand how to configured policy routing

Regards

satish

Mr. C. 07-02-2008 04:45 AM

Perhaps it would be best if you think of routing as a decision making process: when I (a NIC) get a packet, which Interface (and hence wire) does my routing table tell me to place the packet.

And for "default route", think of it as "when there is no other match in the routing table, which interface shall the packet be placed on so that it is picked up by a directly connected routing station".

Draw yourself a picture, of your systems and your 4-NIC'd system, and ask those questions at each station, both to and from each interface.

estabroo 07-02-2008 09:38 AM

To do that you'll need to use the ip2 route/rule commands. The lartc documenation is a good read on how to do this, http://www.lartc.org

Essentially you need to add a new table to rt_table and then specify a default route for that table and what ips should use that table for routing, and any other routes you'd like for that table.

so for example if your table was trading

ip route add default via 10.32.138.1 table trading
ip route add 10.32.138.0/24 dev eth3 src 10.32.138.40 table trading
ip rule add from 10.32.138.40 table trading

The still fuzzy part is if you are running the trading app on that box it won't necessarily route out that interface, you'd need to know where it was trying to go and add another ip route/rule or bind the app to that interface. Say it was trying to connect to the trading server at 172.16.0.1, then you'd need something like this:

ip rule add to 172.16.0.1 table trading

And once you are that far you can see that if you know where the trading app is going, you might be able to skip all that and just add a normal route that says route add 172.16.0.1 gw 10.32.138.1 avoiding all the other pain.


I do think however that if you are using that box as a router that you'll want to setup ip2 stuff for each of the interfaces its amazingly powerful stuff and well worth learning.


All times are GMT -5. The time now is 03:24 PM.