• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1194
  • Last Modified:

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

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
Geesu
Asked:
Geesu
  • 3
  • 3
1 Solution
 
arnoldCommented:
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
 
chingmdCommented:
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
 
GeesuAuthor Commented:
@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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
chingmdCommented:
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
 
GeesuAuthor Commented:
@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
 
GeesuAuthor Commented:
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
 
chingmdCommented:
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 does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now