LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 07-11-2011, 09:21 AM   #1
MarcusWebb1966
Member
 
Registered: Mar 2011
Posts: 58

Rep: Reputation: 0
Two gateways?


Hi

Trying to set up a server in Debian that has one network card but two separate gateways on it (i.e. in two separate subnets). I've been trying and failing miserably in this:

I'd like to have one network on eth0
10.45.36.15 Address
10.45.36.4 Gateway
255.255.255.0 Netmask

and the other on eth0:2
10.197.82.124 Address
10.197.82.117 Gateway
255.255.255.240 Netmask

It's probably the easiest thing in the world, but what the hell is the route command I need to get this working? I've tried
Code:
route add -net 10.197.82.124/28 gw 10.197.82.117 dev eth0:2
to be hit with
Code:
SIOCADDRT: No such process
Oh yes, and it has to be a permanent route, so if I reboot or the power fails, it comes back.

TIA wonderful people
 
Old 07-11-2011, 09:46 AM   #2
Dani1973
Member
 
Registered: Dec 2010
Distribution: Debian testing
Posts: 148

Rep: Reputation: 16
10.197.82.124/28 is not a network but a IP address.

your network address should be : 10.197.82.112
and broadcast : 10.197.82.127
useable IP addresses : 10.197.82.113 to 10.197.82.126

PS : hope I got that right long time I did subnet calculation ^^
 
Old 07-11-2011, 09:50 AM   #3
MarcusWebb1966
Member
 
Registered: Mar 2011
Posts: 58

Original Poster
Rep: Reputation: 0
Sorry, my bad - I'm trying to get the network address to be .124 as per the original question, hence the strange /28 on there. I believe(d) that put me in the right range as per your subnet calculation.
 
Old 07-11-2011, 10:16 AM   #4
Dani1973
Member
 
Registered: Dec 2010
Distribution: Debian testing
Posts: 148

Rep: Reputation: 16
But still your route wouldn't make sense because it's a directly connected network and it should be in the routing table by default.

What are you really trying to accomplish?
 
Old 07-11-2011, 10:44 AM   #5
MarcusWebb1966
Member
 
Registered: Mar 2011
Posts: 58

Original Poster
Rep: Reputation: 0
I'm trying to get the server to respond to a particular website address on this IP (has to be this IP, no others will do).

As a result the server has to send back packets via a gateway that is in the same subnet, hence me asking for a second gateway for the network card.

So theoretically it looks like this:
Code:
iface eth0 inet static
    address 10.45.36.15
    netmask 255.255.255.0
    network 10.45.36.0
    broadcast 255.255.255.0
    gateway 10.46.36.4

iface eth0:1 inet static
    address 10.45.36.215
    netmask 255.255.255.0
    broadcast 255.255.255.0

iface eth0:2 inte static
    address 10.197.82.124
    netmask 255.255.255.240
    network 10.197.82.112
    gateway 10.197.82.117
Does that look right for an /etc/network/interfaces file? and what's the corresponding route you need to add to make said network (eth0:2) run?

Regards
 
Old 07-11-2011, 11:20 AM   #6
Dani1973
Member
 
Registered: Dec 2010
Distribution: Debian testing
Posts: 148

Rep: Reputation: 16
Your configurations is asking for 2 default gateways that can't be done.
You cannot have 2 default gateways!
 
Old 07-11-2011, 11:28 AM   #7
MarcusWebb1966
Member
 
Registered: Mar 2011
Posts: 58

Original Poster
Rep: Reputation: 0
Well, tbh, I didn't think it was a flier but someone assured me it could be done. Oh well, you live and learn. Thank you Dani1973!
 
Old 07-11-2011, 12:03 PM   #8
Dani1973
Member
 
Registered: Dec 2010
Distribution: Debian testing
Posts: 148

Rep: Reputation: 16
You are not lost yet, when configuring things in /etc/network/interfaces you specify default gateways.

You need routing with conditions, I have no experience with it but with iproute you can specify things like what comes in on one interface goes out on that interface.

PS : is it only me or is LQ about to 'explode' ? (lots of timeouts when coming on this board)
 
Old 07-11-2011, 01:02 PM   #9
MarcusWebb1966
Member
 
Registered: Mar 2011
Posts: 58

Original Poster
Rep: Reputation: 0
Oh, that would be an interesting exercise - mind you I tried doing this so that I didn't have to figure out how to configure routing with iproute. ;-) Our previous server that was working on doing this (as in "Leave it alone, it's working!" never had its config saved and on reboot all our routing connections disappeared into the ether never to be seen again.

Can someone with exposure to iproute point me in the general direction of what I'm supposed to be looking at/doing? I'm normally reasonably smart at figuring these things out myself...

And again, Many thanks Dani1973...
 
Old 07-11-2011, 09:35 PM   #10
Dani1973
Member
 
Registered: Dec 2010
Distribution: Debian testing
Posts: 148

Rep: Reputation: 16
check the cli history on the old server maybe you will be lucky and it's in there -> /root/.bash_history

Last edited by Dani1973; 07-11-2011 at 09:37 PM.
 
Old 07-12-2011, 04:01 AM   #11
MarcusWebb1966
Member
 
Registered: Mar 2011
Posts: 58

Original Poster
Rep: Reputation: 0
Unfortunately in the process of trying to get it back, we updated the system and borked it a little and now it doesn't even boot....
 
Old 07-12-2011, 06:16 AM   #12
Dani1973
Member
 
Registered: Dec 2010
Distribution: Debian testing
Posts: 148

Rep: Reputation: 16
That's where a live CD can be handy
 
  


Reply

Tags
gateway, howto, network


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to find out the gateways IP? Shioni Linux - Networking 4 02-05-2007 07:45 PM
Two gateways? candyman123 Linux - Networking 1 09-08-2005 01:36 PM
Gateways Esmo2000 Linux - Networking 1 01-03-2005 03:49 PM
2 Gateways Equis Linux - Networking 1 11-15-2003 04:58 AM
2 Gateways def1014 Linux - Networking 3 10-24-2002 06:21 PM


All times are GMT -5. The time now is 10:42 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration