How to set my Linux machine to have two network cards with two IPs



  • 1. Internet connection on Linux
    Hi, I've got a FC7 server, running a workgroup with ~10 windows PCs. I'm sharing the internet connection via FC7, so my setup is: Router ( ------ (eth0) - (eth1) ------ Windows computers (1.2 - 1.10) All of the windows computers can use the internet fine, but my FC7 server can't! I can access websites / ping by ip address but not by name. I've checked the dns settings, and they seem to be ok, and I'm a bit lost as to what else to check! Any ideas what could be wrong? Thanks, Chris
  • 2. {Announcement} Safesquid Version 4.2.2.RC8.2 released
    Hello friends, SafeSquid, Linux based Content Filtering Internet Proxy, Version 4.2.2.RC8.2 has been released. Highlights: A memory leak in request forwarding has been fixed. The disk cleaning mechanism has been rolled back. Logs have been fixed to report "username@IP_ADDRESS". Crashing due to incompatible values set in the global sub-section has been fixed. Repeated authentication challenges have been fixed. cProfiles (a Web site profiler) has been added. The SafeSquid init script has been enhanced. Automatic log rotation has been improved. There are major optimizations to allow handling of more than 1024 concurrent sockets. There are optimizations in the automatic creation of directives for Monit. Check 'Changelog' on the SafeSquid Forum for details. Cheers.
  • 3. localhost optimization
    I seem to have read in numerous places, that using a form of IP based network connectivity to localhost on Linux is something especially optimized. So much so, that there would hardly have to be any difference between, for example, setting up a TCP/IP connection to localhost and setting up a connection through a UNIX socket. I worked with that assumption for a good while until I got to test it and I got the shock of my life. I know it's just a single test over a self- invented protocol using a self-written implementation, but a difference of a factor thousand in speed ? That seems like a lot. Am I doing something wrong ? Are there flags one has to set in ioctl or something ? I won't be posting any code just yet, since I'd really like a simple answer: has it or has it not been optimized, and if so, what is a reasonable difference to expect ? Thank you for your time.
  • 4. how to access Internet through a ISA server in a LAN?
    Hi, I have a Gentoo Linux 2007 installed on a PC, which is in a LAN of my office. I need to use a proxy to access the Internet, but the proxy is a ISA server. How can I configure my linux system to access the Internet? PS: I can successfully ping my other machines in the LAN. Thanks,

How to set my Linux machine to have two network cards with two IPs

Postby keanewoon » Mon, 28 May 2007 18:02:58 GMT

Dear all gurus out there,

I am newbie to Linux and networking.

I have a Red hat linux that used as a Database machine, oracle.

I have 2 network cards that I wish to set to and respectively, the default gw is The
connection of the two IPs coming from 2 different switches (still from
the same router).

My purpose is that : if one of the switches is down, my connection
still up with the other side.

I know switch is hardly "down", but i wish to have full redundancy.

What I did is, I jus set the 2 network cards with the two IPs and I
switch off one of the switches, "poof" the whole network, how can it be done ?

Or any other alternatives ?


Re: How to set my Linux machine to have two network cards with two IPs

Postby Menno Duursma » Mon, 28 May 2007 20:38:09 GMT

[link failover]

Try the 'bonding' driver:

And use an interface alias if you still need the second IP adress, e.g.:
ifconfig bond0:1 <ipadress> ...


Re: How to set my Linux machine to have two network cards with two IPs

Postby pechter » Mon, 28 May 2007 21:45:49 GMT

In article < XXXX@XXXXX.COM >,

Google bonding network interfaces...

You need to have one ip address that is on both switches and will move
from a primary to a seconday NIC.

Intel had it's own IANS software on the older Linux versions but is now
supporting standard bonding.  On the 2.4 the Intel stuff was nice but
required at least one Intel NIC per bonded pair.


  "When I think back on all the {*filter*}I learned in Vax school
  It's a wonder I fixed anything at all."   (to the tune of Kodachrome)

Re: How to set my Linux machine to have two network cards with two IPs

Postby Tim S » Tue, 29 May 2007 03:57:10 GMT

Follow on from this:

Caveat: I have only done bonding with 802.3ad for the purposes of link
aggregation (enhanced bandwith), not for failover.

I agree that bonding is probably the neater solution (only ever have one IP)
and I believe that a suitable way would be to use the arp monitoring
failover mode in the linux bonding module. Wanring though: don't just set
up a bonded link in aggregation mode willy nilly or there is going to be
much network weirdness resulting (arp confusion for one). The "ultimate"
documentation can be found in the linux source here:


To the OP - when you have a solution, I would recommend that you test it
thoroughly with 2 tcpdump sessions bound each to one NIC and see if it is
really behaving as you expect. Link aggregation requires support from the
switch infrastructure and I've never come across link aggregation working
where the links feed two different switches. Failover should howvere work
with any kit, though you might get a pregnant pause when the primary link
fails and the switches have to re-discover the path, but that shouldn;t be
more than a few seconds IME.



Re: How to set my Linux machine to have two network cards with two IPs

Postby momo » Tue, 29 May 2007 23:31:46 GMT

this configuration is not a linux issue your configuration is fine
but will not support your target to make a fail over
to make the data base client to use both IP's configure the client
tnsnames.ora to fail over the other IP if one faild
the 2nd and the most important is the however your connection
will be established again but you will loose your session
to avoid such issue you should use a caching library in your code
(application) such as oci or jdbc.
one more thing if you really want to make complete redundant use RAC
as the instance is more critical than the switch

Similar Threads:

1.Networking between two PC with both having two Ethernet port

I have two PC with FC2. Each PC has two Ethernet ports. eth0 is 100 MBit 
at both PC whereby eth1 can use 1GBit. I can establish the following 
eth0 <-> eth0
eth0 <-> eth1

but I can not ping between the two eth1s.

I configured
ifconfig eth0
ifconfig eth1
ifconfig eth0 netmask
ifconfig eth1 netmask

ifconfig eth0
ifconfig eth1
ifconfig eth0 netmask
ifconfig eth1 netmask

Both route and iptables show nothing suspicious. What can I do?

2.Connecting two networks together by having two network cards in the same computer


I recently aquired two 100Mbs cards and I am trying to incorporate
them in my existing
network at home. My old network looks as follows:

                    10Mbs                10Mbs     
   Mountainman  -------------  Surfrat --------
   Win XP                      Win 98SE       |             |         |        
|               10Mbs                         
|- Jukebox ---------------- Jukebox 2        
   Win 98SE                 Win 98SE             
I have installed the two 100Mbs cards into Mountainman and
Surfrat as follows:

   Mountainman  -------- Surfrat                                  
   Win XP                Win 98SE                              (100 Mbs card)          Mbs card)
                (100 Mbs card gateway)   
                (10 Mbs card) ----------|
                Mbs card)          | 
                (10 Mbs card gateway)  | 
|                 10Mbs
| -- Jukebox ---------------- Jukebox 2
     Win 98SE                 Win 98SE      

The result of this is that the 10Mbs network can all see each other.
can only see Surfrat and not the others.
Surfrat cannot see Mountainman.

Please help me to configure this so all the PC's can see each other.



Return to linux


Who is online

Users browsing this forum: No registered users and 57 guest