Solved

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

Posted on 2008-10-08
8
1,172 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 77

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
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
linux boot fsck problem 3 61
php ssh2_scp_send 1 48
networking details on centos 6.6 4 52
su - oracle could not open session 6 50
If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

910 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now