Solved

How do I set up 2 NICs in Ubuntu? One NIC is not responding

Posted on 2008-10-08
8
1,177 Views
Last Modified: 2012-05-05
So I have two routers plugged into my ubuntu server (2 NICs)

eth0: 192.168.0.10 <--- my internal network
eth1: 192.168.1.10 <--- to external network

The internal network is functioning correctly (can still connect, IP is actually being set, etc...). I am unable to connect to the server through eth1 (and I need to be able to through HTTP, SSH, etc...)

Here is my /etc/network/interfaces :
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.0.10
netmask 255.255.255.0
gateway 192.168.0.1

auto eth1
iface eth1 inet static
address 192.168.1.10
netmask 255.255.255.252
Any ideas? I read on other forums I shouldn't specify a gateway for eth1 since it will confuse the OS. And here is my route -n:

Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.8 0.0.0.0 255.255.255.252 U 0 0 0 eth1
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 eth0

Here is my ifconfig -a:
eth0 Link encap:Ethernet HWaddr 00:E0:18:9E:52:00
inet addr:192.168.0.10 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::2e0:18ff:fe9e:5200/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:734347 errors:0 dropped:0 overruns:0 frame:0
TX packets:718706 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:357467314 (340.9 MiB) TX bytes:776330370 (740.3 MiB)

eth1 Link encap:Ethernet HWaddr 00:A0:CC:3A:6A:66
inet addr:192.168.1.10 Bcast:192.168.1.11 Mask:255.255.255.252
inet6 addr: fe80::2a0:ccff:fe3a:6a66/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:141 errors:2 dropped:0 overruns:0 frame:0
TX packets:56 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:11090 (10.8 KiB) TX bytes:7137 (6.9 KiB)
Interrupt:169 Base address:0x9400

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:16436 Metric:1
RX packets:1746 errors:0 dropped:0 overruns:0 frame:0
TX packets:1746 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:166592 (162.6 KiB) TX bytes:166592 (162.6 KiB)

sit0 Link encap:IPv6-in-IPv4
NOARP MTU:1480 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Thanks in advance for any help you can provide!!
0
Comment
Question by:Geesu
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
8 Comments
 
LVL 78

Expert Comment

by:arnold
ID: 22671329
You need to configure your external Router to port forward ssh/http or any other port to the 192.168.1.10 IP.
eth1 actually should be the one with the default gateway/default router of 192.168.1.9.
Is it not the case that the eth1 interface is set to DHCP?
0
 
LVL 9

Expert Comment

by:chingmd
ID: 22671344
The only thing that I see:

192.168.1.8 is the network ID for the network.  The usable IP's are 192.168.1.9 and 192.168.1.10
8 being the network ID and 11 being the broadcast address

And the route for the 192.168.1.8/30 network needs to point to the router location of the external network.
0
 

Author Comment

by:Geesu
ID: 22671450
@arnold - Why would eth1 be the default gateway?  Also - port forwarding doesn't matter at this point as I'm on the internal network on both (I just plug my laptop into either route and try to SSH to the server)

@chingmd - How do I do this?
0
Save the day with this special offer from ATEN!

Save 30% on the CV211 using promo code EXPERTS30 now through April 30th. The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

 
LVL 9

Expert Comment

by:chingmd
ID: 22671806
Look here:
http://ubuntuforums.org/showthread.php?p=217263

Adding this line at the end of the interfaces file:

up route add -net 192.168.1.0 netmask 255.255.255.252 gw 192.168.1.9 dev eth1


Also just in case, your external router is 192.168.1.9 right?

I believe that the comment that Arnold was making is that usually,  you want the external network as the default gateway, because that's how the internal network would get to the internet.     But it sounds like you actually have two internet connections, and are trying to multi home a box.


0
 

Author Comment

by:Geesu
ID: 22671928
@chingmd the external router is actually 192.168.1.1 - I'm not sure why it lists 192.168.1.8 after doing route -n
0
 

Author Comment

by:Geesu
ID: 22671975
I added:

up route add -net 192.168.1.0 netmask 255.255.255.252 gw 192.168.1.1 dev eth1

and now when I do ifconfig eth1 isn't even listed
0
 
LVL 9

Accepted Solution

by:
chingmd earned 500 total points
ID: 22672029
The reason is because of the netmask you are using.

Look at this subnet mask calculator.  http://www.subnet-calculator.com/

Enter your IP, and select your subnet mask.   Useable hosts are 9 and 10.

To fix this:  You will need to verify several things:

the Ip and netmask of the router that is using the IP of 192.168.1.1

IF:  it's 192.168.1.1 with a subnet of 255.255.255.0
Change the interfaces lines to read this:
auto eth1
iface eth1 inet static
address 192.168.1.10
netmask 255.255.255.0

up route add -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.1.1 dev eth1



If the router has 192.168.1.1 with a subnet of 255.255.255.252.
Change the interfaces files with this:
auto eth1
iface eth1 inet static
address 192.168.1.2
netmask 255.255.255.252

up route add -net 192.168.1.0 netmask 255.255.255.252 gw 192.168.1.1 dev eth1


0

Featured Post

Easy, flexible multimedia distribution & control

Coming soon!  Ideal for large-scale A/V applications, ATEN's VM3200 Modular Matrix Switch is an all-in-one solution that simplifies video wall integration. Easily customize display layouts to see what you want, how you want it in 4k.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
Fine Tune your automatic Updates for Ubuntu / Debian
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question