LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 09-08-2005, 12:16 PM   #1
johnMG
Member
 
Registered: Jul 2003
Location: CT, USA
Distribution: Debian Sarge (server), Etch (work/home)
Posts: 601

Rep: Reputation: 32
2 NIC's, both to different points on same LAN?


I've got a Debian box with 2 NIC's in it that I want connected to 2 different points on my LAN. This box also gets accessed on a couple of different ports (our DSL modem/router is doing some port-forwarding for it).

The LAN setup is this: DSL modem/router <--> hub <--> big switch <--> all hosts plugged in here.

I want my Debian box to not only connect to the big switch like everybody else (with NIC #1), but also to plug directly into the hub (with the 2nd NIC) so I can monitor all the traffic into/out-of my network.

The reason it's also got to plug into the switch is so all the other hosts can connect to it for the usual file serving and intranet site serving that it's been doing all along before trying to add this 2nd NIC.

I tried editing my /etc/network/interfaces and made it look like so:
Code:
# The loopback interface
auto lo
iface lo inet loopback

# The first network card - this entry was created during the Debian installation
auto eth0
iface eth0 inet static
    address 192.168.1.2
    netmask 255.255.255.0
    gateway 192.168.1.1


auto eth1
iface eth1 inet static
    address 192.168.1.3
    netmask 255.255.255.0
    gateway 192.168.1.1
but that made it so I couldn't access the machine from outside the LAN.

How can I configure this Debian box to use both NIC's?
 
Old 09-08-2005, 12:54 PM   #2
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
Why don't you just put the box on the HUB? Unless the switch is more than a cheap SOHO switch, it should still be seen fine there.
 
Old 09-08-2005, 01:06 PM   #3
johnMG
Member
 
Registered: Jul 2003
Location: CT, USA
Distribution: Debian Sarge (server), Etch (work/home)
Posts: 601

Original Poster
Rep: Reputation: 32
> Why don't you just put the box on the HUB?

I believe the reason is, this box gets used by folks on the LAN -- they regularly copy large files to and from it. If we just plugged the box into the hub, then every time someone copied a big file or made a backup, the rest of the users' internet access would slow to a crawl.

Another option is to just find some old x86 box lying around, put an ethernet card in it, install GNU/Linux on it, and then plug *that* into the hub (its sole purpose being for not monitoring), but we were hoping to have the current Debian box do double-duty.
 
Old 09-08-2005, 01:09 PM   #4
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
Fair enough. You can't access the machine outside the lan with the changes to the network config? Where are you trying to access it from? What exactly happens?

Technically, if all you want to do is sniff packets on the other interface, it doesn't even need an IP. You could just bring it up in promisc mode.
 
Old 09-08-2005, 01:36 PM   #5
johnMG
Member
 
Registered: Jul 2003
Location: CT, USA
Distribution: Debian Sarge (server), Etch (work/home)
Posts: 601

Original Poster
Rep: Reputation: 32
> You can't access the machine outside the lan with the changes to the network config?

Yes. With the changes to my /etc/network/interfaces file (and restarting networking with "/etc/init.d/networking restart"), I cannot access the machine from outside the LAN.

> Where are you trying to access it from?

From an ssh client at my home (after I left work).

> What exactly happens?

It just hangs not being able to establish a connection I guess.

> Technically, if all you want to do is sniff packets on the other interface,
> it doesn't even need an IP. You could just bring it up in promisc mode.

Ahh... That's interesting, because that's all we really want to do. We just want to be able to run ethereal and ntop and have them watch that 2nd ethernet card. I'll google for "promiscuous mode" and see what I can find...
 
Old 09-08-2005, 01:44 PM   #6
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
I'm not sure about ntop, but ethereal can put the card into promiscuous mode for you. Just do 'ifconfig eth1 up' and then run ethereal. No IP, no routing tables needed. You're not actually trying to handle traffic over the interface, after all.
 
Old 09-08-2005, 02:23 PM   #7
johnMG
Member
 
Registered: Jul 2003
Location: CT, USA
Distribution: Debian Sarge (server), Etch (work/home)
Posts: 601

Original Poster
Rep: Reputation: 32
Matir -- thanks! Everything works now.

The solution is as you suggest: The machine has 2 NIC's, but only eth0 is mentioned in /etc/network/interfaces. The eth0 card is the regular one plugged into the switch. The eth1 card is plugged into the hub (which is plugged directly into the DSL modem/router, and which the switch uplink plugs into).

We bring up eth1 with: ifconfig eth1 -promisc up
then run ntop telling it to look at eth1, and everything seems to work fine (I think ntop, like ethereal, is able to switch the interface to promiscuous mode all by itself).

Thanks. :)

Last edited by johnMG; 09-08-2005 at 02:24 PM.
 
Old 09-08-2005, 02:24 PM   #8
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
Glad it worked for you! Let us know how the monitoring goes!
 
  


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
1 IP for 2 NIC's turbo_acura Linux - Networking 4 10-10-2005 04:33 PM
2 NIC's help troycus Linux - Networking 18 04-07-2005 08:01 PM
Two NIC's Meatball1337 Linux - Hardware 4 11-10-2004 09:14 PM
2 NIC's plisken Linux - Networking 1 04-19-2003 03:32 PM
NIC's sscharbo Linux - Networking 1 01-11-2001 08:34 AM

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

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