LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-27-2014, 08:43 AM   #1
namanix
LQ Newbie
 
Registered: Feb 2014
Posts: 4

Rep: Reputation: Disabled
Default gateway in /etc/network/interfaces is simply ignored


Hi there i have a problem with my linux virtual machine

Structure:
I am using a dedicated server from "Online.net" with an extra ip address.
On the server i have installed esxi 5.1.
For the people who want to know what server it is: Server rack ultracompact Dell PowerEdge R210 II
The vm on the esxi server is a clean Ubuntu 12.04 (I just installed it)

Problem:
Every time i restart the server, my network connection is not set correct. I need to do a few extra steps to get it to work. That results in the following: Every time i reboot the server it hangs for like 1:30 minutes because it cannot find the correct network settings.

Technical:
To get pinging to an ip address to work i need to do this:
Code:
route add 62.210.123.1 dev eth0
route add default gw 62.210.123.1
Otherwise it just says: Network is unreachable
After that to get it fully functional i need to do this:
Code:
nano /etc/resolv.conf
and add: nameserver 8.8.8.8
and after that:
Code:
service networking restart
Everything works now.

My /etc/network/interfaces looks like this:
Code:
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
     address 212.83.168.209
     netmask 255.255.255.0
     network 212.83.168.0
     broadcast 212.83.168.255
     gateway 62.210.123.1
     dns-nameservers 62.210.16.6 62.210.16.7
Beg:
Can someone please help me with this issue. I am having this problem for almost 2 days now. Getting a bit desperate :P

Thanks in advance,
Kevin Walter

Last edited by colucix; 02-27-2014 at 12:23 PM. Reason: Removed link to commercial site.
 
Old 02-27-2014, 12:44 PM   #2
notKlaatu
Senior Member
 
Registered: Sep 2010
Location: Wellington, New Zealand
Distribution: Slackware, Fedora
Posts: 1,015

Rep: Reputation: 663Reputation: 663Reputation: 663Reputation: 663Reputation: 663Reputation: 663
Two things come immediately to mind:

Is everything else on this virtual server persistent across boots or is it just the /etc/network/interfaces information?

Did you disable NetworkManager from managing these interfaces?
 
Old 02-27-2014, 12:50 PM   #3
namanix
LQ Newbie
 
Registered: Feb 2014
Posts: 4

Original Poster
Rep: Reputation: Disabled
Hi,

I did not fully understand your first question. If you mean if this is the only problem when i reboot than yes.

Is NetworkManager even active on a Ubuntu Server edition. I think i forgot to mention that i installed a server edition.
 
Old 02-27-2014, 12:59 PM   #4
notKlaatu
Senior Member
 
Registered: Sep 2010
Location: Wellington, New Zealand
Distribution: Slackware, Fedora
Posts: 1,015

Rep: Reputation: 663Reputation: 663Reputation: 663Reputation: 663Reputation: 663Reputation: 663
I guess my first question is an expression of how I don't understand why /etc/network/interfaces is not maintaining the information you enter into it.

Usually files don't just re-set themselves unless they are being auto-generated by the OS (or a process of the OS) or, in a VM, if the state of the virtual machine is not being saved or if you are rebooting to a snapshot of the system as it existed prior to you changing those files.

Can you look in /etc/NetworkManager/NetworkManager.conf and check to make sure it is not active? That would eliminate the possibility of NM overriding your changes.

Aside from that, maybe make a test file somewhere within your Ubuntu VM, and then reboot it. If, after reboot, that file still exists exactly as you created it, then at least we would know that everything else on that VM should be the same.

IF both of those things turn out to be OK, then it is some other process that is re-setting your interfaces and resolv.conf files.

---------- Post added 2014-02-28 at 08:00 ----------

I guess my first question is an expression of how I don't understand why /etc/network/interfaces is not maintaining the information you enter into it.

Usually files don't just re-set themselves unless they are being auto-generated by the OS (or a process of the OS) or, in a VM, if the state of the virtual machine is not being saved or if you are rebooting to a snapshot of the system as it existed prior to you changing those files.

Can you look in /etc/NetworkManager/NetworkManager.conf and check to make sure it is not active? That would eliminate the possibility of NM overriding your changes.

