LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 06-09-2003, 09:07 AM   #1
beng
LQ Newbie
 
Registered: May 2003
Location: Beijing, China
Distribution: RedHat 8/9
Posts: 13

Rep: Reputation: 0
Configuring second NIC, this is getting beyond ridiculous


Hi All

I have just spent the good part of a day trying to install a second ethernet card on my system. I tried searching several forums and read a how-to or three and have still not been able to find a solution to this one. I am surprised by the lack of information available on this issue (maybe I will write a quick how-to after I solve this one

OK here is the problem. I have a RH8 server which I set up and everything has been going fine for weeks until today. Our company wants to install ADSL so I went out and bought a second NIC. the card I bought was a D-Link DFE-530TX (this is the same model as the NIC already installed in the server). I inserted the new card, booted the computer and the new card is detected. It asks if I want to configure it? - I say yes. Do I want to tranfer existing configuration? - I say no. Do I want to enable networking? - I say Yes. I then configure the card using the new IP address, etc, etc.

I enter the system. I find that all the settings that I have just applied have been applied to eth0. I have to edit ifcfg-eth0 back to its original settings. There is no ifcfg-eth1 file present. If I run 'ifconfig -a' eth1 is there , hardware address is correct, etc, but IP address has not been assigned. So I use "ifconfig eth1 XXX.XXX.XXX.XXX netmask......". Run ifconfig again. everythings appears correct and both eth0 and eth1 are confirmed as running. Still no ifcfg-eth1 script though.

Time to try everything out. From another computer (not the server) I ping eth0's IP address and sure enough it works. I then ping eth1's IP address which also works...well sort off. I can ping eth1 using IP address only if eth 0 is connected to the network. If I pull the cable on eth0, then the pings no longer make it to eth1. Any explanations?

Finally I manually make ifcfg-eth1 by copying ifcfg-eth0 and then making the necessary changes to the file. I then 'ifup eth1'. I ping eth1's IP address which works fine. However, if I now ping eth0's ip address it will work but only if eth1 is connected to the network. This is the complete opposite of what was happening above.

I just can't work out what is going on here. I hope someone out there could shed some light on this mystery.

Regards,

Ben

Here is the ouput when I run 'ifconfig':

eth0 Link encap:Ethernet HWaddr 00:05:5D:A0:81:AB
inet addr:192.168.XXX.AAA Bcast:192.168.XXX.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:124 errors:0 dropped:0 overruns:0 frame:0
TX packets:178 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:13621 (13.3 Kb) TX bytes:21080 (20.5 Kb)
Interrupt:9 Base address:0xd800

eth1 Link encap:Ethernet HWaddr 00:05:5D:A0:85:9C
inet addr:192.168.XXX.BBB Bcast:192.168.XXX.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:151 errors:0 dropped:0 overruns:0 frame:0
TX packets:166 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:17876 (17.4 Kb) TX bytes:15596 (15.2 Kb)
Interrupt:5 Base address:0xd400

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:30 errors:0 dropped:0 overruns:0 frame:0
TX packets:30 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2774 (2.7 Kb) TX bytes:2774 (2.7 Kb)
 
Old 06-09-2003, 01:51 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,536

Rep: Reputation: 148Reputation: 148
If possible, please write the IP adresses. They seem local (if they aren't don't show them), so it shouldn't be a security problem. If it's impossible, please write if they're from the same subnetwork. I mean: let's say we have 192.168.1.1 and 192.168.1.100 and both have netmask 255.255.255.0, they're in the same subnet. If you have 192.168.1.1 and 192.168.2.1 and netmask 255.255.255.0, they aren't in the same subnet.

Then, could you insert the result of 'route'? I think it may be a routing table issue.
 
Old 06-09-2003, 02:17 PM   #3
emence
Member
 
Registered: Jun 2003
Location: Springfield, MO
Distribution: RedHat/Slackware
Posts: 81

Rep: Reputation: 15
Well you have missed a few Key items. It will only ping if eth0 is present because you have not added a default route for that interface. Secondly, I hate to ever tell anyone to use the graphical tools, but if you run redhat-config-network, it makes it pretty simple to configure both cards and it will automaticall generate the scripts for when you re-install. If you plan on using this for a router, or using it to forward ip packets, you will also want to enable ip forwarding and possibly IP Tables with NAT. But to start, simply type in "redhat-config-network" and do it the graphical way.
 
Old 06-09-2003, 10:51 PM   #4
beng
LQ Newbie
 
Registered: May 2003
Location: Beijing, China
Distribution: RedHat 8/9
Posts: 13

Original Poster
Rep: Reputation: 0
OK guys, I solved the problem but I am not happy with the solution. I took the advice of emence and used 'redhat-config-network' to configure the new ethernet card. Why am I not happy about this solution? I hate having to rely on GUIs for system configuration, the reason being that one day I will be on a system with no GUI, and then I will really be in trouble.

In following on from Mara's coments, I think you may be correct, as after running 'ifconfig' I did not make any changes to the route table. Strangely enough none of the documentation I read mentions the route command other then when creating the loopback device (lo). I noticed when I used the 'redhat-config-network' GUI, that the 'route' options are all empty. So I am now wondering, is changes to the routing table absolutely necessary? I have done some searching on the web, but am unable to find a good description of what 'route' and routing tables are and how to use them. Could you please explain to me why they are necessary?

One further question. How does one automatically generate the ifcfg-eth1 script? I thought it was created after configuring using 'ifconfig'.

Many thanks,

Ben
 
Old 06-11-2003, 08:41 AM   #5
emence
Member
 
Registered: Jun 2003
Location: Springfield, MO
Distribution: RedHat/Slackware
Posts: 81

Rep: Reputation: 15
Yes the "route" command is very necessary, especially if you are running a two nic box, hence my first post ---> It will only ping if eth0 is present because you have not added a default route for that interface. <------

The 'route' command is the necessary function that tells the box where to forward packets when looking for a network beyond the local network. Also if you are using multiple class C LAN's, you would also use static routes to "bridge" accross the networks. here is the output of my route table:
[root@chris root]# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
66.137.XXX.XX * 255.255.255.192 U 0 0 0 eth1
192.168.6.0 * 255.255.255.0 U 0 0 0 eth0
192.168.1.0 router.domains1 255.255.255.0 UG 0 0 0 eth0
192.168.9.0 router.domains1 255.255.255.0 UG 0 0 0 eth0
192.168.8.0 router.domains1 255.255.255.0 UG 0 0 0 eth0
127.0.0.0 * 255.0.0.0 U 0 0 0 lo
default 66.137.XXX.XXX 0.0.0.0 UG 0 0 0 eth1
[root@chris root]#

I hope this helps to make some sense.

Chris
 
Old 06-11-2003, 01:30 PM   #6
beng
LQ Newbie
 
Registered: May 2003
Location: Beijing, China
Distribution: RedHat 8/9
Posts: 13

Original Poster
Rep: Reputation: 0
You know what Emence,you are absolutely right. I have done some reading up on routing and have a reasonalbe grasp of the fundamentals, although I am still not exactly sure how to implement it. I have got both ethernet cards working (kind of working). I can use 'eth1' to connect to the internet via an ADSL modem, however as soon as I bring up 'eth0' I loose all outward communication. I know the problem is with the default gateway as defined in the routing tables (see below):

Lets take a look...with 'eth0' disabled everything is going just great. Default gateway is via ppp0.

Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
61.148.24.1 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 61.XXX.XX.XX 0.0.0.0 UG 0 0 0 ppp0

Now lets see what happens when 'eth0' is enabled:

Appears that the default gateway has changed. Two problems here. First ppp0 is no longer the default gateway. Second the IP address of the gateway is wrong. This is the address of our former gateway. The new gateway is on 192.168.1.1 (which has the ADSL 'ppp0').

Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
61.148.24.1 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 192.168.1.200 0.0.0.0 UG 0 0 0 eth0

OK, so that appears to be the problem. Problem is I am not sure how to fix it. The following is what I need to know:

1. Is my presumptions about the problem correct?

2. What should my routing table look like?

3. How do I update it? do I need to delete/add records?

Normally I would be a little bit more adventurous and play around with the settings myself, as i find breking things and fixing them again is a great way to learn. Unfortunately this our company server, so I can't afford to screw it up - too much .

Last edited by beng; 06-11-2003 at 01:33 PM.
 
Old 06-11-2003, 02:00 PM   #7
msound
Member
 
Registered: Jun 2003
Location: SoCal
Distribution: CentOS
Posts: 465

Rep: Reputation: 30
i think ill stick with the GUI thanks

<~~~~ windows user
 
Old 06-11-2003, 02:51 PM   #8
djroketboy
LQ Newbie
 
Registered: Jun 2003
Distribution: RedHat 8
Posts: 13

Rep: Reputation: 0
use 2 different NIC's and your problems will vanish....

ie. 1 d-link, and 1-3com

i tried using 2 of the same one's and it was just a nightmare....

if you choose to stick with using 1 brand let us know how it works out

Last edited by djroketboy; 02-15-2011 at 11:35 AM.
 
Old 06-11-2003, 02:55 PM   #9
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,536

Rep: Reputation: 148Reputation: 148
Quote:
1. Is my presumptions about the problem correct?
Yes.

Quote:
2. What should my routing table look like?
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
61.148.24.1 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 61.XXX.XX.XX 0.0.0.0 UG 0 0 0 ppp0
Quote:
3. How do I update it? do I need to delete/add records?
When eth0 is up:
route del default
route add default ppp0

You need to make sure that ppp0 starts after eth0 and that it's set as defaut route ('defaultroute' option).
 
Old 06-11-2003, 08:33 PM   #10
beng
LQ Newbie
 
Registered: May 2003
Location: Beijing, China
Distribution: RedHat 8/9
Posts: 13

Original Poster
Rep: Reputation: 0
Thanks for the info. I will make the changes tonight (when everybody is out of the office). Quick question, will the changes be permanent? or do I need to run them each time I boot the system (ie place in bootup script)?

Thanks, Ben
 
Old 06-12-2003, 01:35 PM   #11
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,536

Rep: Reputation: 148Reputation: 148
The version above - every boot. But you can modify the startup scripts to make it for you. You have a script to run pppd, right? Make sure it starts AFTER eth0, and make sure you have 'defaultroute' as one of the options in /etc/ppp/options (or a similar file in your system, may be for example /etc/pppd/options).
 
  


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
RPM is ridiculous... borrrden Linux - Software 3 10-06-2004 04:06 PM
Configuring Nic chalichalupa Linux - Networking 6 01-13-2004 02:47 AM
This is getting ridiculous Citizen Bleys Linux - Software 4 09-22-2003 03:56 PM
Configuring my NIC under Linux will824 Linux - Networking 3 07-03-2003 02:48 AM
Configuring NIC macone Linux - Networking 5 01-22-2003 05:25 PM


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