LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Default gateway in /etc/network/interfaces is simply ignored (https://www.linuxquestions.org/questions/linux-newbie-8/default-gateway-in-etc-network-interfaces-is-simply-ignored-4175496424/)

namanix 02-27-2014 08:43 AM

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

notKlaatu 02-27-2014 12:44 PM

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?

namanix 02-27-2014 12:50 PM

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.

notKlaatu 02-27-2014 12:59 PM

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.

namanix 02-27-2014 01:06 PM

/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.

notKlaatu 02-27-2014 01:40 PM

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

namanix 02-27-2014 02:05 PM

Hi,

I just tryed your solution. But still no luck :(

dolphin_oracle 02-27-2014 02:41 PM

have you tried just modifying resolv.conf with 8.8.8.8 without doing the route commands to the gateway?

notKlaatu 02-28-2014 02:24 AM

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?


All times are GMT -5. The time now is 06:19 AM.