Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2008-10-08
8
Medium Priority
?
1,188 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
  • 3
  • 3
8 Comments
 
LVL 80

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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 2000 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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Suggested Courses
Course of the Month11 days, 19 hours left to enroll

916 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