0

I am using Hyper v for my linux lab.

I have Ubuntu Server 16.04 which contain 2 network cards that shown in the system as 2 Interfaces.

eth0: I configured it to get IP from DHCP server (my dlink router which provides internet access).

eth1: I configured a static IP on it for my internal network.

This is the /etc/network/interfaces file that I edit:

#######Primary Network interface
Auto eth0
Iface eth0 inet DHCP

#######The Internal Network interface
Auto eth1
Iface eth1 inet static 
address 192.168.1.1 
netmask 255.255.255.0 
gateway 192.168.1.254 
dns-nameservers 192.168.1.254

After I finish to edit the configuration file and doing reboot to server - I loses my Internet access.

Even if I try to ping to 8.8.8.8 from eth0 (with ping -I eth0 8.8.8.8 command) it fails.

When I delete the internal network interface from the configuration file and reboot, my internet connection gets restored.

What am I doing wrong? How can I configure my machine so that the eth0 device will use for internet access only, and the eth1 will use for my internal network?

  • shouldn't "Autu eth0" and "Autu eth1" be Auto? Is that a typo? – amc Jun 14 '16 at 16:12
  • It was typo. Still have the problem – Ofer Wessboim Jun 14 '16 at 16:17
  • What does ifconfig look like for your eth0 dhcp? – user508889 Jun 14 '16 at 16:34
  • Check out ifenslave just search for it on Google. I think this will help you out with what you want to do. – Alex Lowe Jun 15 '16 at 16:07
  • almost 3 years, yet: I would remove gateway definition of eth1. DHCP should send a gateway to eth0, and unless you have more remote network behind eth1 (e.g. 192.168.111.X), gateway definition routing is useless. system knows that IP like 192.168.1.X should be send to eth1, and all other to eth0. – Archemar Mar 19 '19 at 15:38
0

im not sure about it, came across this when i was reading other related eth0 setting

ip route with two default gateways

maybe can help you

|improve this answer|||||
  • This is probably the correct answer, however, it should be a comment. Until you have enough rep to comment, you should focus on providing complete answers. But like I said, most likely, he has 2 default gateways in his routing table for 0.0.0.0, which isn't going to work. – user508889 Jun 14 '16 at 16:40
0

can you tell the version of ubuntu server? If you are sure that you are getting settings from dhcp on eth0 you could try reading the output from: ifconfig /a

just to be sure i'd do:

sudo nano /etc/network/interfaces

Add below to interfaces file

auto eth0

allow-hotplug eth0

iface eth0 inet dhcp

auto eth1

iface eth1 inet static

address 192.168.1.1 

netmask 255.255.255.0 

gateway 192.168.1.254 

And then run:

sudo nano /etc/resolv.conf

And add:

nameserver 192.168.1.254 

nameserver 8.8.8.8

Finally run:

sudo apt-get update && sudo apt-get install hv-kvp-daemon-init linux-tools-virtual linux-cloud-tools-virtual

or you can read here:

https://help.ubuntu.com/community/NetworkManager#Using_NetworkManager_on_the_command_line

and type nmcli help

|improve this answer|||||
  • Thank you all for your quick response. I tried Malkavian suggestuin but it didn't help. After remove default gateway from eth1 - my Internet connection came back. Is there any way to set the eth0 gatway as my primary and the eth1 gateway as secondary gateway? – Ofer Wessboim Jun 14 '16 at 21:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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