LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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-04-2015, 04:52 AM   #1
orbegonzo
LQ Newbie
 
Registered: Sep 2015
Location: Spain
Posts: 10

Rep: Reputation: Disabled
Question Problem Adding New Network Interface Card


Hello everybody.

I'm a newbie regarding Linux and networking, so I will really appreciate any help provided.

I have installed a second Network Interface Card in a computer. The computer runs CentOS 6.6 Minimal (so there is not GUI). I have configured it using the "system-config-network" command, and the new interface is up, but I can't access that inteface from my LAN (and vice versa). The other interface runs OK. I attach the ifconfig command result:

Quote:
eth0 Link encap:Ethernet HWaddr 00:1A:92:EB:04:B2
inet addr:192.168.7.228 Bcast:192.168.7.255 Mask:255.255.248.0
inet6 addr: fe80::21a:92ff:fedb:4b2/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:23643 errors:0 dropped:0 overruns:0 frame:0
TX packets:981 errors:0 dropped:0 overruns:0 carrier:1
collisions:0 txqueuelen:1000
RX bytes:2047895 (1.9 MiB) TX bytes:314036 (306.6 KiB)

eth1 Link encap:Ethernet HWaddr 10:FE:ED:02:94:E6
inet addr:192.168.7.245 Bcast:192.168.7.255 Mask:255.255.248.0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:3185 errors:0 dropped:0 overruns:0 frame:0
TX packets:21 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:261630 (255.4 KiB) TX bytes:1718 (1.6 KiB)

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:322 errors:0 dropped:0 overruns:0 frame:0
TX packets:322 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:30116 (29.4 KiB) TX bytes:30116 (29.4 KiB)
Any leads?

Regards
 
Old 09-04-2015, 06:39 AM   #2
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,819

Rep: Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144
Just to clarify - you have both interfaces connected to a common switch? It is not usual to have both interfaces configured with IP addresses on the same subnet as it can produce strange results. You should share your routing table as well
Code:
ip route
In any case, one interface will normally be preferred over the other as defined by the metric value.

Last edited by ferrari; 09-04-2015 at 06:43 AM.
 
1 members found this post helpful.
Old 09-04-2015, 09:38 AM   #3
orbegonzo
LQ Newbie
 
Registered: Sep 2015
Location: Spain
Posts: 10

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by ferrari View Post
Just to clarify - you have both interfaces connected to a common switch? It is not usual to have both interfaces configured with IP addresses on the same subnet as it can produce strange results. You should share your routing table as well
Code:
ip route
In any case, one interface will normally be preferred over the other as defined by the metric value.
Thank you for the answer. Yes, that's how the interfaces are connected. I supposed that it wasn't the best way to do it, but I'm building a "test network", so, at least initially, I had to use that kind of configuration.

The ip route results:

Code:
[root@localhost ~]# ip route
192.168.0.0/21 dev eth0  proto kernel  scope link  src 192.168.7.228 
192.168.0.0/21 dev eth1  proto kernel  scope link  src 192.168.7.245 
169.254.0.0/16 dev eth0  scope link  metric 1002 
169.254.0.0/16 dev eth1  scope link  metric 1003 
default via 192.168.1.254 dev eth0
I have been performing several additional tests:
- If I bring down interface Eth0, Eth1 can reach my LAN (although I still can't access external IPs), so it seems that part of the problem is that both interfaces can't work at the same time (maybe it's what you said about sharing the same subnet).
- I have tried assigning a complete different subnet to the eth1 and connecting my laptop to that Ethernet port; and it's quite strange because eth1 can communicate with the laptop, but the laptop can't ping eth1.

Regards
 
Old 09-04-2015, 04:47 PM   #4
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,819

Rep: Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144Reputation: 1144
Quote:
- If I bring down interface Eth0, Eth1 can reach my LAN (although I still can't access external IPs), so it seems that part of the problem is that both interfaces can't work at the same time (maybe it's what you said about sharing the same subnet).
Yes, that is because eth0 is preferred and your default route is via eth0 as well. If you examine your routing table while eth0 is disconnected, you'll observe that there is no default route (for routing to external IP addresses). Addresses within the LAN (same network segment) can be reached because ARP is used.

You could add the gateway manually with
Code:
ip route add default via 192.168.1.254 dev eth1
*Note that you can only have one default gateway assigned at a time.
 
1 members found this post helpful.
Old 09-07-2015, 05:24 AM   #5
orbegonzo
LQ Newbie
 
Registered: Sep 2015
Location: Spain
Posts: 10

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by ferrari View Post
Yes, that is because eth0 is preferred and your default route is via eth0 as well. If you examine your routing table while eth0 is disconnected, you'll observe that there is no default route (for routing to external IP addresses). Addresses within the LAN (same network segment) can be reached because ARP is used.

You could add the gateway manually with
Code:
ip route add default via 192.168.1.254 dev eth1
*Note that you can only have one default gateway assigned at a time.
Thank you so much for your help. OK, so I suppose that in order to make both NICs work at the same time, it's not just enough to add a new default gateway with that command, is it? Do I need to use static routing?

After some research, I have decided to change the network configuration and implement static routing. This is the new configuration (that still doesn't work):

Code:
eth0: IP: 192.168.7.228
        Mask: 255.255.255.0
        GW: 192.168.7.254

eth1  IP: 10.10.70.38
      Mask: 255.255.255.0
      GW: 10.10.70.254 (no Internet connected, just for local access).
First I created a new table "admin" in rt_tables. Then I added the new interface to the table:

Code:
ip route add 10.10.70.0/24 dev eth1 src 10.10.70.38 table admin
ip route add default via 10.10.70.254 dev eth1 table admin
I added the new rules:
Code:
ip rule add from 10.10.70.38/32 table admin
ip rule add to 10.10.70.38/32 table admin
And finally I made a flush of the cache.


However, the situation is the same. On the one hand, I can't access the Internet (I suppose that the cause is that it uses as default the GW of eth1 that is not connected to the Internet, I've tried to replace it using the previous one, but it says 'Error: either "to" is duplicate, or "eth0" is a garbage.'). On the other hand, the ping is still one-sided (I can ping from eth1 to my computer, but no in reverse way -maybe because eth1 gets the ping, but then sends response using eth0?).

I show the new network info:

Code:
[root@localhost ~]# ip route
10.10.70.0/24 dev eth1  proto kernel  scope link  src 10.10.70.38 
192.168.0.0/21 dev eth0  proto kernel  scope link  src 192.168.7.228 
169.254.0.0/16 dev eth0  scope link  metric 1002 
169.254.0.0/16 dev eth1  scope link  metric 1003 
default via 10.10.70.254 dev eth1
Code:
[root@localhost ~]# ip rule show                                                                                                                                        
0:      from all lookup local 
32764:  from all to 10.10.70.38 lookup main 
32765:  from 10.10.70.38 lookup main 
32766:  from all lookup main 
32767:  from all lookup default
Code:
 ifconfig
eth0      Link encap:Ethernet  HWaddr 00:1A:92:DB:04:B2  
          inet addr:192.168.7.228  Bcast:192.168.7.255  Mask:255.255.248.0
          inet6 addr: fe80::21a:92ff:fedb:4b2/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:55928 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1889 errors:0 dropped:0 overruns:0 carrier:2
          collisions:0 txqueuelen:1000 
          RX bytes:4829639 (4.6 MiB)  TX bytes:411318 (401.6 KiB)

eth1      Link encap:Ethernet  HWaddr 10:FE:ED:02:94:E6  
          inet addr:10.10.70.38  Bcast:10.10.70.255  Mask:255.255.255.0
          inet6 addr: fe80::12fe:edff:fe02:94e6/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:691 errors:0 dropped:0 overruns:0 frame:0
          TX packets:889 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:220930 (215.7 KiB)  TX bytes:206928 (202.0 KiB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:478 errors:0 dropped:0 overruns:0 frame:0
          TX packets:478 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:201190 (196.4 KiB)  TX bytes:201190 (196.4 KiB)
Regards
 
  


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
2 network interface card problem kashif2131971 Linux - Networking 3 08-02-2008 02:42 PM
Slackware / Ethernet Network Interface Card (NIC) problem. dwengert Slackware 2 05-21-2008 09:30 PM
Network Interface Card config problem dcalki Linux - Hardware 2 11-01-2007 02:14 PM
Problem with network interface card Marvell Yukon orion06 Mandriva 3 02-17-2006 12:56 PM

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

All times are GMT -5. The time now is 04:55 AM.

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