LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 12-01-2011, 04:33 AM   #1
ThomasRonshof
Member
 
Registered: Aug 2006
Posts: 133

Rep: Reputation: 0
2 network cards


Hi,

I have defined eth0 and eth1 with 2 different IP's.

If eth0 stops working, I would like to be able to use eth1 instead.

What's to do when eth0 breaks down ? I think something about moving default gateway from eth0 til eth1 ?

Regards
 
Old 12-01-2011, 05:21 AM   #2
kvmfix
LQ Newbie
 
Registered: Nov 2011
Posts: 2

Rep: Reputation: Disabled
Hi...

While eth0 is active, do you still need eth1 to be active?
 
Old 12-01-2011, 05:24 AM   #3
ThomasRonshof
Member
 
Registered: Aug 2006
Posts: 133

Original Poster
Rep: Reputation: 0
Yes, because I use them for virtualization. eth0 is bridged as br0 and eth1 as br1. I have several guests using br0 and br1 at the same time.
 
Old 12-01-2011, 05:31 AM   #4
kvmfix
LQ Newbie
 
Registered: Nov 2011
Posts: 2

Rep: Reputation: Disabled
Are both nic are in same network?

Can you reach eth0 and eth1 from other devices?
 
Old 12-01-2011, 05:39 AM   #5
ThomasRonshof
Member
 
Registered: Aug 2006
Posts: 133

Original Poster
Rep: Reputation: 0
Jep, eth0 is 192.168.10.40, eth1 is 192.168.10.45,

GW: 192.168.10.1

I can ssh in to both IP's from another host.
If I unplug eth1, I can still ssh to eth0.
If I unplug eth0 alone, I can't ssh to eth1 ! I think it's because of the GW and sshd is listening on eth0 ??
 
Old 12-01-2011, 06:26 AM   #6
aazkan
Member
 
Registered: Jan 2008
Posts: 72

Rep: Reputation: 5
Hi,

Unless configured to listen on a defined ip , sshd will listen to any/all.

Code:
netstat -antpd|grep :22
shows where sshd runs on.

It is possible to have 2 default gateway (sort off). You will need the iproute2 utility to add modify the routing table. Search through the forum, you'll probably find some leads here.
 
Old 12-01-2011, 07:00 AM   #7
ThomasRonshof
Member
 
Registered: Aug 2006
Posts: 133

Original Poster
Rep: Reputation: 0
Well, I don't need 2 gw's, only 1.

When eth0 dies, I want to change def.gw from eth0 to eth1.

Isn't that possible, maybe with the route command ?
 
Old 12-01-2011, 07:52 AM   #8
aazkan
Member
 
Registered: Jan 2008
Posts: 72

Rep: Reputation: 5
Sorry i misunderstood your question, thought you wanted a dual gateway
Of course, you can change your def gw to eth1.
 
Old 12-02-2011, 02:10 AM   #9
ThomasRonshof
Member
 
Registered: Aug 2006
Posts: 133

Original Poster
Rep: Reputation: 0
Ok,,, but how ?
 
Old 12-02-2011, 02:35 AM   #10
enno_onne
LQ Newbie
 
Registered: Nov 2011
Location: Auckland, New Zealand
Distribution: Ubuntu, OpenIndiana
Posts: 3

Rep: Reputation: Disabled
I'm also still learning unix here, but I hope this may work and help you out. If not, I am sorry and please let me know.

first, you need to see what is the original routing table by giving this command
Code:
netstat -rn
it will show you something like this
Code:
Routing Table: IPv4
  Destination           Gateway           Flags  Ref     Use     Interface 
-------------------- -------------------- ----- ----- ---------- --------- 
default              192.168.137.1        UG        9       3021 e1000g0   
127.0.0.1            127.0.0.1            UH        2        244 lo0       
192.168.137.0        192.168.137.41       U         3        495 e1000g0   

Routing Table: IPv6
  Destination/Mask            Gateway                   Flags Ref   Use    If   
--------------------------- --------------------------- ----- --- ------- ----- 
::1                         ::1                         UH      2      12 lo0   
fe80::/10                   fe80::203:1dff:fe0a:981c    U       3       0 e1000g0 
default                     fe80::b8cf:cb3a:d1ee:7554   UG      2       0 e1000g0
remember this IP routing tables.

Then you need to run this code
Code:
route add 192.168.10.0 192.168.10.45
--------------------- !!!!!! ------------------------
If it doesn't work then you need to do the reversal and when you re run the netstat -rn, it should be the same
Code:
route remove 192.168.10.0 192.168.10.45
--------------------- !!!!!! ------------------------

Good luck

Last edited by enno_onne; 12-02-2011 at 02:36 AM.
 
Old 12-02-2011, 04:30 AM   #11
ThomasRonshof
Member
 
Registered: Aug 2006
Posts: 133

Original Poster
Rep: Reputation: 0
Well, tried:

route del default
route add default gw eth1

But can't still ssh to 192.168.10.45 from the outside ?
 
Old 12-02-2011, 05:52 AM   #12
ThomasRonshof
Member
 
Registered: Aug 2006
Posts: 133

Original Poster
Rep: Reputation: 0
Works now. Must do a ifconfig eth0 down also :-)
 
  


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
[SOLVED] problem: Wind River Linux is not detecting the network cards (network interfaces) NM04 Linux - Newbie 17 12-06-2013 08:06 AM
Network Problem with 2 network cards on the same subnet on Redhat seb.its Linux - Networking 6 12-24-2005 03:16 AM
2 network cards, single network, load balancing? tormentum Linux - Networking 1 02-13-2005 02:37 PM
two network cards - one for local network, one for http/vsftpd server scottster Linux - Networking 1 01-20-2005 08:52 PM
2 network cards, 2 network connections - routing problem tvojvodi Linux - Networking 4 02-24-2004 03:26 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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