Solved

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

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

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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
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.

760 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

23 Experts available now in Live!

Get 1:1 Help Now