Score:0

my network is unreachable

us flag

i'm using ubuntu 20.04 on a virtual machine and i have changed mi ip conf from dymanic to static, but i do not have network connection; the file 00-installer-config.yaml located at /etc/netplan was at the beginning:

network:
  ethernets:
    enp0s3:
      dhcp4: true
  version: 2

i changed the file, through nano, to:

network:
  ethernets:
    enp0s3:
      dhcp4: no
      addresses: [10.10.2.188/24]
      gateway4: 10.10.0.1
      nameservers:
        addresses: [10.10.1.7, 10.10.0.1]
  version: 2

then i use the command $sudo netplan apply and i do not get any error, although i can see my host computer through ping, i do not get any network connection.

Here is an output from netplan debug:

user:~$ sudo netplan --debug generate
DEBUG:command generate: running ['/lib/netplan/generate']
** (generate:1348): DEBUG: 16:04:25.389: Processing input file /etc/netplan/00-installer-config.yaml..
** (generate:1348): DEBUG: 16:04:25.391: starting new processing pass
** (generate:1348): DEBUG: 16:04:25.392: We have some netdefs, pass them through a final round of validation
** (generate:1348): DEBUG: 16:04:25.394: enp0s3: setting default backend to 1
** (generate:1348): DEBUG: 16:04:25.395: Configuration is valid
** (generate:1348): DEBUG: 16:04:25.397: Generating output files..
** (generate:1348): DEBUG: 16:04:25.398: openvswitch: definition enp0s3 is not for us (backend 1)
** (generate:1348): DEBUG: 16:04:25.400: NetworkManager: definition enp0s3 is not for us (backend 1)
(generate:1348): GLib-DEBUG: 16:04:25.401: posix_spawn avoided (fd close requested)
(generate:1348): GLib-DEBUG: 16:04:25.411: posix_spawn avoided (fd close requested)

I know it is something simple, but i do not understand why this is not working. Am I missing something?

Thanks in advance.


@chili555 this is the file hook-network-manager:

#!/bin/sh 
# this file is part of cloud-init. See LICENSE file for license information #
# This script hooks into NetworkManager(8) via its scripts 
# arguments are 'interface-name' and 'action'
#
is_azure() {     
    local dmi_path="/sys/class/dmi/id/board_vendor" vendor=""     
    if [ -e "$dmi_path" ] && read vendor < "$dmi_path"; then         
        [ "$vendor" = "Microsoft Corporation" ] && return 0     
    fi     
    return 1 
}
 
is_enabled() {     
    # only execute hooks if cloud-init is enabled and on azure     
    [ -e /run/cloud-init/enabled ] || return 1
    is_azure
}

if is_enabled; then
    case "$1:$2" in
        *:up) exec cloud-init dhclient-hook up "$1";;
        *:down) exec cloud-init dhclient-hook down "$1";; 
    esac
fi
Doug Smythies avatar
gn flag
Your gateway is not on the same sub-net as your IP address. You might have to specify a renderer, maybe networkd maybe something else, I don't know.
t0ny1402 avatar
us flag
I already did it, i declared it just below version, `renderer: networkd` and still nothing happens
chili555 avatar
cn flag
It appears that Network Manager is running. I'd set the static IP in NM and revert netplan. Welcome to Ask Ubuntu.
t0ny1402 avatar
us flag
@chili555 how do I do that??, I mean, I have one file `hook-network-manager` located at `/etc/NetworkManager/dispatcher.d`/n `#!/bin/sh` `# This file is part of cloud-init. See LICENSE file for license information.` `# This script hooks into NetworkManager(8) via its scripts` `# arguments are 'interface-name' and 'action'`
t0ny1402 avatar
us flag
`is_azure() { local dmi_path="/sys/class/dmi/id/board_vendor" vendor="" if [ -e "$dmi_path" ] && read vendor < "$dmi_path"; then [ "$vendor" = "Microsoft Corporation" ] && return 0 fi return 1 } is_enabled() { # only execute hooks if cloud-init is enabled and on azure [ -e /run/cloud-init/enabled ] || return 1 is_azure } if is_enabled; then case "$1:$2" in *:up) exec cloud-init dhclient-hook up "$1";; *:down) exec cloud-init dhclient-hook down "$1";; esac fi`
chili555 avatar
cn flag
What does this report? `ps aux | grep Network` also: `sudo service NetworkManager status | grep Active` Please edit your question to show the result.
t0ny1402 avatar
us flag
@chili555 the first one gives: `antonio 1362 0.0 0.0 6432 740 tty1 S+ 14:14 0:00 grep Network ` ; and sudo service.. says `Unit NetworkManager.service could not be found`
chili555 avatar
cn flag
NM is apparently not running and interfering. However, as stated above, "Your gateway is not on the same sub-net as your IP address." As well, the DNS nameserver addresses are suspect. Please clarify.
t0ny1402 avatar
us flag
@chili555 those are the DNS nameservers from the domain server and the firewall respectively, and, because i am working with hierarchy into a firewall, that is why the IP address and the gateway are not in the same sub-net
Doug Smythies avatar
gn flag
Your sub-net includes the range 10.10.2.0 to 10.10.2.255. Your gateway is not within that range.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.