Aside from that, maybe make a test file somewhere within your Ubuntu VM, and then reboot it. If, after reboot, that file still exists exactly as you created it, then at least we would know that everything else on that VM should be the same.

IF both of those things turn out to be OK, then it is some other process that is re-setting your interfaces and resolv.conf files.
 
Old 02-27-2014, 01:06 PM   #5
namanix
LQ Newbie
 
Registered: Feb 2014
Posts: 4

Original Poster
Rep: Reputation: Disabled
/etc/NetworkManager/ does not even exist on the server (but this is normal because it is a server version without a GUI).

I am sure files are still there if i restart the server.
It is not that /etc/network/interfaces is being overwrited.
The gateway is simply ignored in that file.
 
Old 02-27-2014, 01:40 PM   #6
notKlaatu
Senior Member
 
Registered: Sep 2010
Location: Wellington, New Zealand
Distribution: Slackware, Fedora
Posts: 1,015

Rep: Reputation: 663Reputation: 663Reputation: 663Reputation: 663Reputation: 663Reputation: 663
I understand now, sorry.

In that case, try adding this to your /interfaces config:

Code:
    post-up route add -net 62.210.0.0 netmask 255.255.0.0 gw 62.210.123.1

Last edited by notKlaatu; 02-27-2014 at 01:55 PM.
 
Old 02-27-2014, 02:05 PM   #7
namanix
LQ Newbie
 
Registered: Feb 2014
Posts: 4

Original Poster
Rep: Reputation: Disabled
Hi,

I just tryed your solution. But still no luck
 
Old 02-27-2014, 02:41 PM   #8
dolphin_oracle
Member
 
Registered: Dec 2013
Posts: 340

Rep: Reputation: Disabled
have you tried just modifying resolv.conf with 8.8.8.8 without doing the route commands to the gateway?
 
Old 02-28-2014, 02:24 AM   #9
notKlaatu
Senior Member
 
Registered: Sep 2010
Location: Wellington, New Zealand
Distribution: Slackware, Fedora
Posts: 1,015

Rep: Reputation: 663Reputation: 663Reputation: 663Reputation: 663Reputation: 663Reputation: 663
Your gateway is on a separate network. You are attempting to have one NIC, however virtual it may be, straddle two separate networks without any kind of routing between the two.

You should be able to add the pre-up routing info into your interfaces file so that a static route is manually defined whenever the networking scripts are init'd.

Play around with the broadcast masks, but the pre-up stanza should hard code the route in to the network setup.

Possibly try this:

Code:
post-up route add -net 62.0.0.0 netmask 255.0.0.0 gw 62.210.123.1
If nothing you try in the interfaces file works, you could always script the process of adding the route in some external script and have it execute at boot time, like in a sort of rc.local equivalent, if that makes sense.

I've never used ESXi so I'm not familiar with what it is doing in terms of virtualising NIC cards. Is that where the 62.x.x.x comes from?

---------- Post added 2014-02-28 at 21:24 ----------

Your gateway is on a separate network. You are attempting to have one NIC, however virtual it may be, straddle two separate networks without any kind of routing between the two.

You should be able to add the pre-up routing info into your interfaces file so that a static route is manually defined whenever the networking scripts are init'd.

Play around with the broadcast masks, but the pre-up stanza should hard code the route in to the network setup.

Possibly try this:

Code:
post-up route add -net 62.0.0.0 netmask 255.0.0.0 gw 62.210.123.1
If nothing you try in the interfaces file works, you could always script the process of adding the route in some external script and have it execute at boot time, like in a sort of rc.local equivalent, if that makes sense.

I've never used ESXi so I'm not familiar with what it is doing in terms of virtualising NIC cards. Is that where the 62.x.x.x comes from?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Is it better to set the default gateway in network-scripts or network rjo98 Linux - Newbie 5 03-09-2013 06:30 AM
Network problem with DNS and default gateway ip on VM cprusty Linux - Networking 5 09-21-2011 09:58 AM
two interfaces, same network, specify default for outgoing exodist Linux - Networking 2 04-13-2008 09:54 PM
How to add default gateway in /etc/sysconfig/network-scripts/* zamri Linux - Networking 2 09-06-2005 10:32 AM
multiple interfaces, default gateway sopiaz57 Linux - Networking 6 05-03-2005 02:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:48 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration