How To Use Network "Metric" to Manage Two NICS in one PC?
I am moving from Windows 7 to Ubuntu MATE 15.10
Each desktop PC is connected on 2 networks. Network 1 has internet access, network 2 does not. The only connection between the two networks are the desktops. Network 1 is serviced by a DHCP router 192.168.1.1. network 2 is serviced by a DHCP router 192.168.2.1.
I do not want to disable the DHCP of either router, as many other devices hookup and disconnect to each of the two networks during the day.
I want to use the network "metric" to prioritize the connections, so that network one gets all internet traffic:
Network 1 will have a metric=10 while Network 2 will have a metric=100
Ubuntu Network Connections GUI is installed, but not configured. I have fiddled with the /etc/network/interfaces
file in an attempt to set metrics:
auto lo
iface lo inet loopback
iface eth1 inet dhcp
metric 10
iface eth2 inet dhcp
metric 100
This disables both network connections altogether according to the connections indicator in the top bar.
How can I get both networking connections working and have internet traffic routed on network 1?
Your /etc/network/interfaces
should look like the following to keep the interfaces enabled.
auto lo
iface lo inet loopback
auto eth1
iface eth1 inet dhcp
metric 10
auto eth2
iface eth2 inet dhcp
metric 100
From the man interfaces
page:
Lines beginning with the word "auto" are used to identify the physical
interfaces to be brought up when ifup is run with the -a option.
(This option is used by the system boot scripts.) Physical interface
names should follow the word "auto" on the same line. There can be
multiple "auto" stanzas. ifup brings the named interfaces up in the
order listed.
So, putting the word auto
will make it so those connections come up on boot or when restarting the network.
Hope this helps!