Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm new to Linux, trying to get a Clonezilla server up. I'm really bad at understanding how my network should be configured. eth1 is the card for internet access, behind a proxy (192.168.41.5:80) eth2 is the card for deploying, connected to a router.

When eth2 is running, I can't seem to connect to the internet as it automatically try to use eth2 for everything (Firefox, ping, apt-get). Why is that?

Running Ubuntu 13.4

eth1      Link encap:Ethernet  HWaddr 00:04:76:14:52:9a  
          inet addr:192.168.12.2  Bcast:192.168.12.255  Mask:255.255.255.0
          inet6 addr: fe80::204:76ff:fe14:529a/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1821 errors:0 dropped:137 overruns:1 frame:0
          TX packets:319 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:214123 (214.1 KB)  TX bytes:54667 (54.6 KB)
          Interrupt:16 Base address:0xa000

eth2      Link encap:Ethernet  HWaddr 00:25:64:e7:2b:e3  
          inet addr:192.168.200.1  Bcast:192.168.200.255  Mask:255.255.255.0
          inet6 addr: fe80::225:64ff:fee7:2be3/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:1004 (1.0 KB)
          Interrupt:16

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:65536  Metric:1
          RX packets:1115 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1115 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:0 
         RX bytes:85036 (85.0 KB)  TX bytes:85036 (85.0 KB)

My etc/network/interfaces:

auto lo
iface lo inet loopback

auto eth1
iface eth1 inet static
address 192.168.12.2
netmask 255.255.255.0
gateway 192.168.12.213

auto eth2
iface eth2 inet static
address 192.168.200.1
netmask 255.255.255.0

Ps: I'm connected in ssh (what a great invention) into 192.168.12.2 and it works (even if I can't ping my proxy) Ps2: Sorry if it's a stupid question, "Linux" was just a fancy word for me not so long ago.

Have a good day :)

share|improve this question
    
Welcome to askubuntu! –  mondjunge Oct 25 '13 at 14:29

2 Answers 2

up vote 1 down vote accepted

You should be able to use the command ifmetric to set the metrics for each interface. The lower the metric the more "preferred" it is.

It is not included by default, but you can add it with sudo apt-get install ifmetric.

Then use ifmetric interface value to set the metric.

So to make eth1 "preferred" set its metric to 0, or set eth2's metric to 2 or higher.

To give credit were it's due, I found the answer here:

------------------------------------------------------------------------------------------------
Also, from the Debian Documents pages:

5.6.2. The ifmetric package

The ifmetric package enables us to manipulate metrics of routes a posteriori even for DHCP.

The following sets the eth0 interface to be preferred over the wlan0 interface.

  1. Install the ifmetric package.
  2. Add an option line with "metric 0" just below the "iface eth0 inet dhcp" line.
  3. Add an option line with "metric 1" just below the "iface wlan0 inet dhcp" line.

The metric 0 means the highest priority route and is the default one. The larger metric value means lower priority routes. The IP address of the active interface with the lowest metric value becomes the originating one. See ifmetric(8).

share|improve this answer
    
Thank you for your answer. It seems to be working now but sometimes (when I install DRBL, or after a random reboot) the settings seems to wipe again. Any idea why this is happening? I'm using "sudo init 6" for reboot, and I'm wondering, is this the right way? –  Antoninarto Oct 28 '13 at 8:12
    
You can use that command, but sudo reboot is just as simple. I would have to look at the run levels again to see if there is any difference. –  Argusvision Oct 30 '13 at 14:55
    
In the second part (below the line), did you go into the /etc/network/interfaces file and add the metric 0 and metric 1 lines? If you don't add those lines, I'm pretty sure doing the first part (above the line) is only a temporary fix. –  Argusvision Oct 30 '13 at 19:04

I found the answer myself using this link http://ubuntuforums.org/showthread.php?t=2166647 but I still need some explanations:

How could I have done that in command line? I'm using SSH to administer my server and I had to walk all the way to it (like 3 meters. I'm lazy) to use the GUI

Edit: Oh wait, it doesn't work anymore. I'm doomed.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.