LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 06-09-2005, 11:37 PM   #1
efm
Member
 
Registered: Apr 2005
Location: indonesia
Distribution: suse 10
Posts: 101

Rep: Reputation: 15
multiple gateways


Hello,

Can i use multiple gateways in Linux just like in Windows? I´m new in Linux,
and I love it because I can use aliases to my IP address. Windows can´t (I think),
but it can use multiple gateways.
My computer IP is 192.168.2.253, and the gateway at the factory is 192.168.2.3,
and sometimes I have to go to the main office, and their gateway is 192.168.1.3,
so I made alias to the real IP with 192.168.1.253. Therefore, with Linux,
I don´t have to change my IP address, but too bad I have to change the gateway
in my computer.

Any suggestion?

Thank you
 
Old 06-10-2005, 01:08 AM   #2
michaelsanford
Member
 
Registered: Feb 2005
Location: Ottawa/Montréal
Distribution: Slackware + Darwin (MacOS X)
Posts: 468

Rep: Reputation: 30
Code:
ifconfig eth0:0 192.168.1.253
ifconfig eth0:1 192.168.2.253
route add default gw 192.168.2.3 via dev eth0
route add default gw 192.168.1.3 via dev eth0
The first two lines set up ip alias so that your eth0 interface can see both 192.168.1/2 networks, and the second two add a new default gateway for each network segment. It may sound counter-intuitive but you can in fact have more than one default gateway; this becomes clear once you realise that they're in different subnets. See mine:

Code:
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.0.0     *               255.255.255.0   U     0      0        0 eth0
192.168.1.0     *               255.255.255.0   U     0      0        0 eth0
10.0.0.0        *               255.0.0.0       U     0      0        0 wlan0
loopback        *               255.0.0.0       U     0      0        0 lo
default         192.168.0.1     0.0.0.0         UG    0      0        0 eth0
default         192.168.1.1     0.0.0.0         UG    1      0        0 eth0
I hope I haven't made any stupid mistakes...it's been a rough evening.
 
Old 06-10-2005, 02:21 AM   #3
gd2shoe
Member
 
Registered: Jun 2004
Location: Northern CA
Distribution: Debian
Posts: 835

Rep: Reputation: 49
Just here to learn. Are you sure about "via"; I couldn't find it in the man page?


Quote:
Originally posted by michaelsanford
Code:
ifconfig eth0:0 192.168.1.253
ifconfig eth0:1 192.168.2.253
route add default gw 192.168.2.3 via dev eth0
route add default gw 192.168.1.3 via dev eth0
....

I hope I haven't made any stupid mistakes...it's been a rough evening.
I think you might have. Then again, I'm not an authority. If there is some meaning I would be thrilled to learn it.

Last edited by gd2shoe; 06-10-2005 at 02:23 AM.
 
Old 06-10-2005, 02:33 AM   #4
efm
Member
 
Registered: Apr 2005
Location: indonesia
Distribution: suse 10
Posts: 101

Original Poster
Rep: Reputation: 15
Hello, thanks for replies
but the ¨route add...¨ lines are not working,
but i think i get the idea and i want to try it using yast
thank you
 
Old 06-10-2005, 08:50 AM   #5
michaelsanford
Member
 
Registered: Feb 2005
Location: Ottawa/Montréal
Distribution: Slackware + Darwin (MacOS X)
Posts: 468

Rep: Reputation: 30
Woops! Yeah there's no via, it's just route dev eth0.
 
  


Reply


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
Multiple Gateways Jon Doe Linux - Networking 9 03-07-2005 03:26 PM
Multiple Gateways inforlinx Linux - Networking 1 02-22-2005 08:28 PM
Red Hat 7.3 and multiple gateways on multiple interfaces bluefmc Linux - Networking 2 11-19-2004 05:01 PM
multiple gateways john8675309 Linux - Software 0 05-24-2004 06:27 PM
multiple ips, multiple gateways, one interface drpixel Linux - Networking 6 12-04-2002 12:56 AM


All times are GMT -5. The time now is 07:17 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