LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 12-25-2004, 12:24 AM   #1
jomy
Member
 
Registered: Jul 2004
Location: UAE
Distribution: RedHat
Posts: 93

Rep: Reputation: 15
Adding different gateway to the second NIC


Hi,

I have a Linux server running as a proxy and mail server.We have a leased line and an ADSL connection. The leased line is used to receive mails only and the ADSl for internet browsing.I've two network cards in the server. so right now I've configured my default gw as 192.168.0.254 which is the that of the leased line.So I'm able to receive mails now.

Now I want my Internet gateway to be the ADSL router whose IP is 192.168.0.253. How can I configure the gateway for eth1 as 192.168.0.253(ADSL) keeping my default gw as 192.168.0.254.

I hope it is done with 'route add' command. But if possible give me the exact syntax.

waiting for your reply,

Thanking you in advance

Jomy

Last edited by jomy; 12-25-2004 at 12:31 AM.
 
Old 12-25-2004, 12:39 AM   #2
n0sr
Member
 
Registered: Sep 2004
Location: 127.0.0.1
Distribution: Slackware 13; Ubuntu Raspberry Pi OS
Posts: 255

Rep: Reputation: 34
Sorry but I don't have my Linux system handy to check the syntax, but do a man route and check out the metric parameter.

The metric is an arbitrary number that lets you specify which interface to use first. Route will use the interface with the lowest metric number, if that isn't available the interface with the next higher metric will be tried. This lets you set redundant paths to the Internet and have them all running at the same time.
 
Old 12-25-2004, 12:45 AM   #3
veritas
Member
 
Registered: Aug 2003
Location: Dallas,TX
Distribution: Ubuntu Server, Slackware, Red Hat 6.1
Posts: 241

Rep: Reputation: 30
You can assign routes to specific interfaces like:
Code:
route add default gw 192.168.0.253 eth1
 
Old 12-25-2004, 02:36 AM   #4
jomy
Member
 
Registered: Jul 2004
Location: UAE
Distribution: RedHat
Posts: 93

Original Poster
Rep: Reputation: 15
Thanks Mr. Veritas ,the code worked.


Jomy
 
  


Reply



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
Gateway with 3 NIC czezz Linux - Networking 1 07-11-2005 03:06 AM
Adding a gateway robotik Linux - Wireless Networking 5 10-20-2004 03:38 AM
Automatically adding default gateway when booting enjoyzj Linux - Networking 2 04-13-2004 04:05 PM
How to add second gateway IP on the same NIC? linux_angus Linux - Networking 4 01-21-2004 09:58 PM
2 nic gateway problem d-rez Linux - Networking 4 06-20-2002 05:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

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

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration