You are not logged in.

#1 2012-12-25 22:14:48

scarypezsanta
Member
Registered: 2009-06-04
Posts: 25

dual nic setup [SOLVED]

I have two nics in a server each on a different subnet created a profile for each nic in /etc/network.d

CONNECTION='ethernet'
DESCRIPTION='A basic static ethernet connection using iproute'
INTERFACE='eth0'
IP='static'
ADDR='192.168.1.12'
GATEWAY='192.168.1.1'
DNS=('192.168.1.1')

and

CONNECTION='ethernet'
DESCRIPTION='A basic static ethernet connection using iproute'
INTERFACE='eth1'
IP='static'
ADDR='10.0.0.4'
DNS=('10.0.0.1')

I added the profiles to /etc/conf.d/netcfg

NETWORKS=(eth0 eth1)
WIRED_INTERFACE="eth0"

and after a reboot when I run ip addr I see that both interfaces are up and have the ip and subnet I wanted. Unfortunately I am not able to ping outside IP address from eth1. I tried pinging google.com and I tried the ip for google.com 74.125.225.102 but both come back with destination host unreachable.

I checked and I do have nameserver 10.0.0.1 in /etc/resolv.conf so I don't think it is that.

I may be wrong but I think the issue is with the fact that I did not set the gateway in the eth1 profile. I skipped it because if I tried to put it in it fails to start eth1 and I get an error saying 'RTNETLINK answers: File exists.'

I tried following the steps on https://wiki.archlinux.org/index.php/Network_Debugging to track down the issue but I get:

# traceroute -i eth1 10.0.0.1
1  10.0.0.1 (10.0.0.1)  0.644 ms  0.795 ms  0.963 ms

which indicates the gateway is reachable.

Thanks in advance for any advice.

Last edited by scarypezsanta (2012-12-28 07:17:30)

Offline

#2 2012-12-25 22:22:45

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,690

Re: dual nic setup [SOLVED]

Any chance your eth0 and eth1 are swapping at boot?
https://bbs.archlinux.org/viewtopic.php?id=140029


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#3 2012-12-26 01:41:46

scarypezsanta
Member
Registered: 2009-06-04
Posts: 25

Re: dual nic setup [SOLVED]

Thanks for your reply ewaller. The interfaces do not appear to be swapping at boot. If it becomes a problem I will use the procedure in the link you provided. My eth0 consistently works and my eth1 consistently does not.

As I said before I may be mistaken but I still think the issue is with the inability to set the gateway for eth1 the way I set it for eth0. If the gateway is different for each nic it seems like I should have to set it.

Offline

#4 2012-12-27 00:39:57

blackrebel
Member
Registered: 2012-12-10
Posts: 5

Re: dual nic setup [SOLVED]

What is the nic connected to the router? eth1, right? and eth0 is the internal lan?
try with this

CONNECTION='ethernet'
DESCRIPTION='A basic static ethernet connection using iproute'
INTERFACE='eth0'
IP='static'
ADDR='192.168.1.12'
#GATEWAY='192.168.1.1'
#DNS=('192.168.1.1')
CONNECTION='ethernet'
DESCRIPTION='A basic static ethernet connection using iproute'
INTERFACE='eth1'
IP='static'
ADDR='10.0.0.4'
GATEWAY='10.0.0.1'
#DNS=('10.0.0.1') << this is the ip of your router?? try to comment this line
NETWORKS=(eth0 eth1)
WIRED_INTERFACE="eth0 eth1"

Offline

#5 2012-12-27 07:58:36

scarypezsanta
Member
Registered: 2009-06-04
Posts: 25

Re: dual nic setup [SOLVED]

Hey blackrebel, thanks for the reply. I tried your suggestion and it reversed which port had the issue.

Both ports are plugged into routers. Each router is using a different subnet.

I have been reading here http://www.rjsystems.nl/en/2100-adv-routing.php and it looks like I should be setting up default routes for each nic, but I am still getting destination host unreachable after setting up a second routing table that has its own default gateway configured.

echo 2 buttz >> /etc/iproute2/rt_tables
ip route add default via 10.0.0.1 dev eth1 table buttz
ip rule add 10.0.0.4/8 lookup buttz prio 1000

btw I also tried just 10.0.0.4 rather than 10.0.0.4/8 with the same results.

Also I tried to just use dhcp on both ports and that gets both ports working at the same time so it must be possible to get this configured statically LOL.

Last edited by scarypezsanta (2012-12-27 08:05:22)

Offline

#6 2012-12-27 08:21:56

scarypezsanta
Member
Registered: 2009-06-04
Posts: 25

Re: dual nic setup [SOLVED]

I just removed the rule I added above and added a less specific rule

ip rule add from all lookup buttz prio 1000

and this got it working. Now both eth{0,1} can access ip addresses outside of their local networks. I am not clear on why it works and I am also not confident that this is the most efficient solution.

Offline

#7 2012-12-28 07:16:56

scarypezsanta
Member
Registered: 2009-06-04
Posts: 25

Re: dual nic setup [SOLVED]

I changed my second profile to look like this

CONNECTION='ethernet'
DESCRIPTION='A basic static ethernet connection using iproute'
INTERFACE='eth1'
IP='static'
ADDR='10.0.0.4'
NETMASK='255.0.0.0'
IPCFG=('route add default via 10.0.0.1 dev eth1 table buttz' 'rule add from all lookup buttz prio 1000')

Which adds the necessary routing info to the secondary table I added in my previous post. I am still unclear as to why I cannot set a narrow rule with a single IP like I initially wanted to but since that is a tangent I am going to mark this thread as solved. I am planning to add an extension on multiple nics to the networking page on the wiki this weekend so no one else will have to spend as many hours on this as I did. LOL

Thanks again to everyone who responded!

Offline

Board footer

Powered by FluxBB