Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
07-11-2011, 08:21 AM
|
#1
|
Member
Registered: Mar 2011
Posts: 58
Rep:
|
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
|
|
|
07-11-2011, 08:46 AM
|
#2
|
Member
Registered: Dec 2010
Distribution: Debian testing
Posts: 148
Rep:
|
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 ^^
|
|
|
07-11-2011, 08:50 AM
|
#3
|
Member
Registered: Mar 2011
Posts: 58
Original Poster
Rep:
|
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.
|
|
|
07-11-2011, 09:16 AM
|
#4
|
Member
Registered: Dec 2010
Distribution: Debian testing
Posts: 148
Rep:
|
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?
|
|
|
07-11-2011, 09:44 AM
|
#5
|
Member
Registered: Mar 2011
Posts: 58
Original Poster
Rep:
|
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
|
|
|
07-11-2011, 10:20 AM
|
#6
|
Member
Registered: Dec 2010
Distribution: Debian testing
Posts: 148
Rep:
|
Your configurations is asking for 2 default gateways that can't be done.
You cannot have 2 default gateways!
|
|
|
07-11-2011, 10:28 AM
|
#7
|
Member
Registered: Mar 2011
Posts: 58
Original Poster
Rep:
|
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!
|
|
|
07-11-2011, 11:03 AM
|
#8
|
Member
Registered: Dec 2010
Distribution: Debian testing
Posts: 148
Rep:
|
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)
|
|
|
07-11-2011, 12:02 PM
|
#9
|
Member
Registered: Mar 2011
Posts: 58
Original Poster
Rep:
|
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...
|
|
|
07-11-2011, 08:35 PM
|
#10
|
Member
Registered: Dec 2010
Distribution: Debian testing
Posts: 148
Rep:
|
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 08:37 PM.
|
|
|
07-12-2011, 03:01 AM
|
#11
|
Member
Registered: Mar 2011
Posts: 58
Original Poster
Rep:
|
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....
|
|
|
07-12-2011, 05:16 AM
|
#12
|
Member
Registered: Dec 2010
Distribution: Debian testing
Posts: 148
Rep:
|
That's where a live CD can be handy 
|
|
|
All times are GMT -5. The time now is 07:14 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|