Routing Again

Does anyone actually know how to do routing?
Prob: traffic on eth1 & eth2 use .254 as gateway which routes thru eth0:0 on xxx.xxx.xxx.63 gw xxx.xxx.xxx.254 Meanwhile, eth0 on xxx.xxx.xxx.2 is a DNS server.
I want it to use eth3 at yyy.yyy.yyy.253 gw yyy.yyy.yyy.254 but still use eth0 for DNS.
Been diddling with this for months, the best I manage is to get traffic thru eth3, but it won’t see eth0.
If I just change all the IPs and gateways to yyy’s i will lose the dns for umpteen websites until peeple can find dns server on the new IP.
What do you think would happen if I put both netpipes to a hub, plugged eth0 into that hub and gave eth0:0 and IP/netmask/GW on yyy’s? I’d try it, but it would have to be at 3 in the morning or something.

Can you post a diagram? It’s a bit difficult to figure things out from the description …

[quote=“herbie_popnecker”]Does anyone actually know how to do routing?
Prob: traffic on eth1 & eth2 use .254 as gateway which routes thru eth0:0 on xxx.xxx.xxx.63 gw xxx.xxx.xxx.254 Meanwhile, eth0 on xxx.xxx.xxx.2 is a DNS server.
I want it to use eth3 at yyy.yyy.yyy.253 gw yyy.yyy.yyy.254 but still use eth0 for DNS.
Been diddling with this for months, the best I manage is to get traffic thru eth3, but it won’t see eth0.
If I just change all the IPs and gateways to yyy’s i will lose the dns for umpteen websites until peeple can find dns server on the new IP.
What do you think would happen if I put both netpipes to a hub, plugged eth0 into that hub and gave eth0:0 and IP/netmask/GW on yyy’s? I’d try it, but it would have to be at 3 in the morning or something.[/quote]

Ok first your explaination would be much easier with real ip’s even if they arent the ones you are using :wink:

you should just be able to do

route add -host xxx.xxx.xxx.2 dev eth0

then just add a route to the yyy gw

route add -host yyy.yyy.yyy.254 dev eth3

then add the route to .253

route add -host yyy.yyy.yyy.253 gw yyy.yyy.yyy.254

something like that anyway, draw a diagram in paint/visio/dia for me and i will be able to explain it a little better. Or pm me your msn address and i will add you.

Xeon Box does DNS, squid, NAT for eth1 & eth2
http://sulu.maxit.net/subs/rickm/web/stuff/routeNOW.jpg
current setup. If I bring ifup eth3, eth1 and eth2 cannot resolve when eth0:0 is the DNS, and traffic still appears to be thru eth0:0
Ideal would be to fix that problem, but the iptables have stumped me for months.
http://sulu.maxit.net/subs/rickm/web/stuff/route1.jpg
appears to be an easier method (solves the iptables and keeps them in place), but will eth0 and eth0:0 talk to each other? I could even add an eth0:1 y.y.y.251 to become future dns address

Well,

I was gonna take a look for you when i got home but your images are broken . Anyway i recommend dia for drawing diagrams it like visio but more awesome.

Ok you just pointed out something. Never hire some other outfit to buy your domains, they’ll try to deny you access to them.
Give me a minute and I’ll edit those images to the IP cuz I only fucking asked them to change the dns a week ago.

There images fixed. goddam!

I’m still a little confused looking at your diagram, you got rid of the hub where does the gw for eth3 hook up?

you could do something like

route add -host xxx.xxx.xxx.2 dev eth0:0
route add -net yyy.yyy.yyy.yyy -gw xxx.xxx.xxx.254
iptables -A FORWARD -s yyy.yyy.yyy.yyy ! -d xxx.xxx.xxx.2 -o ethX
iptables -A FORWARD -s yyy.yyy.yyy.yyy -d xxx.xxx.xxx.2 -o eth0:0

Something like that should work, you may need to remove the second route line. ethX is the interface all traffic not going to the dns server should go to.

In diag 1 the gateway for eth3 is on the yyy block. eth3 is assigned a yyy IP. Traffic routed to eth3 can’t access eth0:0 on xxx block to resolve.

I think I’ll scrap that idea, can’ make it work. allowing the first NIC to access both gateways:
eth0 =yyy.yyy.yyy.253 gw Y
eth 0:0 = xxx.xxx.xxx.2 gw X (dns1)
eth0:1 = yyy.yyy.yyy.251 gw Y (dns2)
then all I sould have to do is RTFM to see if
route add -net is to assign specific IP to specific eth card
route add -host is to assign gw & netmask to a subnet
or vice versa…

[quote=“herbie_popnecker”]In diag 1 the gateway for eth3 is on the yyy block. eth3 is assigned a yyy IP. Traffic routed to eth3 can’t access eth0:0 on xxx block to resolve.

I think I’ll scrap that idea, can’ make it work. allowing the first NIC to access both gateways:
eth0 =yyy.yyy.yyy.253 gw Y
eth 0:0 = xxx.xxx.xxx.2 gw X (dns1)
eth0:1 = yyy.yyy.yyy.251 gw Y (dns2)
then all I sould have to do is RTFM to see if
route add -net is to assign specific IP to specific eth card
route add -host is to assign gw & netmask to a subnet
or vice versa…[/quote]

route add -net is to add a route to a network or route a specific nettwork thtrough another.

route add -host is the same as route add -net xxx.xxx.xxx.xxx netmask 255.255.255.255

just a short hand form of it.